-
-
Notifications
You must be signed in to change notification settings - Fork 94
Developer Resources
Windows: Visual Studio 2017 & Cities: Skylines installed, be running Windows 10 and have developer mode enabled. Linux/MacOS: msbuild (e.g. mono-msbuild) for compilation and Powershell (pwsh) to run the scripts.
The mod can manually installed using the built in scripts. The following steps will guide you though this. This script will automatically pull in the required files (after specifying a folder), build the mod and then install it.
- Open the
scripts
folder. - Run the following command in powershell or bash (if pwsh is installed)
.\build.ps1 -Update -Build -Install
. This will copy dlls from your game, build the mod and then install it. - When you run this script, it will ask you for your game installation folder.
- Run Cities: Skylines and enable the mod.
- Windows:
C:\Program Files\Steam
- Linux:
~/.steam/steam/
- MacOS:
~/Library/Application Support/Steam/
- Windows:
<SteamDirectory>\SteamApps\common\Cities_Skylines\
- Linux/MacOS:
<SteamDirectory>/steamapps/common/Cities_Skylines/
- Windows:
%LOCALAPPDATA%\Colossal Order\Cities_Skylines
- Linux:
~/.local/share/Colossal Order/Cities_Skylines
- MacOS:
~/Library/Application Support/Colossal Order/Cities_Skylines
- Windows:
<CitiesDataFolder>\Addons\Mods
- Linux/MacOS:
<CitiesDataFolder>/Addons/Mods
- Windows:
<CitiesDataFolder>\multiplayer-logs\log-current.txt
- Linux/MacOS:
<CitiesDataFolder>/multiplayer-logs/log-current.txt
- Windows:
<GameInstallationDirectory>\Cities_Data\output_log.txt
- Linux:
~/.config/unity3d/Colossal Order/Cities: Skylines/Player.log
- MacOS:
~/Library/Logs/Unity/Player.log
If you have access to the main project, create a new branch for your feature, work on it and then create a pull request when complete (or a draft pull request if still in development). Before a pull request can be merged, it must be approved, builds must run and it must be based off the latest code change to avoid conflicts.
If you don't have access to the main project, fork this project, make your changes and then create a pull request like above.
- Create a new class under the
CSM.Commands
namespace (src/Commands/Data
folder) with a suffux ofCommand
(see other commands as an example). - Adjust the class to extend
CommandBase
. Implement the class level attribute of[ProtoContract]
. - Create your getters and setters, these should all be public and contain public level get and set, e.g.
public Vector3 Position { get; set; }
. - Annotate your getters and setters using
[ProtoMember(<number>)]
. Start at 1 and work your way up. - Make sure you document your getters/setters and class.
- Create a new class under the
CSM.Commands.Handler
namespace (src/Commands/Handler
folder) with a suffix ofHandler
(see other handlers as an example). - Adjust this class to extend
CommandHandler<COMMAND>
where COMMAND is your newly created command. - Override other methods and implement logic.
This mod uses the client-server model. A user will setup their game as a server and transmit information like currency, roads, needs etc. to all connected clients. Clients will connect to the server and retrieve currency, roads, needs etc. from the server, updating the client UI.
This is all done by running a UDP server alongside Cities Skylines implemented by the LiteNetLib library.
Below is information that I have jotted down about the flow of this mod.
Server:
- Open a level (new or existing).
- "Show Multiplayer Menu" --> "Host Game". User enters port and password (optional).
- Server is setup and message process queue is started. (
Networking/Server.cs
)
Message Queue:
- Parse incoming messages and update game accordingly.
- On extension changes, send a packet to all clients.
Client:
- User launches game, enabled mod.
- Click "Join Game".
- Enter game IP address / port.
- Connect the client using
Networking/Client.cs
. - Client connects to server (try) and performs setup functions (check mods/DLCs are the same etc.)
- Download and load the map
- On all events, update the server.
- On incoming message, update client UI.
- Connect the client using
Cities Skylines uses version 1.36 of the steamworks sdk (Feb 9, 2016), you can find a download here.