MicroCity - City simulation in your pocket


(Josh Goebel) #35

Build a “too many roads” errors into the game and stop someone from building more road if they get close. I’d wager for 99% of cases (lots of straight roads and long stretches of uninterrupted land) you’d be just fine with no issue at all. You could obviously do you own tests to confirm this or not.


(David Inwood) #36

This is the first time I’ve played an Arduboy game for multiple hours. :grinning: The save feature is really great in this one.
I’ve got a small city going right now that is perfectly stable. I’ve just been carrying the device around with me and hitting the B button every 66 seconds or so to get past the financial data that pops up every year. It’s nice to be able to just let a city go like that.


(Pedro) #37

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!


(Kevin) #38

@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.


(James Howard) #39

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:


(Scott) #40

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.


(James Howard) #41

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?


#42

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.


(Scott) #43

How is this better than using flashlight mode?


#44

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


(Scott) #45

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


(Kevin) #46

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!


(James Howard) #47

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


(Gavin Atkin) #48

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?


(Pharap) #49

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.


(Gavin Atkin) #50

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


(James Howard) #51

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


#52

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.


(James Howard) #53

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!


(James Howard) #56

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.