MicroCity - City simulation in your pocket

Great game! That’s currently the permanent game of one of my 2 arduboys. Looking forward for the fire to destroy my too rich city!


@jhhoward you might want to edit your post and warn people that they may need to use flashlight mode to reprogram their device as it seems like this game hits ye’ olde magic number glitch.

I’ve updated the top post for anyone who gets stuck unable to flash a new game. Do you know what causes this glitch and how I might be able to work around it?

I have an update in the works which includes fire simulation but it isn’t quite ready to release yet. I just need to find some time to finish off a version 1.1 :slight_smile:


The work around is flashlight mode. There is a fixed location in RAM used for a “magic key” that tells the bootloader to enter command mode after a reset, to allow uploading a new sketch. The problem has to do with this location also being used by the sketch, and the key being overwritten before the reset occurs.

The next release of the Arduboy boards package will include a fix that will all but eliminate the problem, without requiring flashlight mode.

Hmm do you think it might be possible to specify a .bss section that is at the address of where the magic key lives so that the compiler avoids allocating it to something else?

Not reliably @dxb tried, see here

Untill the new board package is out, you could add the new wiring.h to your sketch folder to add the bootloader and reset button features. Pressing LEFT+UP+A+B for 2 seconds will put Arduboy in bootloader mode.

1 Like

How is this better than using flashlight mode?

You don’t have to turn Arduboy off and on again to use it.

But the timing becomes tricky because the uploader isn’t doing the reset.

Further discussion of boards files should move to it’s own thread.

Thanks @jhhoward and @MLXXXp

Working on getting this game featured on the front page next week!


That’s awesome! I’ll have to get that version 1.1 uploaded soon then! :smiley:


Looks cool! Haven’t gotten a chance to try it yet, but I did have a question as I was browsing the code.
"typedef struct
uint16_t year; // Starts at 1900
uint8_t month;
uint8_t simulationStep;

int32_t money;

// 2 bits per tile : road and power line
uint8_t connectionMap[MAP_WIDTH * MAP_HEIGHT / 4];

uint8_t terrainType;

Building buildings[MAX_BUILDINGS];

uint8_t taxRate;

uint16_t residentialPopulation;
uint16_t industrialPopulation;
uint16_t commercialPopulation;

int32_t taxesCollected;
uint8_t policeBudget;
uint8_t fireBudget;
uint16_t roadBudget;

uint16_t timeSinceLastDisaster;

} GameState;"

I haven’t seen a struct being used this way. What is the benefit of declaring a structure type like this?

Do you mean the typedef thing?

If so, it’s a C thing.
C requires the keyword struct in front of all structs unless you use typdef, in which case struct isn’t needed.

In C++ and Arduino usage it’s pretty pointless.

Interesting, I hadn’t seen the syntax written that way so I was wondering if it had any efficiency bonus. Thank you!

1 Like

Ah yes just a habit I have from writing things in C. No efficiency bonus or anything, purely old fashioned syntax!


Absolutely amazing.
Disasters? DO NOT INCLUDE THEM. I was tumbled all over the place by that stupid Dr. Vu. Now you have club wars. Great.
Will be as big a hit here as it is on Apple mobile devices.

The only disaster I am currently planning to include is fire outbreaks. If there is a fire department nearby then it will be put out automatically (this is how the original SimCity worked). It makes there an actual reason to build fire stations!


I have just released version 1.1 of MicroCity on Github

New features:

  • Added fire system with random outbreaks. Nearby fire departments will put out fires.
  • New tiles for water edges and rubble from bulldozer / destroyed buildings
  • Auto-budget system which skips the end of year budget screen when there is a positive cash flow and positive funds (on by default but can be disabled)
  • Tweaked population growth algorithm which makes the game more challenging
  • Greater capacity for placing buildings: up to 30% more

Note that save games are not compatible with version 1.0 so if you update you won’t be able to load your old city.


Thank you again for microcity! Everything seems to work great, i do have a question though. When I start my city, i don’t see buildings until around the 5th or 6th year and even then it’s only one. after 20 or so years i might have half a residential filled. I’m assuming this might be in part to time being rather fast. I’ts also likely i suck at building. Is the building ratio similar to the original simcity?

@HercTNT @CDR_Xavier
Version 1.1 is a bit more challenging so here are some tips for building a good city:

  • Buildings need to be connected to the power station and have roads built next to them to function
  • The balance should be roughly 50% residential zones, 25% commercial zones and 25% industrial zones
  • Industrial zones and power stations generate pollution so avoid placing your residential zones too close to these areas.
  • Lowering the tax rate in the budget will encourage population growth so can be a good idea when first starting your city. Once you have a stable population, raise the taxes again.
  • Building parks has a small positive influence on nearby residential areas
  • Crime will increase as your city grows. High crime will discourage growth. Build police departments to reduce crime in the surrounding area, but don’t build too many as it will cost too much in the yearly budget!
  • Occasionally buildings will catch fire. Nearby fire departments will help put the fire out but if you haven’t built any in the area then the fire will spread.

Hope that helps, have fun!