MicroCity - City simulation in your pocket

(James Howard) #1

MicroCity is a city simulation game inspired by SimCity


I put together this game after receiving an Arduboy last month for Christmas :slight_smile:

The game features

  • A whopping 48x48 tile map to build on!
  • Three base terrain types: river, lake and island
  • Save your city to EEPROM to continue playing later
  • 8 different building types
  • Fire disasters

Source and .arduboy / HEX binaries are available on Github. Go here for the latest release:

NOTE: If you want to flash another game after playing MicroCity, you will need to put your Arduboy into flashlight mode by holding the up button when switching on.

EEPROM Reader .. now should be called EEPROM Updater!
Suggest to me some games
What’s the best Arduboy game?
(Chamekan) #2

I downloaded and installed it.
You are great!
I will write impressions later.

(Boti Kis) #3

OMG it has happened. amazing well done! testing it right now!

(Simon) #4

This looks fantastic. Well done!

(Boti Kis) #5

After a certain progress I can’t place anymore buildings/areas.
Maybe hit an index limit?
The map isn’t full yet. i guess at somewhat 75%. All areas are maxed.

(Erwin) #6


PS: I added it to http://arduboy.ried.cl :smiley:

(Simon) #7

Unfortunately the game doesn’t seem to work in the emulator.

(Erwin) #8

It is not the emulator, github is not serving the files correctly. It was down during the afternoon too.

(Felipe Manga) #9

This link worked for me.

(Simon) #10



The top link is from the repository . .the second the one @FManga posted. They are quite different.

(Felipe Manga) #11

Do you mean the hex files are different, or the links? The one I posted points to @jhhoward’s original release. The second points to a copy in eried’s repo.

Right now, the repo link gives me an “Internal Server Error”. Not sure exactly which server is acting up.

(Simon) #12

Sorry I meant the links. I assume Erwin is auto generating his links somehow …

(Erwin) #13

The github gods fixed the issue already

(James Howard) #14

Thanks for the feedback!

After a certain progress I can’t place anymore buildings/areas.
Maybe hit an index limit?
The map isn’t full yet. i guess at somewhat 75%. All areas are maxed.

If you have enough funds but aren’t able to place another building then you have hit the memory limit. Currently there is memory allocated for up to 100 buildings in the city and each building uses 3 bytes. I had a look at current memory and EEPROM usage and it looks like it should be possible to increase this to about 130-135. I’d have to do some testing to check that it would be stable but I can tweak this for the next release. If you want to try yourself, MAX_BUILDINGS is in Defines.h which controls this.

(Boti Kis) #15

Not bad fitting all that info in 3 bytes :wink: but i can see the issue.

It would be interesting to so the memory chart of the game. If we have 1.5k and 0.3k is used for the buildings, how ist the rest distributed. Maybe we can save some more here.

Alright, thank you! :slight_smile:


Simply amazing. Thank you!

(Kevin) #17

You fulfilled the prophecy!

(James Howard) #18

Haha I saw that other thread recently as I searched the forums to see if someone else had already made a SimCity clone!

In terms of memory layout, I wanted to make sure that the city and general state could be saved in EEPROM, which limits things to 1K. If you look at the code, there is a struct called ‘GameState’ which is basically copied to / from EEPROM when saving / loading. If really squishing things, a few of those variables could possibly be recalculated on load instead of saving out (budget and population counters). Most of the memory is allocated to two main things:

  • A map of roads and powerlines : this is a 2-bit 48x48 array (576 bytes)
  • The list of buildings, currenty 100 buildings @ 3 bytes each (300 bytes)

The building structure actually still has 2 bits that are unused. I was thinking about using them for an ‘on fire’ state if I get round to coding in disasters.

(Felipe Manga) #19

1- Registers / IO / Reserved (0x00-0xFF)
2- __data_start to __data_end. Can be removed by initializing global variables in setup? (0x100-0x13F)
VisibleTileCache (between 2 and 3, unmarked)
3- Globals:

  • CachedScrollX/Y + 0x55F-0x576 small global variables, USB stuff
  • State 899b

4- Arduboy::sBuffer
5- a few more globals (Arduboy instance, timer0), stack

I think the game is great already. If any improvements are to be made, it would probably be easier if they took up flash space (there’s plenty of that, especially if you switch Arduboy2 for Arduboy2Base since the built-in font isn’t used) instead of sRAM.

(Boti Kis) #20

Wow, super interesting! I understand what you are doing. Maybe we can come up with a simple compression for this. *just mind-farting*