Thursday, September 5, 2013

Space Adventure Game Design Challenge Part 4 (Randomly Generated Map)

Step one in the programming tasks was to randomly generate the map.  After creating some rough prefabs (red squares for mountains, yellow for desert and a small particle effect for the geysers) I got to coding.



The Node Class (above) holds all of the information about a particular square.  My game controller creates a 2D array of nodes the length and width of the selected map. Using a nested for loop, each node in the array is then given a coord in world space (each prefab is 4 units across so the location is the Position in the array * 4)



Then the game runs passes to set 3 random squares to oil (but only if those squares are currently not defined, and not next to an oil square and not near the home areas in the middle of each side)

One quarter of the squares are then randomly turned into mountains (but again, not near the middle of each side)

The remaining undefined nodes are then set to desert.
I then run a function which runs through each node and creates the appropriate prefab (based on the nodes type) at the appropriate place (based on the nodes location)

This function will be greatly expanded to include randomly selected desert prefabs and intelligently selected mountain prefabs connecting to each other.

The prefabs are all stored in a second 2d array, allowing me to access them later when changing the prefabs to have pipes on them

Here is a quick preview of my early map


Space Adventure Design Challenge Part 3 (Program To do List)

To develop this game I'm going need to program in certain features in a certain order


  1. Randomly generate map
    • Map Size based on variables
    • Ratio of Desert/Mountains Constant on different map sizes
    • clear area of desert near each players home square
    • always 3 oil rigs
    • map build containing custom node class holding all info needed for each tile (Type, is visible, is build on, etc)
    • When placing prefabs on nodes randomly select desert tiles and rotate them and calculate how to connect mountain tiles
  2. Touch controls
    • Detect Tap to bring up contextual orders menu on tiles (Plus taps for buttons etc)
    • Detect Drag to move map view around
    • Detect Swipe to rotate map 90 degrees
    • Detect Pinch to zoom map in and out
  3. Add advanced tile features
    • add tile visibility particle effects with a function in code to remove
    • add pipe building effects and pipe prefabs (select tile to build pipe on, select output)  
      • In final build players may only be able to build on the square they are currently on or may be able to build on adjacent, visible squares
      • pipes will need to select prefabs to use in the same way mountains do
  4. Add avatar functionality
    • use mecanim to create an avatar that can walk and turn left and right
    • use A* algorithm to allow players to move further than just adjacent square.
    • create function that moves player to target node
  5. Add Context menu
    • When player taps a square opens that squares context menu
    • if (square < visible && player Is adjacent && AP > 1) Then show open to make square visible
    • if (estimated move cost (using A*) < AP) Show option to move to square
    • if (player is on square && ((AP>1 && Type = Desert) || (AP >2 && Type = Mountain))) Show option to build pipe
    • These options call the functions created in steps 3 and 4
  6. Add game turn logic
    • create custom class to control players score/AP/location etc
    • add gui button for end turn
      • when turn ends make current player inactive and activate next player
      • when a player becomes active check if they can score and set all actions relative to that players information
      • possibly auto rotate camera to each players default?
    • add gui textures in each corner to show each players score
    • add win logic (check if player has 'x' points after checking if they can score that turn
  7. GAME STATE COMPLETE
  8. Create a full screen gui texture (with stretchable borders and a tile-able background)
    • Add about screen and play button and Title
    • Add a settings page after play button so players can choose a color for their avatar and set the map size and points to win

Space Adventure Game Design Challenge part 2 (Asset List)

To make this causal mobile title I'm going to need to develop some assets


  • A tileable waving sand texture for the ground (Diffuse and Bump)
  • Models for the desert tiles
    • Cactus
    • Wagon Wheel
    • Barrel
    • cow skull
    • wooden fence
  • Models for Mountain tiles (connecting tiles)
    • solo Mesa
    • Mesa with one connecting side
    • Mesa with 2 connecting sides (corner)
    • Mesa with 2 connecting sides (opposite)
    • Mesa with 3 connecting sides
    • Mesa with 4 connecting sides
  • Models for Oil Geysers
    • Oil Rig (animated)
  • Models for Pipes (connecting tiles)
    • Input from Left
    • Input from Right
    • Input from behind
    • Input from Left and behind
    • Input from Right and behind
    • Input from 3
  • Particle Effects
    • Fog effect(needs to tile)
    • Oil effects
    • Score +1
    • Oil barrel (to travel along pipe from geyser to home when scoring)
  • Gui Textures
    • Re sizable window borders with tileable background (start screen, pause menu, about screen, settings, etc)
    • Button texutre
    • Custom font
    • Score Gui for each player in each corner (colored)

Space Adventure Game Design Challange

For the second game design challenge I'm going to repurpose a board game I designed called black gold.

black gold is a game for 4 player.
to setup the game  a 9 * 9 grid of cards are placed face down.  the 81 cards consist of 26 Mountain cards 52 Desert cards and 3 oil geysers.

The four players each start in the middle of one side of the board.  At the start of each players turn they roll a dice to determine how many 'action points' they will have for that turn.  every action costs action points.  A player can choose to

  •  reveal an adjacent square (cost 1AP),  
  • move to an adjacent revealed desert (1AP), 
  • move to an adjactent revealed mountain (2AP), 
  • build a pipe on desert (1AP),
  • build a pipe on mountain (2AP), 
  • Turn an already placed pipe (3AP), or 
  • build a pipe on an oil geyser (5AP).
They first few turns are generally spent exploring the map looking for oil geysers.  Players must then built a pipeline from the oil geyser back to their home square.  Pipes have a set direction, they except input from 3 sides and output to a pipe on the 4th side.  If a player has a complete pipeline from a geyser to their base at the start of their turn they gain one point.

There is one less geyser than players to force players to fight over resources (with 4 geyesrs the last player to start scoring can't afford to leave their pipe undefended, but cant attack).  The randomness of the map can give a player an advantage if all the geysers are near them, but then all the other players will harass them together balancing the match.

Some rules that can be tweaked to adjust game play balance
  • Cost of actions
  • Weather scoring occurs at the end of your turn or the beginning (do player get one turn to interrupt your line after you complete it or not?)
I'm planning to covert this board game into a casual mobile title.  The game will allow 4 player round robin multiplier on one device.  I would also like to implement adhoc multiplier and facebook support (call these stretch goals ;)

Wednesday, September 4, 2013

How to embed unity projects in blogger posts using dropbox

This post will outline how to add unity projects to your blogspot posts by hosting them using dropbox. First step is to make a dropbox account and upload your .unity3d file exported as a webplayer (the html file is not required) once its hosted you need to get the public link for the file. If you get stuck use this link https://www.dropbox.com/help/16/en.

Make a new Post in blogger and in the top left hand corner press the HTML button.  Paste the following code into your blog


Replace INSERTDROPBOXURLHERE with your public dropbox url.

The Size can be adjusted as well.

I found this code here http://www.unityversum.com/2010/04/iframe-gadget-test.html.  I take no credit for this tool.

Tropical Death Game Design Challenge Part 4

The Final Build.

Rather than the path finding puzzle mechanic I was originally planning on implementing, while play testing the prototype I found that it was more fun juggling the fruit and attempting to control its velocity and direction by rotating the paddles while the fruit is on or near them.

Since this removes the sorting mechanic, I have implemented only one fruit and it no longer matters where they end up.  The player has 10 lives, and loses a life for each piece of fruit that misses.  The goal of the game is to achieve a high score.