Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AbrahamR, AndrewAMD, ozgur), 763 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
What's the best/fastest way for object detection? #132070
05/26/07 11:54
05/26/07 11:54
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Hi,
In my WWII game, I have about 10 or more AI players on each team, some my allies, some my enemies. I need each actor to be able to detect it's enemies and attack them. I have been using a "radar-style" c_trace, one that constantly spins around so every 5 seconds it turns 360 degrees and scans it's surroundings for enemies. Now, this works fine, but I need the whole process to be faster, but I can't make the rotating c_trace any faster or it skip over enemies. Should I use c_scan instead of a rotating c_trace, and if I do, how can I make c_scan return YOU as the closest detected object with the enemy property, not just the closest object(which might be another ally)? Also, c_scan will go through walls, and the actor will be wasting his time trying to shoot at an enemy which he can't hit.


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).
Re: What's the best/fastest way for object detection? [Re: Impaler] #132071
05/26/07 12:36
05/26/07 12:36
Joined: Jul 2006
Posts: 783
London, UK
sheefo Offline
User
sheefo  Offline
User

Joined: Jul 2006
Posts: 783
London, UK
In my RTS I loop through each player, and their array of units (in Lite-C) and check if it is within sightrange. It gets more complicated, I check if it is on a different team with no diplomatic relations. Then I store the entity pointer if it's health is lower than the previous one, which in the end has the enemy unit in sightrange with the lowest heath for the unit to attack (if in aggresive mode, otherwise the function is aborted).

Try something like that in C-Sctipt. It is fast because no c_trace or c_scan is needed, all done with maths in one frame.

Re: What's the best/fastest way for object detection? [Re: sheefo] #132072
05/27/07 05:46
05/27/07 05:46
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
I thought that's just what c_scan does, except within a certain range? Anyway, how can you access a list of objects or actors in the game, to check which ones are enemies?


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).
Re: What's the best/fastest way for object detecti [Re: Impaler] #132073
05/27/07 05:51
05/27/07 05:51
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
check out ent_next(entity); in the manual.
good luck with this!


~"I never let school interfere with my education"~
-Mark Twain
Re: What's the best/fastest way for object detecti [Re: Germanunkol] #132074
05/27/07 06:41
05/27/07 06:41
Joined: Aug 2006
Posts: 128
Papua New Guinea
I
Impaler Offline OP
Member
Impaler  Offline OP
Member
I

Joined: Aug 2006
Posts: 128
Papua New Guinea
Thanks, Micha!


Murphey's Law:
<< if anything can go wrong, it will >>

(Murphey was an optimist).
Re: What's the best/fastest way for object detecti [Re: Impaler] #132075
05/27/07 15:56
05/27/07 15:56
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
Quote:

I thought that's just what c_scan does, except within a certain range? Anyway, how can you access a list of objects or actors in the game, to check which ones are enemies?



Quoted Impaler.
I might use eLL (entity linked lists and arrays plugin) found here for such things. I wrote it for similar purposes but I assume very few actually use it.
At one time, I clocked it, and it appeared to be faster than scan_entity. Essentially it works similarly to ent_next, and maybe scan_entity, except user-defined entity link lists can be defined. In principle, fewer items might be iterated over. A version for 6.5 is currently under revision.


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1