Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark Physics & Dark A.I. & Dark Dynamix / Any idea to create a one way track for AI?

Author
Message
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 12th Jul 2010 15:21
Like for example, when you want entity to on which way like in tube station, or normal basis such as car.

Make it choose the closet path by not allowing it to go in wrong direction.


I have an idea to make in 2 container overlapping each other, but the entity would not avoid others entity in difference container then.

Please help

many thanks
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 13th Jul 2010 12:51
only way I can think of is to vary the cost of the ai waypoints or paths dynamically

there is a tutorial in one of the newsletters about making memblocks from the ai WP data, then manipulating the memblock to change the movement 'cost'.

so I guess if the ai entity is approaching the tunnel from one direction, you can set the pathing cost so high that the AI will not choose that direction, and when you approach from the other (correct) side then set the pathing cost really low, so that the AI chooses that particular path.

This is not the Sig you are looking for....
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 13th Jul 2010 15:47
Cheers,

I don't know how the memblock works yet, but I gotta learn it then.
This really help me, since i don't know where to start at all.



Thx again.
: )
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 13th Jul 2010 19:17
I have tried the concept of memblock and it seems to be what I was looking for.

Still, I can't really code it because a command guide from DarkAI does not really state how to use it. Just describe each integer and some syntax.

and I'm not so sure if I do understand about the memblock yet.
Do you have any source code which use the memblock? I also tried the tutorial from the website already as well.

Thx
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 14th Jul 2010 12:09
I don't have any really usable stuff myself, but I think that the the code included with the newsletter tutorial is reasonably straightforward as far as using the memblock to alter the waypoints and travel costs.

in the tutorial code, under 'step 4' the 'updateWaypoints()' function contains the important bit for you, especially these lines:



In your case, I guess you could check for the condition depending on the direction travelled. Maybe something to the effect of setting the waypoint cost to 2000 only if that waypoint is south (-ve z value) of the ai entity position, and 0 if the waypoint is north, meaning that the entity will quite happily travel north along the road, but will find other routes to go south

This is not the Sig you are looking for....
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 14th Jul 2010 17:23
btw what issue is it, the tutorial you mentioned about?

thxxx
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 27th Jul 2010 03:25
This is extremely helpful

Thx a bunch!!

: )
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 28th Jul 2010 02:45
I just managed to sort it out already, but it doesn't seem to work as I thought.

However I want to described how I work on it, just in case I might misunderstood and also to share the knowledge.

Basically, its base on tutorial above and since my programme seems it has to deal with 'edge' by setting its cost to make a one way track.

First, I adopt the way to find the index for each way points in the screen.
Second, I modified the edge cost according to the index I obtain on the screen. by checking the first and the second, if the condition is right it will write a new cost.

I don't get it why its not really seems to work the way I want, AI still took the same path as before, while not try to avoid the high cost edge at all. I also check the output from memblock in the screen as well.

I assume, maybe the index I used is incorrect orrrr..... I don't know >_<!!

btw, I don't know how to use the +code snippet tho - -''
Dia
19
Years of Service
User Offline
Joined: 16th Jan 2005
Location:
Posted: 28th Jul 2010 13:05 Edited at: 28th Jul 2010 13:07
there are a couple ways to include the snippet. My usual is:

-copy and paste your code into the 'message:' window where you enter forum text

-select all of the code (click and drag select)

-click the [code ] button above the text entry window. This will automatically add '[code ] and [/code ]' tags around your code



don't forget to update the waypoints after the cost has been increased 'make waypoints from memblock' otherwise all you have done is update the memblock data, not the actual waypoint data that dark ai uses

This is not the Sig you are looking for....
xninzx
14
Years of Service
User Offline
Joined: 11th May 2010
Location:
Posted: 28th Jul 2010 16:55
Thank you very much!

so basically from the tutorial I use this code, to modify the waypoints



but before modify I check each index of waypoints from this one. the position would not be so precise but you'll get a picture of overall waypoints in simulation and you can see its position.



So then, I check my result by this, to print if my condition is right and the cost of edge has changed. by printing it out in the main loop.



also with this one to check how the each edge is performing (first 10 edgess)



I have done exactly for my idea to find an index and change the cost for each edge to make a one way track, but it seems not to work out. T_T

Login to post a reply

Server time is: 2024-11-24 12:52:19
Your offset time is: 2024-11-24 12:52:19