December 23, 2024, 02:08:58 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Wondering where all the forums have gone?

Join the community Discord server!

Pages: [1]

Author Topic: Proof-of-concept GG2 map w/Nape physics engine  (Read 7847 times)

cspotcode

  • Coder
  • Administrator
  • *****
  • Karma: 134
  • Offline Offline
  • Posts: 412
Proof-of-concept GG2 map w/Nape physics engine
« 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

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)
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.
« Last Edit: May 21, 2013, 07:47:20 am by cspotcode »
Logged
"The knack of flying is learning how to throw yourself at the ground and miss."
- Douglas Adams

21Dan

  • Guest
Re: Proof-of-concept GG2 map w/Nape physics engine
« Reply #1 on: May 21, 2013, 07:32:47 am »

I'm impressed.
Logged

bullets (obviously)

  • Seasoned Member
  • *****
  • Karma: 40
  • Offline Offline
  • Posts: 1955
Re: Proof-of-concept GG2 map w/Nape physics engine
« Reply #2 on: May 21, 2013, 07:44:52 am »

 :o
Logged

ajf

  • (Ex-?)Developer and forum/web admin
  • *****
  • Karma: 7
  • Offline Offline
  • Posts: 3421
  • she's never quite as dead as you think
Re: Proof-of-concept GG2 map w/Nape physics engine
« Reply #3 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?
Logged
did you know that spinning stars work like this???

I've seen things you people wouldn't believe. execute_strings on fire off the shoulder of Overmars. I watched object-beams glitter in the dark near the room_goto_fix. All those moments will be lost in time, like tears...in...rain. Time to die.

cspotcode

  • Coder
  • Administrator
  • *****
  • Karma: 134
  • Offline Offline
  • Posts: 412
Re: Proof-of-concept GG2 map w/Nape physics engine
« Reply #4 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.
Logged
"The knack of flying is learning how to throw yourself at the ground and miss."
- Douglas Adams

ajf

  • (Ex-?)Developer and forum/web admin
  • *****
  • Karma: 7
  • Offline Offline
  • Posts: 3421
  • she's never quite as dead as you think
Re: Proof-of-concept GG2 map w/Nape physics engine
« Reply #5 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 ;)
Logged
did you know that spinning stars work like this???

I've seen things you people wouldn't believe. execute_strings on fire off the shoulder of Overmars. I watched object-beams glitter in the dark near the room_goto_fix. All those moments will be lost in time, like tears...in...rain. Time to die.

cspotcode

  • Coder
  • Administrator
  • *****
  • Karma: 134
  • Offline Offline
  • Posts: 412
Re: Proof-of-concept GG2 map w/Nape physics engine
« Reply #6 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.
Logged
"The knack of flying is learning how to throw yourself at the ground and miss."
- Douglas Adams
Pages: [1]
 

Page created in 0.023 seconds with 36 queries.