• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Finally, you can manage your Google Docs, uploads, and email attachments (plus Dropbox and Slack files) in one convenient place. Claim a free account, and in less than 2 minutes, Dokkio (from the makers of PBworks) can automatically organize your content for you.


PW15 Space Colony Game

Page history last edited by Adrian Cline 8 years, 9 months ago

Don't Take My Stuff (One Way Trip and A Little Help variations listed at bottom)


This game is on an isometric grid representing a natural landscape. 

See: http://www.christophernight.net/stuff/terrain-proto-screenshot.png 

World design: a page on world design


The landscape will not be editable by the player, but buildings will be placed on levelling platforms so it's not a big deal if a tile is slightly slanted. [TODO: draw pic]


The title screen prompts you to enter a name to use. It also shows a list of all the names you've used so far. When you type a new name, it saves it in a file along with a random string that will be your password each time you choose this name. (basically, it's a cookie) From now on, that name can only be used from that client since no one else will know the password. If we ask people to provide a password and "register an account" for some reason people get nervous about that. This will be as casual as entering your name at the beginning of a zelda game. 


If it's your first time you are zipped to a random spot on a planet. A hovering lander appears at the top of the screen and lowers a small 1x1x1 cubic building using a sky crane. The lander then flies a few tiles away and bursts into flames as it crashes into the ground. After a few seconds, a player sprite steps out of this building. This is the sprite that the player controls with the arrow keys. 


This is a real-time-strategy where the controls are implemented through actions of this sprite, rather than "clicking from the sky". The tile you are standing on will have a highlight on it. If you are about to build a building, the footprint area of the building will appear instead, e.g. a 3x3 highlight with the player centered in it. 


This world is common among all players and is generated on the server. That means you can walk far enough in one direction and find other bases of other players. (You will need to do so as part of the game)


There are a handful of resource types. Each building costs resources to build. Some will generates resources or magnifies the generation stream of a particular resource. Some of the buildings you may not even know what sort of resources they will generate until after you build them. For example, building a mine/drill can either generate iron or copper. Maybe both. You don't really know until you build it. There may be heuristics to determine which one it will be. e.g. building a mine at higher elevation will generate one mineral while lower elevation may produce another, etc. 


Roads and Radii

Each building you create emits a property radius that's 3 tiles deep. If you've played Starcraft, this is like non-creepy creep. This will be illustrated with a line outlining your base. (like in Civ III+). You can only build buildings and roads on your property. Roads do not extend this creep. 

Buildings must touch a road in order to be built. When it is built, it automatically surrounds itself with roads along the entire edge. The implication is that no two buildings can be butted up against each other. This prevents people from blocking things in. Roads around buildings are considered "essential". You can freely demolish non-essential roads. You cannot partition your base by creating a wing and then demolishing the road and buildings connecting the two to it create two bases. The explanation will be that your HQ produces power and the roads also carry power lines. 


You cannot directly interact with other player sprites. You can only interact with their buildings. 


Status from the server is polled every few seconds. Based on the game time of the last time you polled, the delta in each resource is added to your resources. 


All building commands are sent as a polite request to the server. The client will go ahead and render the changes you requested, but the changes can be rejected by the server (stretch goal). This may result in a building suddenly disappearing after a few seconds if somehow you were able to send a build command and by the time the server received the command you didn't have enough resources. This would only happen if you are building dangerously close to someone else's base and both of you tried to build in the same spot OR somehow your resources got depleted on the server but not the client and you managed to request a building without having the money for it. Both of these should be extremely rare edge cases. If this is too much, then no changes are rendered by the client. Only the changes that are echoed back by the status polling. Although this lag might be dizzying. 



  • food
  • water
  • stone
  • aluminum
  • iron
  • silicon
  • copper


You cannot see other players moving around. Just their buildings.


You cannot build more than 200 buildings and 500 roads.



