rts collision

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
chaotischerapostel
Posts: 19
Joined: Wed Jan 23, 2008 7:10 am

rts collision

Post by chaotischerapostel »

I would like to know how to go about setting up collision for a rts like game. I know to make triangle selectors, add them to meta and make a animator, and iv been trying several differnt ways like that. Currently i make a triangle selector for all nodes when they are created. Then i make a MetaSelector for every node and add all the triSelectors but its own and create a Animator, attach to the node and drop everything to be dropped. But I fear that this is a highly in-proper way of going about it and it is quite a pain to go through all of that. Is there a more proper way, or am i just missing the point of Irrlicht collision and doing it completely wrong?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

That sounds reasonable. However, I'd imagine that bounding box collisions would be good enough for an RTS. Do you really need per-triangle collisions?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

Well i think that for RTS tile based system is the best way and the faster for the computer and that the system used by most RTS games now like empire earth2 ,warcraft 3 , starcraft but by some advanced methods added as tile based system gives you to do this options easily:
1-path finding
2- collision
3-accurate estimation of the postion of the unit(very important in rts like the range property in units)
4-easier in making maps by tiles(as you will need many maps for RTS)
5-properties of tiles (like the ship cant move on ground but moves on water harder done if u used just a mesh for the map or landscape )
Nova
Competition winner
Posts: 99
Joined: Mon May 09, 2005 10:32 am

Post by Nova »

i'd go with the tile based system, too...
that way you don't have to calculate bounding box collision or even triangle precise collision...

just have a 2D array of ints (or stucts if you need more options) which stores properties for each tiles
(walkable, is blocked by building / unit, is ressource etc.)

thatway collision is a simple if( MapArray[25][36] == 1 ) check,
with a system like this

0 - walkable
1 - unit / building build
2 - unwalkable
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Sure, if the units are all homogeneous in size. Are there any RTSes written in the past 5 years where that's the case?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Nova
Competition winner
Posts: 99
Joined: Mon May 09, 2005 10:32 am

Post by Nova »

nope of course not, that doesn't mean you can't go with such a system
warcraft III utilizes such a way with various different sized units...
(worker -> unit -> hero -> siege tanks as an example)
adjust your tiles to the smallest possible unit and use multiple tiles for bigger ones...
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Nova wrote:warcraft III utilizes such a way with various different sized units...
What evidence leads you to that conclusion?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
gogo
Posts: 65
Joined: Tue Apr 15, 2008 1:04 am

test

Post by gogo »

chaotischerapostel
Posts: 19
Joined: Wed Jan 23, 2008 7:10 am

Post by chaotischerapostel »

Sorry i didnt mention that im using bounding boxes. Using presise tringleSelectors would be a bit much. The tile idea seems like an acceptable one, but arent tiles out dated a bit? Thanks for your help everyone!!!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: test

Post by rogerborg »

I am so tempted to divert some of my precious bandwidth to finding out what's in there, but it turns out that the pr0n. Must. Flow.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply