OpenSource, SDL2 based SimCity 2000 Clone

OpenSource, SDL2 based SimCity 2000 Clone

Postby JimmySnails » 03 May 2018, 06:27

Hi there,

I've started working on an, yet unnamed, open source, SDL2 based isometric engine for a simcity 2000 clone game two weeks ago. The goal is to create a free SC2K like City building simulator, with own sprites, so there won't be any copyright hassle. Right now i'm using a few sc2k sprites, but i'll draw my own when the basic engine is done.

So far, i can draw a X by X tilemap, access the tiles iso coordinates, draw different layers, zoom and reposition the camera. I'm currently working on terrain editing, which is not yet fully done but can be seen on my youtube channel.

Here is a video of my engine:

And the link to my github page:

The code still needs a lot of refactoring and i have quite the todolist (like framelimiting, overhaul of the sprite class and stuff).

I'm looking for a few devs who want to join me!

Posts: 4
Joined: 03 May 2018, 06:12

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby charlie » 04 May 2018, 12:36

Nice start. Looking forward to seeing your progress! I like that you are open source from the get-go. People write imperfect code and constantly refactor it. Everybody gets that. Some people create barriers that they never manage to hurdle before they make their projects open to the public.
Free Gamer - it's the dogz
Vexi - web UI platform
User avatar
Global Moderator
Posts: 2020
Joined: 02 Dec 2009, 11:56
Location: Manchester, UK

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby farrer » 04 May 2018, 12:52

Looks promising.

Maybe for the simulation - and to save you a lot of implementation time - you could use as base the micropolis code (micropolis is the Free/LIbre version of the original SimCity) [1], and then extend it to support the additions of sc2000 (if I do remember, water system, new kinds of power plants, city zones with variable density, terrain, connections with other cities, etc).

User avatar
Posts: 87
Joined: 24 Feb 2014, 21:00

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby c_xong » 04 May 2018, 14:22

There is another SC2K remake here:
How does yours compare to this project?
User avatar
Posts: 216
Joined: 06 Sep 2013, 04:33

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby JimmySnails » 04 May 2018, 19:43

Thank you for your comments!

I'm almost done with the terrain editing code. After that i'll do some refactoring, add some minor stuff like FPS locking. The next features will be "reading sprites (filenames) from a text file and map them to tile IDs" and afterwards reading / writing map files with height.
There's still a long way ahead until i'll get to actual game mechanics, but thanks for the link!

I'm a huge fan of the opensource scene, and after looking at other peoples code of isometric, tilebased engines i really thought i'd should go open source from the beginning. A lot of the stuff that's already done gave me quite a headache to figure out and i have reworked that stuff. I hope this will be useful for other other people too!

My game won't be a remake of SC2K but rather a clone. Right now i'm using the SC2K tiles as placeholder. I thought about adding an asset extractor tool late, when the games done... but i think it's way cooler to come up with own sprites (with the same art-style which i really love!).
If my project really succeeds, i'd like to have an own forum for it, where creative people can (easily) make there own tilesets. maybe even plugins? who knows.

I've already seen the opensc2k project, but it's based on JavaScript, while mine is based on C++. Besides that, their project focuses solely on SC2k (from savegames over to the assets) and right now they can only draw a SC2K city.
My project starts from scratch, focusing on the engine. When the engine is done (drawin, terrain editing, gui, ...) i can start implementing game mechanics. So there's more freedom to implement own stuff and ideas :)

I really love SC2K and played it a lot since i was a child, but it always lacked so many great features, like underground power lines, (a lot of) more buildings, different buildings for different centuries and stuff.

I'll post an update, when i'm done with the terrain editing feature!
Posts: 4
Joined: 03 May 2018, 06:12

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby JimmySnails » 06 May 2018, 18:24

I'm done with the "raise terrain" feature. It works the same as in SC2K :)

Implementation: I have an enum which represents the position of the elevated neighbor tile. In an std::map, the possible neighbor combinations are mapped to tile IDs. Then i'll recurse each neighbor of each tile that needs to be elevated and set the correct tile id (sprite). So the map-cells are kinda "self-aware" of their surroundings.

Right now it supports only one height level.
Next i'll implement a "read from file" function to map Tile IDs to file names and afterwards i'll refactor my Sprite code. Then i'll tend to terrain editing code again.

See for yourself:

Or download and compile the code :)

If you're interested in my project, feel free to drop me a message. Still looking for contributors ;)
Posts: 4
Joined: 03 May 2018, 06:12

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby flavio » 08 May 2018, 17:32

Hi! It is a cool beginning, please keep up the good work!
Posts: 46
Joined: 21 Mar 2014, 11:06
Location: Rome

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby JimmySnails » 21 May 2018, 08:40

A lot of time has passed and it's time for my first official release! V0.1 Tech Preview!

So far, i have done more than i have i have initially planned and some features turned out to be more work than originally anticipated :-)
I've set up travis ci (with a doxygen build deployed to gh pages)

Under the hood, i rewrote a lot of my code. Map Cells are now stored in a vector matrix. When a cell (tile) is elevated, it checks each surrounding tile and changes it's texture accordingly or elevates itself if if there's more then one height level difference.
With height levels taken into account, my plain screen to iso coordinates algorithm wasn't working anymore, so for every click each cell in the vectorMatrix is checked for pixel collision (with the mousecursor position) and for it's z-level, and the correct isoCoordinates are retrieved.

Tile ID - Filename mapping is done via a json file.
Settings are now read from a json file.

I've also started to document my code here: ... index.html

Next steps:
I'm not perfectly happy with the performance of the vectormatrix class and the overall RAM usage, i'll refactor that
It's time for a basic UI implementation!
Auto generate maps with height levels
Add water / rivers

Hope you like my project and are as eagerly excited as i am for the next release!

And as always, if you'd like to join my project, drop me a message! ;)
Posts: 4
Joined: 03 May 2018, 06:12

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby Imerion » 22 May 2018, 23:14

Nice to hear you are making progress with this! Looks promising!
Try my games! : My Games - Read my FOSS Games Blog! : Free Game News
Posts: 100
Joined: 09 Apr 2011, 19:37

Who is online

Users browsing this forum: No registered users and 1 guest