Author Topic: Asteroid Field Improvements Attempt (Images)  (Read 11940 times)

0 Members and 1 Guest are viewing this topic.

Offline DTP

  • ImPortant Coder
  • 28
    • http://www.c4-group.dk
Asteroid Field Improvements Attempt (Images)
I made a HUD debug line that displayed the current input from the command line in regard to -almission X (autoload mission), where x where the filename of the mission.

it should be easy to add the number of objects in the mission to the HUD, it might even be more mission developer friendly to add a command line switch that shows information like this.

I assume I could make that and put here what I did.

But only if you fell it is worth the trouble kazan. Just let me know
VBB member; reg aug 1999; total posts 600.
War is a lion, on whos back you fall, never to get up.
Think big. Invade Space.

 
Asteroid Field Improvements Attempt (Images)
I'm probably off on a tangent here, but assuming the nature of this bug is that Freespace can only deal with x amount of collision testable objects at a time, a possible fix would simply be to stop testing distant non-ship (i.e. asteroids) objects.

[EDIT] Or better yet, stop collision tests on distant asteroids and then pump up the numbers and see if you still get the bug [/EDIT]
« Last Edit: July 17, 2002, 08:41:12 am by 383 »

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Asteroid Field Improvements Attempt (Images)
I think it's the number of objects period, nothing to do with colision testable objects, though I havn't realy looked into it
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline IceFire

  • GTVI Section 3
  • 212
    • http://www.3dap.com/hlp/hosted/ce
Asteroid Field Improvements Attempt (Images)
Wouldn't not counting collision detection break anything that goes on at long range?  IE.  Derelict's beam fights?
- IceFire
BlackWater Ops, Cold Element
"Burn the land, boil the sea, you can't take the sky from me..."

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
yeah it would

that's not the solution
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline rambler

  • 22
Asteroid Field Improvements Attempt (Images)
I've been lurking about in the AI code for a bit. Though I'd share my $0.02 about my interpretation of the collision detection routines...

From what I understand, as each object is created (cargo, ship, weapons fire, asteriods...) it is added to the global "pairs" list. The Pairs list is itterated through to check for collisions between thos two objects. If it is not on the list, no collision detection is performed.

A new "pair object" is created for each combination of that object with every other object that it can collide with. So, if there are, say, 8 ships, with each ship having 10 "shots" flying about, for a total of 88 objects, the number of "pair" objects would be nCr(88,2) or "88 choose 2" combinations, which comes to 3828 pairs.
Acutally lasers to not collide with lasers so this may not be quite accurate; but close enough!

There are exceptions though. Asteroids do no collide with each other and so, do not form pairs.

