Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2017-06-14 18:14:45

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

µCity - 1.0

Well, after a year and a half of suffering, I've finally released version 1.0 of µCity!

https://github.com/AntonioND/ucity

It is a clone of simcity for the GBC (GB not supported).

Full source code and documentation available.

I know that the graphics and music can be improved a lot, but hey, I'm just a one man team...

Offline

 

#2 2017-06-14 21:06:18

DonaldHays
Member
From: Seattle
Registered: 2016-08-01
Posts: 36
Website

Re: µCity - 1.0

Woah.

This is really, really impressive.

I've only played a few minutes so far. Enough to get a power plant and some zones, connected by roads and power lines. Also some trees caught fire. Not my fault. Thankfully the fire was nowhere near my town. I'm really impressed by just how completely this appears to implement classic SimCity on the Game Boy.

I love all the documentation that exists with the source code. The docs folder helps guide exploration through the code.

So the simulation step can take several seconds, right? Presumably that's with the Game Boy Color in double-speed CPU mode, right? Would you say CPU time was the resource you spent the most time wrestling with, or did you have a tough time fitting everything in RAM/ROM? How about ROM Bank 0? Were you able to fit all your code in that bank, reserving the other banks for data? Or did you have to put some code in other banks?

Offline

 

#3 2017-06-15 07:24:19

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: µCity - 1.0

Thanks. smile

Yeah, fires happen randomly, the chances of that happening are reduced the more fire stations you build, up to a limit. You can disable disasters in the options menu, by the way.

I've tried to document most things. There are some simple details I haven't bothered to explain (the comments in the code should be enough) but most things should be documented from a high level point of view, enough to be able to know what you are dealing with.

Steps are quite slow, and they get slower as your city grows. The CPU is in double speed mode and I've done some optimizations to try to reduce the time it takes, but there's only so much I can do, the CPU runs at 2MHz! tongue You can speed up a bit the simulation by disabling animations, music and disasters.

I tried to optimize everything while developing it, but I only bothered to actually do optimizations when something was specially slow. WRAM has been a problem from the start. I can't save partial results of the simulations (not enough RAM) so I have to recalculate everything at every step, which is on of the reasons why this is slow. I only keep the traffic simulation results, because that's specially slow to calculate (https://github.com/AntonioND/ucity/blob … ganisation) and it is needed for the pollution simulation. ROM isn't usually a problem in GB games, you can have ROMs as big as 4MB (even 8MB). This game is 128 KB in size, and it's not completely full, but ROMs come in sizes that are power of two, so... Fun fact: version 0.5 is bigger than version 1.0 because I compressed the scenarios after 0.5, saving some memory.

The code doesn't fit in ROM0, impossible. I don't know the exact number, but I would say more than half of the game size is due to code (so more than 64KB). There's no way to fit that in a 16KB bank. I just have a few helpers to do cross-bank calls, and try to split everything so that they are only used when needed. For example, each simulation module is in a different bank. When I start the simulation of the traffic, I use a cross-bank call. Inside the simulation, I don't need them because everything is located in the same ROM bank.

Offline

 

#4 2017-06-15 16:49:19

Jonas
Member
From: Frankfurt, Germany
Registered: 2016-06-06
Posts: 112
Website

Re: µCity - 1.0

Thumbs up, that looks really impressive! big_smile

I didn't have the time to play it longer yet, but it's obvious that you put a lot of work into that.

Did you use the original code of SimCity for that or did you re-invent the whole game from scratch?

Offline

 

#5 2017-06-15 17:19:18

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: µCity - 1.0

I guess you are talking about this, right? https://github.com/SimHacker/micropolis

I took a look at it for inspiration, but I couldn't implement pretty much anything the same way because of lack of RAM, or simply because I didn't like how it was done there.

However, I tried to stick to whatever was available in SimCity and then added some elements of SimCity 2000 that were easy to implement (like variable sized residential, commercial and industrial zones, some kinds of buildings, etc). It's like a SimCity 1.5.

Offline

 

#6 2017-08-31 02:40:04

Tag365
Member
Registered: 2016-06-01
Posts: 41

Re: µCity - 1.0

It looks like the residential interest is glitched so that it never causes any residential buildings to actually be created in a new city. I guess people want to live in commercial and industry areas. Can you fix this??

Oops, I figured out that you need to put services such as fire departments, police, schools, and hospitals to make people take residence in the residential buildings. Now the roads have little dots on them as well.

Last edited by Tag365 (2017-08-31 03:06:41)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson