A Mini Map With Maximum Enjoyment

Friday, June 13, 2008

After getting Hikari working, we wanted to test it.

We wanted to create something we could use in game. Something that would be difficult or time consuming to create manually. We also wanted to see how well it held up. What better test than a Mini Map?

First, here is the Mini Map in action:


It was created by Dave's brother Ian and supports rotating, zooming, and any number of icons on the map. It was written in ActionScript 3 and is a Flash element that is being rendering in our game using Hikari.

It performs quite well. There is barely a FPS drop and it is pretty smooth.

You can see the full source here and the data file here.

Here is a quick summery of what I needed to do to get it working in game.

I call the ActionScript
loadMap(imageUrl:String, mapWidth:Number, mapHeight:Number):void
function from Lua, passing in the name of the mini map image, the width of the map in game units (1 unit is a meter), and the height (or depth in 3D).

I can then call the ActionScript
setPlayerPosition(x:Number, y:Number, rot:Number, zoom:Number):void
function, passing in the x position, y position (or z in 3D), the degrees rotated around the y axis, and a zoom amount (based on speed of the player).

There is a similar function for setting data related to other players called setObjectPosition().

From there Ian takes care of the rest and that means I have time to watch an episode of Dexter instead of writing a Mini Map in C++. Yay!

1 comments:

triton said...

Well, this is really gooood! :D