Tuesday, July 27, 2010

Week Nine Report

I ran into problems with MTsec not working, and so while it is being sorted, I worked on implementing a click function when the player wants to give a move order to an object.

What the click functionality for the move order is supposed to do is enable a player to select either an object or sub object on the map(hence why it was necessary to have rollover system objects) or anywhere on the map and that would send the position to the server. This is much more efficient than having the player enter the coordinates by hand, which is tedious and wholly ineffective.

In order to do this, a click manager was necessary so that if a move order is enacted, any click would then be interpreted as the position desired by the player instead of normal functionality such as if a player were clicking on an object to get its information.

Getting the position of an clicked object was fairly hassle-free since the space position is already stored in memory. Unfortunately, it is not so easy to send any arbitrary position based on the map, and so the bulk of my time has been spent attempting to translate a pixel position into a viable space coordinate.

I will say this, I absolutely hate dealing with pixels. Especially in the browser.

The main problem I've had is figuring out how to translate an always positive position such as (200,500), with a range of (0,0) to (1920, 1020), into a grid value that the space coordinates are stored as. The map display has a psuedo sort of quadrant system, but it is one way only. What has added to the confoundation of it all is that the y axis in css is negative on top and positive on bottom, instead of the usual way.

Suffice to say, I'm still stuck on the problem. After I do come up with a solution, whenever that happens, I'll begin bug testing, since I don't think I'll have time to deal with the design panel and because I've been running into several annoying bugs that need to be dealt with, such as the home planet not accepting a build order.

No comments:

Post a Comment