Code Monkey home page Code Monkey logo

modularskylines's Introduction

ModularSkylines

A modular API overhaul mod for Cities: Skylines

A rough outline of how the mod will work now:
  • Buildings which utilize this mod will have a single 'CoreAI' class which inherits from CommonBuildingAI, and basically has an override for each of the important methods for service and zoned buildings. Each said override contains a delegate which is invoked when that method is called.

  • 'Modules' are static classes made by me and/or any other modders flagged with an attribute. This attribute also denotes what kind of behavior the class pertains to (i.e. Light Residential, Police Station, Monument, etc). Any methods in said class which are flagged with another attribute and named correctly are found on load and a delegate created for them, along with various metadata such as if the method is 'default' (aka vanilla behavior converted into module form). A manager stores these delegates so that they only need found and created once.

  • Each CoreAI contains a Properties bag of sorts, and as the CoreAI instance is passed into the delegate, the delegate functions have access to a universal, extensible collection of variables to update/modify.

  • An asset which uses this mod will include an XML file along with it's .crp, and the XML will contain the configuration data for said asset. The configuration data will include options to toggle functionality (such as LightResidential, HeavyResidential, PoliceStation, FireStation, etc.). Further, most of these will have the ability to manually configure the values (number of Educated Workers, Students, etc) as well as a checkbox which toggles the auto-gen of the same values. If the auto-gen is turned on AND values are given for the same field, the modules determine the behavior (default will be they get added together). Asset makers may also specify a default type: this is the type which will be fabricated and saved (i.e. if this mod is removed, it will become the specified type), thus also meaning this mod will not break saves.

  • Which modules for a given Behavior are used at runtime is selected by the user, not the asset maker, thus while the asset maker may set his asset to use Light Residential Auto-Gen, how that auto-gen actually works will vary from user to user. Behaviors are configured by the user in the mod's options screen. Most modules can have one or more behaviors attatched to them. All default to vanilla modules which I am creating as part of this mod, and will behave about the same as vanilla AI methods would.

The following are a couple features I want to incorporate, but haven't started on yet:
  • Modders and users can create 'presets' of module configurations, which are saved in this mod's folder (for user configs) or in the mod folder (for modder's configs). This will save users the trouble of configuring modules, and allow other modders who release 'overhauls' to specify how their modules should ideally be configured.

  • When the game is saved, this mod will spawn an additional file; a .XML file with otherwise the same name, in the same folder as the save, and save any persistent custom data to it as needed. This will allow for customization without breaking saves, though swapping around module configurations may have weird results, as different modules will store different data.

  • How data is presented in-game will have it's own set of modules, and users will be able to select which module they prefer.

License

Original code contained within: Eclipse Public License (https://www.eclipse.org/legal/epl-v10.html)

Any and all code which originated from Colossal Order remains property of Colossal Order (obviously)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.