Last Page Update: 03/15/2017
Ever played Fallout Shelter? Well, you should, IMHO. It is an addictive little base building game (available on mobile and PC/XBox) – with cute graphics on top.
As FS was done with Unity, I thought I could (at least, partially) re-create the game play, getting some insights how they probably did it. The outcome is (yet another) test case, this time called FalloutShelter’ish. The main focus was set to room building and dweller movement.
FalloutShelter’ish was planned to have these minimum features (and actually got those in the end, more or less):
- Fixed pixel size 1024×768, PC exe only (also, a web export)
- In general: Look&Feel similar to the original game
- Externally shadow-baked 3D Rooms (done with C4D here)
- Room construction feature (“base building”), including add/remove
- Room size variations, with smallest one acting as “elevator” type
- Add/remove avatars, with random name generation
- Click&Drag on Avatars to assign them to new rooms
- Basic pathfinding, using size 1 rooms as elevators/stairways
- Automatic exchange of avatar assignment when a room is full
- A GUI presenting room/avatar information, and construction options
As shown below, I tried to split up the game mechanics into detailed states, avoiding sub-states. This approach bears some issues, though. E.g., the “Room Info” window is activated when a room has been selected (State “SelRoom”). This disables Camera Drag, as that was defined as another state. In the end, not the overall best design decision.
Internally, the building area consists of a 10×10 grid. Each grid can be occupied by a room and link to other grids. The “vault entrance” (where new avatars come in) is at the upper left corner (fixed position). To ease things up, each grid can hold only one avatar, and rooms can be built of grid size 1, 2, 3 only.
To use easy checks on room removal (“room is linked to more than one other room”), the following building rules were defined.
- Size 1 rooms can link to above/below/left/right but must not be built side-by-side.
- Size 2/3 rooms can link left and right
- Entrance room can link to the right only
As it turned out, this was not sufficient, though. It is still possible to build a base with circular references. Then, some rooms can’t be deleted. More detailed checks on room removal would need to be implemented in order to fix that (not done for this test).
Avatar movement is done by a click&wait&drag&drop operation (drag a Dweller onto another room). Internally, a waypoint array of Vec3 is being calculated “on drop” and submitted to the entity for pathed walking.
For pathfinding, I used a stripped-down A* variant, running in the main thread. As avatar numbers and positions match the underlying grid, the pathfinding is simply using grid elements.
Actually, the a.m. waypoint array could be converted into a more general “action system”, where different actions would be calculated at path creation time. Like, “walk to…”, “activate elevator lights…”, etc. This way, an action list would be given to each avatar, which takes then care about trigger time and execution. Actually, I’d prefer this over lots of independent volume triggers in the scene.
|ShelterIsh_Exe.zip||03/15/2017||20 MB||Zipped Unity3D exe|
|index.html||03/15/2017||--||Link to Unity WebGL Player (tested on Firefox. Fonts are a bit odd, though)|