So, extending our example, with 8 ships, 10 shots each, and 200 asteroids, we get nCr(88,2)+88*200=21428 pairs. (It's "88*200" since asteroids do no collide with one another; 80 shots in the air + 8 ships). The problem is that MAX_PAIRS is set to 8000.

There was some discussion about pointer overruns and such. I've found that, in general, the code is quite robust. The routine that creates and adds pairs checks the MAX_PAIRS limit. Once the limit is reached, it stops adding to the pairs list and so, all remaing objects are not checked for collision detection. Since ships and asteriods are created first, they are likely to be on the list before it overflows. Weapons fire is added as it is generated. If the list has overflowed, collision with the weapons fire will not be performed and, hence, has effect anywhere. However, the player ship can still collide with the asteroid since they have been added to the list before it overflowed. The rendering of the objects is handled completely separately so is not affected by the list state.

It seems that the simple solution would be to increase MAX_PAIRS to some large number, say what's MAX_INT again? 16- or 32- bit? So, putting maybe 4 ships, each having 10 shots in the air, and 500 asteroids: nCr(44,2)+44*500=22000, which is way under 65535. I can't comment on performance though...:doubt:

Conclusion? Somone has already tried to increase the MAX_PAIRS define but I suspect that it should be increased by a large amount. I don't have my development environment setup so someone will need to try it and correct me.

In addition, it may be kinda neat of asteroids can collide with one another can explode into smaller pieces. Easy to do, but you can imagine the number of pairs ( nCr(500,2)=124750)...

AI is *much* more fun than collision detection:D

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
a while ago i increased it to 35000 and it freespace 2 promptly crashed
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline penguin

  • Eudyptes codus
  • 28
  • Still alive.
Asteroid Field Improvements Attempt (Images)
This is probably a topic for another thread, but I wonder how tough it would be to make the various sizes more dynamic...

With some it would be easy: stuff from tables, for instance -- you can tell how many are in the table, then dynamically allocate the array.  For stuff like this (number of obejcts and number of pairs) it would obviously be much more difficult...
your source code slave

 

Offline penguin

  • Eudyptes codus
  • 28
  • Still alive.
Asteroid Field Improvements Attempt (Images)
Quote
Originally posted by rambler
I've been lurking about in the AI code for a bit...
rambler:

:D;7:eek::cool::cool::eek:;7:D
Shotguns are located under the seats, exits to the left and right.  However, the shotguns are out of service and are being upgraded; talk to Thunder about the reported problems with the exits :D


Damn, I've always wanted to say that...
your source code slave

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
oh yes, welcome, it's good to see someone who learns the ways of the board before posting
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline EdrickV

  • Valued
  • 29
    • http://members.aol.com/HunterComputers
Asteroid Field Improvements Attempt (Images)
Quote
Originally posted by rambler
There are exceptions though. Asteroids do no collide with each other and so, do not form pairs.


Actually, I think I've seen asteroids collide with each other.
Ground - "Let me help you out, you're clear to taxi any way you can, to any runway you see."

Mesh Gallery/Downloads:
http://members.aol.com/ArisKalzar/Gallery.html
Turreting 101:
http://members.aol.com/EdrickV/FS2/Turreting.html

http://members.aol.com/HunterComputers

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
yes asteroids collide w/ e/o
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline rambler

  • 22
Asteroid Field Improvements Attempt (Images)
Quote
Originally posted by Kazan
yes asteroids collide w/ e/o


I can't remember either way but take a look at:
void obj_add_pair( object *A, object *B, int check_time, int add_to_end ) [\code\object\objcollide.cpp, line:307]
Asteroid-with-asteroid collisions aren't enumerated.

Looking at \code\asteroid\Asteroid.cpp, asteroid_check_collision() is called only from:
\code\Object\CollideDebrisShip.cpp\collide_asteroid_ship() and
\code\Object\CollideDebrisWeapon.cpp\collide_asteroid_weapon()

If they do collide with each other, it must be magical or there is some kludge to implement this behavoir that I can't find.

Asteroids are affected by explosions so maybe this is the behavior that we are seeing...
« Last Edit: July 18, 2002, 09:44:14 am by 843 »

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
asteroids are most defininantly affected by expolisions

asteroids are a type of debris so the debris coollision functions take care of them
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
wow, double post, how did that happen... someone right it down on the calendar, the second time in history kazan has double posted
« Last Edit: July 18, 2002, 10:44:52 am by 30 »
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline rambler

  • 22
Asteroid Field Improvements Attempt (Images)
Looking through the code again, it turns out that the number of collision pairs estimates I had made were probably too high. The code seems to cull-out much of the weapons fire collision pairs that are not directed to a particular asteroid. So going through the excercise again, 4 ships, 10 shots each, and 500 asteroids may come to about (I'm guessing here) 5000 pairs. Maybe the problem is not with the Object Pairs list afterall.

As an additional note of trivia, it looks like there is no friendly fire in FS2; at least you can't receive friendly fire from small, friendly ships. I've always been worried about those wingmen firing from behind me....

 

Offline penguin

  • Eudyptes codus
  • 28
  • Still alive.
Asteroid Field Improvements Attempt (Images)
According to the FRED2 docs (which could be wrong, of course):
Quote
FreeSpace 2 does not check for collisions between asteroids, so they pass right through each other. Don't make your field too dense, or this will be noticeable.
Haven't looked into the code to confirm one way or another :o
your source code slave

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
weird

anyway increasing the collision pair count doesn't fix it, look for the solutuion elsewhere
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir

 

Offline Nico

  • Venom
    Parlez-vous Model Magician?
  • 212
Asteroid Field Improvements Attempt (Images)
asteroids don't collide: just make a very small astroid field with the max asteroids, and look at the pieces of rock flying happily through each other.
SCREW CANON!

 

Offline Kazan

  • PCS2 Wizard
  • 212
  • Soul lives in the Mountains
    • http://alliance.sourceforge.net
Asteroid Field Improvements Attempt (Images)
max asteroids [256] is enough to break the collision code, try it with about 100
PCS2 2.0.3 | POF CS2 wiki page | Important PCS2 Threads | PCS2 Mantis

"The Mountains are calling, and I must go" - John Muir