Cities: Skylines Modding Documentation

website·Indexed 30 days ago

https://city-skylines-modding.github.io/docs

Comprehensive guides and standards for modding Cities: Skylines. Includes C# code standards, Git workflow guides, development environment setup, and instructions for creating and publishing mods to the Steam Workshop.

Tokens
8.1K
Snippets
40
Records
70
Agent score
74%

What's inside Cities: Skylines Modding

  1. Apply game architecture tips for Cities: Skylines modding

    To effectively mod Cities: Skylines, developers should focus on the following architectural areas:

    1. Unity Fundamentals: Understand GameObjects, Components, and Scenes.
    2. Modularity: Identify the interfaces used by systems like traffic, economy, and simulation to ensure seamless integration.
    3. C# Scripting: Use C# to interact with the Unity API for gameplay logic.
    4. Event System: Utilize the game's event system to trigger mod actions based on in-game events (e.g., simulation ticks or building construction).
    5. Performance: Optimize code to prevent hardware strain, especially when multiple mods are active simultaneously.
  2. Understand the Cities: Skylines Game Interface

    The game interface consists of several key areas for city management:

    • Areas: Toggle between area and game views.
    • Milestones: View requirements for the next city level and navigate progress.
    • Game Time: Displays elapsed time and current date; allows adjustment of game speed (default: 1 week = 1 minute).
    • City Name: Displays the city name. Clicking it reveals detailed statistics including population (by age group), house/worker/tourist counts, zone levels, land value, attractiveness, and active policies.
    • Advisor: Toggles a panel providing tips and information about active tools/features.
    • Zone Demands: Three columns indicating demand for Residential (green), Commercial (blue), and Industrial (orange) zones.
    • Balance: Displays available funds and weekly budget balance.
    • Bulldozer: A mode for demolishing roads, buildings, and infrastructure. When active, other tools are disabled.
    • Free Camera Mode: Allows unrestricted view control and hides the UI. Press ESC to exit.
    • Information Views: Map-based views for tracking service coverage, resources, and predicting city needs.
    • Chirper: An in-game social network reflecting citizen moods, opinions, and city events.
    • Pause Menu: Provides options to Save, Load, access Settings (Graphics, Audio, Game), and Quit.
  3. Follow the City Skylines Mods contribution guidelines

    When contributing code to the project, adhere to the following quality and architectural standards:

    • Maintain consistency with the project's architecture and coding style.
    • Avoid adding unnecessary dependencies, duplicating existing code, or introducing security vulnerabilities.
    • Ensure code is properly documented, commented, and that relevant documentation is updated.
    • Avoid over-engineering (e.g., avoid overly complex, generic, opinionated, coupled, abstracted, or 'clever' code).
    • Verify that changes do not break existing functionality by running available tests.
  4. Understand the technical infrastructure of Cities: Skylines

    Cities: Skylines is developed using the Unity Engine and is based on the .NET framework utilizing the Mono framework. Modding is primarily done via C# scripting. The engine also supports plugins through a C++ DLL interface, allowing developers to extend core game systems.
  5. Understand the types of Cities: Skylines mods

    There are two primary categories of mods for Cities: Skylines:

    1. DLL Mods: Written in C# and compiled into DLL files. These are loaded at runtime and can modify game behavior, add new features, fix bugs, or change game mechanics.
    2. Asset Mods: Created by modifying or adding game assets. These are used to add or change 3D models, textures, sounds, and other visual or auditory content.
  6. Follow Wiki content formatting guidelines

    When creating Wiki content, adhere to the following standards:

    • Use proper headings to structure content.
    • Start with a brief introduction to the topic.
    • Use numbered lists for step-by-step instructions.
    • Use code blocks with appropriate syntax highlighting for snippets.
    • Include links to relevant resources or guides.
    • Use images or diagrams where they enhance the content.
  7. Handle null values and safe member access

    Prevent runtime errors by checking for null values before accessing properties or methods. For concise safe access to members of an object that may be null, use the null-conditional operator (?.).
    if (customer != null) {
        var fullName = customer.FullName;
    }
    
    // Alternative using null-conditional operator
    var fullName = customer?.FullName;
  8. Understand the City Skylines Pull Request review process

    Pull requests submitted to City Skylines repositories undergo a structured review process before being merged:

    1. Reviewers examine changes and provide feedback.
    2. Reviewers may request specific changes to the PR.
    3. After updates are made, the PR is re-reviewed.
    4. Upon approval, the PR is merged into the repository.
  9. Use C# control flow structures

    Choose the appropriate loop or conditional based on the scenario:

    • for loop: Use when the number of iterations is known or when iterating over a range.
    • foreach loop: Use to iterate over a collection when the number of iterations is not known.
    • while loop: Use to iterate until a specific condition is met.
    • switch statement: Use to select one of several code blocks when handling multiple cases.
    for (int i = 0; i < 10; i++) { /* ... */ }
    
    foreach (var item in items) { /* ... */ }
    
    while (condition) { /* ... */ }
    
    switch (day) {
        case DayOfWeek.Monday:
            break;
        default:
            break;
    }
  10. Prepare your environment for City Skylines Wiki contributions

    Before contributing to the City Skylines Wiki repository, ensure you have the following tools and accounts installed and configured:

    • A GitHub account
    • Git installed locally
    • Node.js installed
    • pnpm installed
    • A code editor (e.g., Visual Studio Code or Atom)
    • Basic knowledge of Markdown syntax and familiarity with the wiki content.
  11. Contribute a new page or category to the Wiki

    To add a new element to the Wiki, follow this workflow:

    1. Clone the repository to your local machine.
    2. Navigate to the docs folder.
    3. For new categories: Create a new folder named after the category.
    4. For new pages: Create a markdown file within the appropriate category folder.
    5. Populate the markdown file with content.
    6. Commit and push changes to the repository.
    7. Open a pull request to merge changes into the main branch.