Friday, February 28, 2014

New prototype: Space Being Shot!


It is in gridbase branch.
Exploring the playful part of the game.
It's kind of hard game and works well.

Coordinates in the game.

There are two coordinate systems in this game.


  • Unity's built-in 3d coordinates which uses left-hand coordinate system. using Vector3 class.
  • 2D screen tile-based coordinate system. using VectorInt2 class.
The problem is that the Y-axis is reversed between these two. Be aware of that.

Use Level.WorldToGrid(Vector2) to translate the first to the second.

Movement based on grid

To simplify the movement of the boss, we temporarily make a grid-based movement of the boss.

This is implemented in the "gridbase" branch in git.

The main logic is implemented GridObject class.

Properties:

width, height imply the size of the boss, counted in tiles.
ox, oy imply the center of the boss, (0, 0) specify the left-top, counted in tiles.

NOTE: The boss's volume is calculated as transform.position.x + width * unit, transform.position.y + height * unit, that is, the left-top corner is the position of transform component.

Functions:

Move(int dx, int dy, bool slide)

dx, dy should be -1, 0, 1. If not moving, then go to adjacent grid, otherwise do nothing. It's the only useful function.

if slide is false, you will stop when colliding walls, otherwise you will slide on the wall if you can.

------
Based on GridObject, we implement new BossBahaviour and BossSequence.

For BossBehaviour call RunSeq() to run a new sequence, which is a sequences of commands.

Inherit BossSequence to implement a new behaviour, and override the Run() function, that's how we make AI.

Run is a coroutine function, useful functions:

Move(dx, dy, slide)

You should call like this:
"yield return Move(dx, dy, slide)"

then the coroutine will wait until movement finished. Otherwise you initiate a move and go on.

If the move is finished or failed, you can call IsLastMoveFailed() to check whether the move succeeds.

------
I have implemented a simple sequence STrace.

-----
Maybe we could use a script to write the AI.


==================================
Next

Maybe more information after movement is failed.
Moving speed.
Turning around.
Shooting.

Monday, February 24, 2014

Level Editor!

Level Editor v0.1 done!

Usage

In LevelEditor.unity, press "`" when playing the game, The game will be paused and the level editor will run.

Tile Editing

Left click the tileset to choose the tile.
Left click the map to draw the tile.
Right click to delete the tile.

Three layers. - The landscape layer have collisions.

Objects

Now only support breakable walls.
Left click to put an object (align to tiles).
Right click to delete the object.

Camera

WASD to move the camera.

Save/Load

Now the editor saves to and loads from "Data/Level.xml".

Tuesday, February 18, 2014

Enemy Perspective and movement ideas

The Legend of Zelda: A Link to the Past has a perspective that we're hoping to use in Boss.  These bosses could also serve as useful examples of how we want ours to move around the top-down 2D world while still giving the impression of 3D.


Trinexx, one of the later bosses, manages to move his head and seem like he's looking at Link, even when he's heading straight north.

There's also the Helmasaur King, who's useful from a size perspective.  Maybe too big, given how much of the room he takes up.


I don't like Helmasaur's leg movement; prefer the model from Trinexx, but we have other ideas for this.  Onwards and upwards!

Wednesday, February 12, 2014

Tuesday, February 11, 2014

Boss


Procedural behaviour  - Boss' abilities deteriorate over time.