I think this is the right forum section...
I'm working on a proof-of-concept for decomposing GG2 maps into a set of polygons, then handling collision detection with a physics engine.
Here is a very limited demo for Chrome (will support other browsers later).http://cspotcode.github.io/gg2-map-decomposition/index.htmlThis is what your browser is doing:a) downloads a wallmask image in png format (it's the wallmask from koth_kongking, which can be found in this thread:
http://www.ganggarrison.com/forums/index.php?topic=33662.0)
b) breaks the map into polygons.
c) draws the wallmask and the polygons onto the screen
d) loads all those polygons into a Nape physics world
e) drops a ball onto the map and lets it roll around a bit
Next step is to test using the methods of nape.space.Space to support GG2's Character movement logic. For Character movement, Nape will be used solely as a collision detection system, allowing us to check:
- whether or not a Character's collision box hits a wall at a given position
- "hull traces" or collision sweeps, figuring out the point of first contact when a character's collision box is moving in a certain direction.
- ray traces (not really for character movement, but used for snipers)
EDIT: the ball appears near the center of the map, so you'll need to scroll.
EDIT2: Added keyboard controls. A and D spin the ball left and right.
EDIT3: Turns out it mostly works in IE10 as well, except for the ball's rotation.