Skip to content

Development Plan

Bil Simser edited this page Mar 13, 2018 · 24 revisions

Plan for developing Micropolis for Unity

This page outlines the plan for development ideas for the main Micropolis codebase and lists features, resources, and changes that are in progress or planned.

First order of business is to get all C++ code from the original MicropolisCore rewritten in C# and hooked up in Unity (about 90% done) with the following core features:

  • Basic display (using Unity's TileMap engine, Unity Sprites, and the original graphics)
  • Ability to load a saved city (from the original "cities" folder)
  • Ability to select a saved city to load
  • Ability to load a scenario (Tokyo, Hamburg, Detroit, etc.)
  • Ability to select a scenario to load
  • Generate a random city
  • Save a city for later loading
  • Navigate around the view with the keyboard (pan)
  • Navigate around the view with the mouse (pan)
  • Zoom in and out of the map with the keyboard
  • Zoom in and out of the map with the mouse
  • Animated tiles (using the original animation tables from the game)
  • Sprites (Planes, trains, and automobiles and monsters oh my!)
  • Basic UI using Unity UI (text messages, debug, nothing fancy)
  • Loading of graphic tilesets (wild west, classic, etc.) from the original system
  • Select a graphic tileset to load from within the game

TODO

After the initial code is all brought over here's the plan for transforming the code into something more manageable. The original C++ code was good but a) lives in a single giant Micropolis class and b) has a lot of funky stuff that's C++ language specific (like defines, macros, pointers and memory allocation, etc.). So now with a working version of the code, it's time to get to work.

  • Review the C# code and fill in gaps from original TCL/Tk C code that were missing in the C++ code (or unexplained or changed)
  • Comment everything that makes sense and address any TODO comments from the original codebase
  • Create a playable user interface using the Unity UI controls and a graphical package (look at SimCity 4/5, City:Skylines, etc. for inspiration and Graphic River or someplace for a package we can adapt)
  • Add Pie menus for build tools (see https://www.youtube.com/watch?v=WzQdc2rAdZc) and hook build tools up to be functional (currently not functional in the core code)
  • Startup screen for choosing a scenario, loading old city, or generating city (similar to the Micropolis X11 splash window but done in Unity UI with the new graphics package)

At this point we'll have a 1.0 release (or a 0.1 release if you prefer) and be able to move onto fun stuff.

Short(ish) term plans

These are plans to refactor the original codebase (now in C#) into something easier and more .NET like. Not a lot of functional changes as the system should be, at this point, a functional game. This is more technical cleanup and paying down whatever technical debt that was incurred as a result of moving from C++ to C#. This work should be completed within 3 months.

  • Cleanup code, get rid of redundant or dead (unused) code. Document anything that needs it.
  • Setup a new website (probably using github pages?) to offer up documentation and a place for the installer to run from.
  • Build an installer using Squirrel so people can install and run the application with little effort (and keep it up to date).
  • Refactor the entire codebase, rename functions and variables (currently uses Camel case based on the original code, prefer to use Pascal case), and generally make it more aligned to C# rather than C++ naming standards.
  • Public/private fixups. Internal variables and public and most methods should be marked as private (too much of the system is public right now and not needed).
  • Splitting of the Micropolis "GOD" class. Current build uses a single class for everything, figure out what makes sense (for example put all traffic functions in a class called Traffic) and call everything from a Micropolis class that represents the core engine. Not completely "object oriented" but the best we can do with the simulator code we have.

Long term plan for Micropolis Unity

This is longer term that will take some time to fix (because of sweeping changes across the entire system). This work is expected to be in the 6-12 month time period.

  • Get rid of all those damn SHORTS/USHORTS! Other than reading the original city and scenario files we don't need to use this. At the time of the original codebase (1989) it was typical to conserve memory and use only data types you needed. If you never needed more than 256 items a byte would do, or a short, etc. This is 2018 and while we don't really need to worry at a byte level savings like we did in 1989, just change everything to an int/Int32 (and maybe a long/Int64 if really needed for those big numbers like funds) and get rid of all the casts in the code. They're just plain ugly and lead to a lot of really ugly code right now.
  • Use the right data types. Similar to the removal of short/ushort variables and just making everything an int, there are many enums that were created (to replace #define values in the original code). Where these are used, we have to keep casting them to ints. Instead replace calls using these types into using the original enum types. Makes for better readability of the code and gets rid of casting from enums to ints back to enums.
  • Internationalization (look for volunteers to do translations) and externalizing of all strings into files that can be loaded at runtime (JSON or text)
  • Extended graphics packs (go beyond the original set offered and let people create new tilesets including different resolutions)
  • Documentation and ideas (full documentation on building, modifying, and using the system) based on the following:
  • New additional building types that can affect the simulator like schools (elementary, high school, college, universities)
  • Additional variants to existing structures (different types of police/fire departments to provide wider services for example)
  • Research trees and dependencies (to unlock other new building types and city capabilities)
  • New disaster types (zombie attacks, meteor crash, etc.)

Crazy (but cool?) ideas

Maybe cool, maybe crazy, stuff to think about and build on that may affect core gameplay but might be really awesome to have. Long term stuff here. Or not.

  • Multiplayer (sharing cities, being able to build with friends, etc.). Still client based and not a web server, but using some kind of networking layer (using Unity Networking, Photon, or something else).
  • Allow players to use the bulldozer tool to drive around the map, crushing things in your path!
  • Terrain editor (like the original DOS version but better!) to create your own custom landscapes.
  • Support modding community with some kind of plugin system to let them do things with the system (Cities Skylines does a great job with this)
  • Custom Sound packages (might be combined with tilesets to create new theme packages)
  • Programmable interface (via C#) to build your own bots that can create, populate, run, or destroy cities (like the old 'C' robots where they could battle each other). Best bot wins.
  • Public scoreboards and achievements for best cities, fastest builds, longest runs, etc. (need a free service to tie into)