Sign in to follow this  
csisy

Some question about FPS game programming

Recommended Posts

Hi, I'm working on a Fps game in XNA, and I've got some question: - What kind of collision system should I use, and why? - What kind of network system should I use, and why? - For the bullets, should I use List<>, and for each update, for each Bullet -> Update, and check ray-mesh/sphere collision? Thanks for the replies, csisy

Share this post


Link to post
Share on other sites
You need to reverse your questions, e.g.:

I want to perform sight, hearing and bullet collision and have my data stored in a BSP, how do I perform collision detection?

In other words: tell us what you have, what you have tried and what the requirements are and then ask us again.

Then we can answer.

Share this post


Link to post
Share on other sites
I've tried this:
- for each collision mesh
- ray-bounding box intersect. if true:
- ray-mesh intersect. if true:
- ray-triangle intersect. if true:
- get picked triangle's normal
- "sliding"
But I haven't been able to finish this system, because I've had some problem:
- how can I calculate the height position? Maybe ray-triangle intersect again, but what if, the player is on the roof and jump down, and the ray-triangle intersect test is false?
- and what if the player is in the corner of a room? Move forward -> collide -> sliding left, but there is a wall, so should I call the collision test again?
- finally the speed: I haven't tried this system, but I think, it's too slow.

My first idea was boundingbox-boundingbox collision, but (I think) it isn't work with "round" objects (ex. curved wall, cylinder objects, etc.).

I want to CoD-style collision detection. :)

Share this post


Link to post
Share on other sites
hi csisy,

Maybe this is some info that can help you out :)

Using bounding boxes for world collision detection isn't a good idea because they are axis aligned (heres an article about it: http://sharky.bluecog.co.nz/?p=108)

You can use an octree based collision detection system. This makes sure for collision that can handle round/curved/rotated objects because it breaks the world into smaller and smaller boxes depending on where you are in the world.
You can also use this for optimizations of your game because you can check where you are in the world and which objects are/aren't in your tree/surrounding tree's. Its is also a very optimal way of collision detection because it only checks what needs to be checked.

I am afraid I don't have ant experience with network systems so I cant help you on that subject.

For the bullet you can subdivide the character into more bounding spheres, this is less heavy than a check on the mesh and if it collides you can check on the mesh also.
So you use a bounding box for a general collision check and than dive into the bounding spheres,the mesh and at last into the triangle intersection. If there is no collision it will be noticed much faster. In this way the mesh check wont get called so often because that the bounding spheres filter the axis aligned bounding box faults.

I hope this is any help for you ;)

Greets Juul

Share this post


Link to post
Share on other sites
thanks for the reply Juul :)

I've read about octree, but I haven't known that I can use it to collision detection :) (maybe does the CoD use it?)

For the bullets why do I need mesh/triangle check? Maybe can I call a simple ray-bounding sphere collision detect? I think it works with characters, but what about the other objects, ex. a house? Here do I need a mesh/triangle check? But what if the scene has 50 bullet? Wont it be too slow?

Thanks again,
csisy

PS: Sorry for my bad english :)

Share this post


Link to post
Share on other sites
Hey Csisy,

Octree is a way of checking (commonly used for 3D space collision checking)
When you get dive into the theory you can notice that it can be used in much more than only collision checking. I don't know what CoD uses for collision checking.

I think that a simple ray-bounding sphere collision detection is fine for the bullet-character collision checking.
For the buildings/world etc. I think I should try to integrate the collision checking into the octree system because it checks fast and efficient. Maybe look into bounding boxes instead of mesh to check collision on.
I haven't got any experience on this front but this is what I should research.

I hope it can help you,

Greets Juul

Share this post


Link to post
Share on other sites
Or you can just do what the pros do and use a 3rd party physics library. I'd suggest PhysX since it's free and pretty commonly used in AAA shooters.

Collision detection and response are very hard to implement correctly. It's worth knowing the techniques, but expect to spend a few months on it if you want something usable, and expect it to perform very crappily compared to a professional library. If you are doing this for the learning experience I would recommend picking up a copy of "Real-Time Collision Detection" (http://realtimecollisiondetection.net/books/rtcd/)

If you just want to make a game then go with a library. =)

-me

Share this post


Link to post
Share on other sites
Hi,

Thanks Juul, you've given me some good idea :)

@Palidine:
The PhysX lib is really good, but if i want to run my game in xbox360, i can't use it.
"Collision detection and response are very hard to implement correctly." - Yeah, it's true :D
"If you are doing this for the learning experience [...]" - Yes, this is my goal. I want to learn how can i write games :)

Thanks for the replies,
csisy

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this