### Archive

Posts Tagged ‘spacefight’

## Polygons and a Proper Map

April 23rd, 2011 No comments

I wrote in my previous post that my idea would make sense once I got it working.

The purpose of this “Accessible Area” map is for the game, SpaceFight!. The orange area represents the places that the player character can reach given a certain amount of time. The algorithm works something like the following:

1. Build a list of visible wall nodes (corners) within a range around the player
2. Sort the list from closest to furthest
3. Cast out spokes at given intervals with a minimum length of whenever it collides with a wall and a maximum length of the given radius
4. Create and add to the ‘area list’ a polygon based on the previous spoke coordinate and the current spoke coordinate
5. Iterate list of visible wall nodes
6. Calculate new radius by subtracting the distance between the starting location and the node location from the given radius
7. Start over at the top of this list substituting ‘player’ for ‘node location’ and keep going until the new radius is too small

I really wanted to add (union) the polygons together to create one polygon consisting of the outer-most points. Unfortunately, that messes up and I’m left with what looks like a crumpled bridge at the best of times. For the time being I’ll have to use the list of hundreds (due to the recursion) of polygons as seen in the image above. It’s not so bad as in the game it’ll be displayed in between turns when the frames per second doesn’t matter. Perhaps there’s a Java package out there that could do the job for me, giving me a simplified list of the union of all the polygons.

Categories: Game Dev Tags:

## SpaceFight! Map Rendering

March 28th, 2011 No comments

I keep forgetting to post on #screenshotsaturday, so here’s a peek at the current state of SpaceFight! (codename).

It doesn’t quite look like the fight takes place in space.

Since the last post, I’ve changed the resolution from 800×600 to match my phone’s display of 854 x 480. And, of course, the big difference since the last post is map rendering. I’m using the Tiled Map Editor which Slick plays so nice with.

Categories: Game Dev Tags:

## SpaceFight! Ballistics

March 21st, 2011 No comments

SpaceFight! now has weapons and bullets (missiles). There is no hit-detection going on, yet, but the missile management is there!

Categories: Game Dev Tags:

## SpaceFight! Now with a Timer

December 18th, 2010 No comments

I’ve added a timer to SpaceFight! and the pawns now stop once they’ve reached their destination. In the previous build the pawns would only use the destination to figure out which direction they were headed.

Categories: Game Dev Tags:

## SpaceFight! movement

November 27th, 2010 No comments

Added a new state to the loop that handles the ‘turn’ after all the pawns have been given instructions. During this state, the pawns carry out the instructions given to them. At the moment, the only instructions they carry out is movement.

Presently, all the pawns turn toward the direction that they are traveling. I think I might change that so their rotation can be player-defined.

Categories: Game Dev Tags:

Switch to our mobile site