Author Topic: [Question] Soldat wall/collision detection  (Read 5247 times)

0 Members and 1 Guest are viewing this topic.

Offline mre521

  • Major(1)
  • Posts: 9
[Question] Soldat wall/collision detection
« on: June 23, 2011, 12:56:51 pm »
Hey, I was wondering... How does soldat detect if something hits a wall, or if there is a wall(s) between two points(line)?

I would assume that for collision detection it would just be a line made from an objects position and it's projected position based on velocity, then wall detection for that line.

I know that you technically could make a linear equation for each wall line and for the collision line then solve for an intersection, but wouldn't that be slow since you have to do at least 2 lines of every poly for every object on screen?

I'm just curious of how it works.

Offline Fryer

  • Camper
  • ***
  • Posts: 261
  • Game dev
Re: [Question] Soldat wall/collision detection
« Reply #1 on: June 23, 2011, 01:13:42 pm »
When you compile a map the map editor (Soldat PolyWorks) splits the map into several subsections. It then adds the polygons in the map to the lists for each subsection, so that every subsection has a list of polygons inside it.

When you are playing the game it checks the list of polygons for the section that the player is currently moving through. It then performs collision detection on only those polygons, which makes it faster than having to check all polygons in the whole map. :P

The collision detection in Soldat right now is far from perfect though, which is why you can at some points get boosted through walls if they are too small or even get stuck inside a bunch of polygons.
...PC vs Mac is like AK47 vs M4A1...
<DutchFlame`> i once heard running runescape in the background gave you a speedboost
<Mr> yes, it allocates more electrons, so there are more electrons available for Soldat -> they are streched less and it is more fluent

Soldat PolyWorks 1.5.0.13 - AimMode - Aim practise gamemode script - Fryer's SoldatStream Mod

Offline mre521

  • Major(1)
  • Posts: 9
Re: [Question] Soldat wall/collision detection
« Reply #2 on: June 23, 2011, 01:19:25 pm »
But how does it actually do the poly intersection checks? I already knew that the maps were split into sectors.

Offline Falcon`

  • Flagrunner
  • ****
  • Posts: 792
  • A wanted lagger
Re: [Question] Soldat wall/collision detection
« Reply #3 on: June 23, 2011, 04:23:21 pm »
It just check every tick (1/60 of second) what's your position and velocity and if that makes you collide with any polygon in current sector.
If you're not paying for something, you're not the customer; you're the product being sold.
- Andrew Lewis

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

Offline Fryer

  • Camper
  • ***
  • Posts: 261
  • Game dev
Re: [Question] Soldat wall/collision detection
« Reply #4 on: June 23, 2011, 05:04:52 pm »
It's a bit messy actually; it checks if several points of the body are inside a polygon, then after that it checks if any of the polygons vertices are colliding with the player or something like that. So it's messier than it needs to be, and on top of that some of the calculations are done in the wrong way, which is why polygons have the ability to bounce players to great speeds if they are placed in a certain way.
...PC vs Mac is like AK47 vs M4A1...
<DutchFlame`> i once heard running runescape in the background gave you a speedboost
<Mr> yes, it allocates more electrons, so there are more electrons available for Soldat -> they are streched less and it is more fluent

Soldat PolyWorks 1.5.0.13 - AimMode - Aim practise gamemode script - Fryer's SoldatStream Mod