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:
https://youtu.be/SRURHPl1hJc

And the link to my github page:
https://github.com/JimmySnails/IsometricEngine

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!

Regards,
Chris
JimmySnails
 
Posts: 5
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
charlie
Global Moderator
 
Posts: 2033
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).


[1] https://github.com/SimHacker/micropolis
User avatar
farrer
 
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: https://github.com/rage8885/OpenSC2K
How does yours compare to this project?
User avatar
c_xong
 
Posts: 233
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!
JimmySnails
 
Posts: 5
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:
https://youtu.be/tjfcg3IRlE0

Or download and compile the code :)
https://github.com/JimmySnails/IsometricEngine/

If you're interested in my project, feel free to drop me a message. Still looking for contributors ;)
JimmySnails
 
Posts: 5
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!
flavio
 
Posts: 53
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!

https://youtu.be/wuPgGq2RQ_8

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:
https://jimmysnails.github.io/Isometric ... 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! ;)
JimmySnails
 
Posts: 5
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
Imerion
 
Posts: 100
Joined: 09 Apr 2011, 19:37

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby SecureUvula » 24 May 2018, 19:36

Looking good. The readme on Github mentions both SDL 2 and SDL 1.2. I'm guessing you're using SDL2, then?

I'd like to make a Streets of SimCity clone someday, if your project ends up being compatible with the original SimCity 2000 files I might peek at your code to see how to load them. (Streets let you drive a car around SC2k cities)
Itch: https://activated-onion.itch.io/

"Not only does he do it for free, he doesn't do it at all."
User avatar
SecureUvula
 
Posts: 34
Joined: 22 May 2018, 03:26

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby JimmySnails » 25 May 2018, 06:49

The readme on Github mentions both SDL 2 and SDL 1.2. I'm guessing you're using SDL2, then?


ooh, i don't know how that got there. You're right, i'm using SDL2. I've corrected it, thanks!

Loading the original SC2K files will be a feature, but it'll take quite a while until i tackle that problem. I might write an extractor for the SC2K files, together with a json file to map the extracted files to internal tileIDs. that's not too hard and there are a lot of examples out there. If you're interested in that topic, you could join my discord and i could point you in the right direction, maybe write the extractor together?

I've reworked quite a lot of the code and cut startup time for 128x128 tiles (in Debug configuration, which is mich slower) from 5 seconds to ~500ms.
Right now i'm working on the user interface and i've come up with an interesting concept how to implement that.
JimmySnails
 
Posts: 5
Joined: 03 May 2018, 06:12

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby Wuzzy » 15 Jun 2018, 14:14

TBH, I didn't really like SimCity 2000, I liked SimCity 3000 much more, especially because there were many possible slopes. SC2K was too simplistic IMO, it lacks a bit of depth. Maybe I'm biased because SC3K was the first of the SimCity games I've ever played and I just didn't play SC2K very often. I think SC3K is still a great game, even with SC4 in mind.

The graphics of SC2K are also seriously outdated and low-res in my opinion, I would not clone that either, not even the style.

On the other hand, a SC3K clone would be probably too much work. If you manage to pull of a SC2K clone, but with updated, modern graphics and a proper look and feel and sounds, it might become a nice little game anyway.

Anyway, I wish you good luck with your project! :-)
Got too many bitcoins? I gladly take them: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH :-)
User avatar
Wuzzy
 
Posts: 591
Joined: 28 May 2012, 23:13

Re: OpenSource, SDL2 based SimCity 2000 Clone

Postby SecureUvula » 15 Jun 2018, 17:08

I haven't played 3000, but SC4 looks much more complex than SC2k. In 2k, for instance, buildings can only be built on flat ground. Easy. In SC4 you have to judge how flat the ground is, and it flattens a bit (I think) when you build things, and the terraforming is so complicated.

I may be biased because driving around my SC2k cities shooting up other cars was fun.
Itch: https://activated-onion.itch.io/

"Not only does he do it for free, he doesn't do it at all."
User avatar
SecureUvula
 
Posts: 34
Joined: 22 May 2018, 03:26

Who is online

Users browsing this forum: No registered users and 0 guests