The Gang Garrison 2 Forum

Off-Topic Discussion => Amateur Gamedev => Topic started by: cspotcode on May 20, 2013, 11:47:33 pm

Title: Proof-of-concept GG2 map w/Nape physics engine
Post by: cspotcode on May 20, 2013, 11:47:33 pm
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.html (http://cspotcode.github.io/gg2-map-decomposition/index.html)

This 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 (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.
Title: Re: Proof-of-concept GG2 map w/Nape physics engine
Post by: 21Dan on May 21, 2013, 07:32:47 am
I'm impressed.
Title: Re: Proof-of-concept GG2 map w/Nape physics engine
Post by: bullets (obviously) on May 21, 2013, 07:44:52 am
 :o
Title: Re: Proof-of-concept GG2 map w/Nape physics engine
Post by: ajf on June 07, 2013, 06:44:06 pm
EDIT3: Turns out it mostly works in IE10 as well, except for the ball's rotation.
Are you not setting msTransform?
Title: Re: Proof-of-concept GG2 map w/Nape physics engine
Post by: cspotcode on June 07, 2013, 06:59:02 pm
EDIT3: Turns out it mostly works in IE10 as well, except for the ball's rotation.
Are you not setting msTransform?

I don't remember.  I *do* remember that implementing cross-browser compatibility was explicitly *not* on my todo list for this proof-of-concept.
Title: Re: Proof-of-concept GG2 map w/Nape physics engine
Post by: ajf on June 07, 2013, 07:07:00 pm
EDIT3: Turns out it mostly works in IE10 as well, except for the ball's rotation.
Are you not setting msTransform?

I don't remember.  I *do* remember that implementing cross-browser compatibility was explicitly *not* on my todo list for this proof-of-concept.
I notice you only seem to set -webkit-transform, I bet that has something to do with it ;)
Title: Re: Proof-of-concept GG2 map w/Nape physics engine
Post by: cspotcode on June 08, 2013, 10:10:25 pm
EDIT3: Turns out it mostly works in IE10 as well, except for the ball's rotation.
Are you not setting msTransform?

I don't remember.  I *do* remember that implementing cross-browser compatibility was explicitly *not* on my todo list for this proof-of-concept.
I notice you only seem to set -webkit-transform, I bet that has something to do with it ;)

Ah, yeah, makes sense.