The object of the game is to steal crystals from the native aliens and keep them long enough to analyze and determine their secrets. The secrets you get from analyzing a crystal are new turrets or abilities, and maybe some plot information. You start the game knowing the location of one crystal. (In the simplest version, it doesn't even appear on the map. You just "know" it in an abstract sense.) You collect some resources and build your base, which can just be a few turrets protecting your HQ building. When you're ready for the first wave, click a button marked "steal crystal". A page appears saying "You just barely made it back to base with the crystal, followed closely by a horde of aliens". You have to fend them off for 5 minutes while your computer at your HQ is analyzing the crystal. If the aliens get your HQ's health down to 0 before the time is up, that means they break into the lab, take the crystal back, and leave. If not, then you get a page saying "You finished analyzing the crystal and unlocked its secrets". If you failed, then you can continue to build up your base and try again whenever you're ready.


In order to launch such a heist mission, you must build a building that produces "seeker bots". Walking up to this building will open a "start mission" menu that makes the bots scurry out of the building and off the edge of the map. And then return with the crystal in a few minutes. 

After the first time, you can continue to build up your base and collect resources, but in order to summon the next wave (which lets you unlock more items and advance the plot), you first need to learn the location of another crystal to steal. To do this, you have to infiltrate another player's base. You send your player character seeker bots to another player's HQ, and if you make it, you learn the location of a new crystal, and you can proceed to the next wave when you're ready. (If we're halfway through the week and it's clear the multiplayer part is too much work, we can drop it, which would suck, but at least we'd still have a complete game.)


At no point in the game can your base be damaged, either by aliens or other players attacking you. They only "attack" your HQ, and the HQ's "health" is only how close they are to breaking into your lab. And since players don't steal anything from other players beyond information, it doesn't hurt you to be attacked (although we can still list results on a scoreboard). I think this will cut back on the frustration and boost the fun.


Optional stretch feature: the location of the crystal is an actual location on the map. You have to send your player character there to get the crystal and activate the next wave. (This adds to the exploratory feel of the game.) If this is the case, then it will be harder to explain to the player why they can't just find the next crystal by exploring rather than stealing from another player. Or would this also be a valid approach? I'm also a little concerned about people building bases around the alien base's entrance.

Double stretch feature: Getting the crystal back to your base is also a challenge. You control your character on the way back and have to outrun the aliens as they pursue you.

Server Implementation:

Tables: terrain, structure, event, user, resources, heist

The world is separated into sectors, (60x60 tiles). All data is bucketed into these sectors. 

The terrain is generated and cached in the terrain table. 

Structure is a table of all buildings. The sector a building exists in is indicated by its center tile. 

User is a list of all users and contains login credentials. 

Resources is keyed off users and is a list of all their resources. The reason this is separate from the user table is because it will be read less often but will be subject to frequent writes. 

Event is a list of all build events. This has an auto-incrementing ID from the server and an (incrementing ID, session ID) tuple from the client. When you request a list of events, you provide the last ID that you are currently aware of. When you build something, you provide the ID tuple of your own. This allows for retries without the server interpreting build requests twice. 


user: (user_id, name, password, hq_sector_xy, hq_xy, crystals)

terrain: (sector_xy, data)

structure: (structure_id, sector_xy, user_id, type)

event: (event_id, author_token,sector_xy, type, data)

resources: (user_id, food, water, stone, aluminum, copper, silicon, [etc])

heist: (user_id, sector_xy, completed)


Server is implemented as a python web script. All requests are passed in as GET requests. The output is a recursive serializer that can serialize string-keyed dictionaries, lists, ints, floats, bools, and strings and the client can deserialize them losslessly.



Common params:

action: the type of action

user: the current username

password: the user's password token




sectors: comma-delimited tuple of 3 ^-delimited numbers. First number is the last known ID of a sector, 2nd and 3rd are x and y coordinates of the sector

last id of 0 indicates nothing is known about the sector and all state should be relayed. 

response: { 'success': true, 'sectors': { '3^6': [event1246, event1247, event1248], '3^5': [event1240, event1242], '4^6': [event1, event2, event3 ... eventN] }, 'resources': { 'water': 23, 'food': 52, 'aluminum': 17, etc } }



client_token tuple of randomly generated client session ID and a client generated incrementing ID. This is recorded in the events table and duplicate attempts are ignored as redundant retries. 

sector: x^y ID of the sector

loc: column^row tile within the sector

type: type of the building


Response is same as poll. Success is assumed when the result appears in the response. 


/magic_potato.py?action=road&rest is identical to action build

loc: The value of loc is a comma-delimited list of ^-delimited tuples of road locations. Because people will frequently build several roads in quick succession, this request should be batched. 



location is any tile coordinate on the building. 

if location is near a NE or NW border, adjacent sectors (including the diagonally adjacents) will need to be polled. 



sector+loc: location of an enemy human lab

If a location is absent, this is assumed to be a request to steal a crystal. Can't do this twice to the same base. 

This command is sent upon success. For PyWeek, we trust the client to not cheat. 



One Way Trip/A Little Help: Instead of crystals, you are trying to save crew members from a previous failed mission. 

Comments (0)

You don't have permission to comment on this page.