HoverEX uses wall lines to do collision detections. So it is essential to build the wall lines for each map. Being that wall line drawing is a daunting task and it is indeed a waste of time and wits if the map designer have to draw the wall lines individually every time, thus wall line generator is introduced.
The basic concept of the wall line generator is that we store the generic wall lines in the TileSet. Being that we have a wall tileset, the wall tileset would hold the wall lines for each tile. From there, when a map designer build his/her map, the editor will simply merge all the wall lines of the tileset together and form the wall lines for the map.
Since each tile’s wall line is actually a polygon, when generating the wall lines for a map, we need to do some polygon boolean operation. Being that this is a rather complex task that could have well been a single project on it’s own (not to mention a Final Year Project thesis), therefore HoverEX cheated here by using a Public Domain code called Livarot.
However, the Livarot code in HoverEX is striped down to the minimal of what HoverEX needed. One down side of using Livarot is that it does not allow lines to contain extra data. When consulting the authur of the code, we were told that modifying the code to add that feature is extreamly difficult. Hence, a work around was made.
The process of the generation can be split into 4 basic task:
Being that this process does takes a while to accomplish, and freezing the app while this thing is proccessing is not a good idea, hence this process was done in a seperate thread. Though this makes it a little bit slower, it does not matter much as the Users wants to know what is going on anyways.