Google has a Code Search, something seemingly separate from Google Code. Code Search makes locating aspects of submitted open source code, such as variables, very easy. For class we looked at the code of Micropolis, a re-release of Sim City 2000.
Micropolis' message.cpp file includes a checkGrowth() function. Here, the game determines whether the 'city' has grown into a new type and updates the player if so. Once the player starts building, the 'city' is apparently labeled a village. No update is sent for this. When the place becomes a town or metropolis (or city, capital, or megalopolis), however, the player receives a message.
There is also a doMakeSound() function. It dispatches car honking, siren, monster and other sounds when appropriate. In the case of a nuclear meltdown, for instance, a high and low pitch explosion is pronounced, followed by a siren.
One could make a poem out of Metropolis' code.
It suddenly appears, a cloud hovering over synthetic commotion
Capital
Yes! Her town turned city has matured once more
But it is late. The dining hall will close soon
She hops from bed to doorway, resting place of pink slippers
One foot in - there's a roar
She rushes to the bed
She stares...
A monster has appeared
...
It is ravaging the city
...
The slipper slyly escapes her foot as she takes hold of the mouse
Soon, she thinks only of that synthetic commotion
No comments:
Post a Comment