• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

[CTP] Open Call To Power 1 & 2 Server Project

Blake00

CFC Mod Archivist & Social Media Helper
Super Moderator
Supporter
Joined
Sep 24, 2016
Messages
3,383
Location
Australia
The CTP fans Discord owner Ninjaboy announced a surprise on New Years and informed us that he's been working on a Call To Power Online Single & Multiplayer Server Project for both CTP games hopefully stop all the current issues with people not being able to play multiplayer games on modern machines I'll keep an eye on his progress and post more here...

Github page: https://github.com/justinfarrelldev/open-ctp-server

More details here...
https://discord.gg/mVBDgyVRhT
https://discord.com/channels/924072012295585842/924075114130198559/1191184442669154415 (use join link above first for this link to work)

The Open CTP Server Project

For a month now, I have been crafting a server project in secret which should allow us to play multiplayer in the future!

This project is the Open CTP Server Project, which you can find on my GitHub here: https://github.com/justinfarrelldev/open-ctp-server

Goals

The goal of this project is to recreate the original Civilization: Call to Power and Call to Power II server functionality in a modern server style. Another part of the goal is to add extra game modes - long-turn (as seen in Freeciv), simultaneous and hybrid turns, as well as a few others - to really bring the CTP experience into the modern era.

Connecting Clients

⚠️ This will NOT be a drop-in solution - the original unmodified games will NOT be able to find these servers. The servers will have extra functionality, bug fixes and will be in an entirely-different language to the original servers. Therefore, you will need to be using a client modified to connect to the Open CTP Server in order to play. Additionally, the server is not deployed yet, but has a ticket in the Trello board to automatically deploy the server when new changes are added. ⚠️

I have chosen to use Go, gRPC and protobuffers (with gRPC-Gateway for HTTP support) to make it fairly easy for client developers to connect to this server. Since protobuffers are export-able to C++ 14+, Rust, Go, Java and many other languages, the server methods should be accessible in a fairly language-agnostic way. Of course, my main focus at the moment is C++ and I hope to make an example client in C++ to demonstrate how to connect to the server. My hope is that, eventually, we will have multiple clients connecting to the server and able to play.

If you are interested in helping to develop the server, please select the Server Developer role in ⁠roles! This will give you access to the Open CTP Server category in Discord. All experience levels are welcome! I have created a Trello board to aid us in development (and not stepping on each others' toes). Please also see CONTRIBUTING.md and README.md in the repo for more information.

How long will this process take?

It is impossible to say - this project is only a month old, and we have no idea how many developers will take part.

Work is also needed client-side before playing the game is feasible, which may also take some time.

More Info

This server is also meant to be fork-able for non-commercial use (remember, CTP is still owned by Activision)! If you would like to create a modded server in the future (when the server is actually usable haha), please see LICENSE.md.

Feel free to ping me as well if you have any questions!
 
Ninjaboy has been posting updates on his project in the CTP Discord:

27/08/2024
I've been making steady progress on the Open Call to Power Server project since last night.

The server is now deployed, though it is still in an incredibly early state (there is currently a health check and an endpoint for creating games that currently does nothing - but hey, it is deployed now)!

If you would like to view the docs, you can view the docs at https://open-ctp-server.fly.dev/docs/

I will eventually buy a domain for it, but for now I'm working on setting up database integrations.

Changes Since the Announcement

⚠️ Super technical stuff (you can skip below this section if you want) ⚠️

The developers amongst you may have noticed that there was a massive architecture pivot away from gRPC + protobuffers to a plain Go HTTP/S server architecture. This was largely due to the lack of default values in proto3. proto2 has the default values, but is a really bad option for security purposes (and this server will be exposed to the entire web)! Thus, I made the choice to set up a plain HTTP/S server and instead just focus on providing very clear error messages about what fields may be incorrect or missing. This is done with a Go decoder with the "disallow unknown fields" option turned on.

Documentation

The docs are new! ✨ They're powered by Swagger. Developers, you can test POST request bodies via the docsite before even needing to use Postman. You're welcome 😉

Deployment
I chose Fly.io for deployment because I am experienced in it and it has done remarkably well for my personal website (justin-farrell.com). It is cheap, spins down containers super fast and scales to 0 and back again over the course of a few seconds. Note about the last part: this means you may encounter a pause of up to a few seconds while making requests to the API. This is a cost-saving measure and is intentional. Please code your client-side code accordingly.

Future Updates

I have made ⁠github-updates visible to all, so you can see server progress!

@everyone
Please do note that, while the day has been productive, I will still likely not be able to consistently work on this project for the foreseeable future. I have just had a bit of spare time, and I am really devoting myself to the job hunt. I will still work on it, of course, it just will not be a priority per-se for at least a few more months (but likely longer)

11/12/2024
The Open Call to Power server has been progressing quite quickly (especially over the last few weeks) and it is almost past the "creating accounts and lobbies" phase. This is very exciting, as the next phase is connecting to the lobbies and sending chats, then very soon after that I will be building the world generation logic (using the CTP2 vanilla source code as a base).

You can always see the changes that are being made within the code at ⁠github-updates , and if you are a developer you are more than welcome to join as a contributor 🙂 There is a "contributing.md" file in the top-level of the project that contains the contribution guidelines, and this is the perfect time to hop in.

Just wanted to give a quick update, as the server is coming along nicely!

27/02/2025
I've put together a simple client in C11 to show how to use the APIs from my server. Right now, it just supports account creation since that’s all I had time to build on this client, but it should give a good idea of how future clients might interact with the Open CTP Server from a coding perspective.

Here is the link to the GitHub: https://github.com/justinfarrelldev/ctp-server-client-example

The main attraction here is, obviously, the source code - however, if you want to see the graphical app, I have provided Linux builds in the releases (for Debian-like systems). Additionally, you can build the project on Linux like so:

make deps
make linux
make run

You can also build for other platforms, however I have not tested it. I believe the deps will still be useful for MacOS, but they won't work on Windows. As a result of them needing to be built individually on these platforms, a list of the dependencies is available in the Readme so you can find and install them yourself.

I've had a lot of fun writing C code again! Let me know if you have any questions about how this works or how to use this information in your own clients in the future.
 
Last edited:
Back
Top Bottom