Gamestudio Links
Zorro Links
Newest Posts
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
1 registered members (Ayumi), 662 guests, and 3 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
Page 2 of 2 1 2
Re: The RTS ai... [Re: Gordon_Shumway] #171824
12/13/07 20:51
12/13/07 20:51
Joined: Jan 2007
Posts: 110
USA East Coast
K
KojaK Offline OP
Member
KojaK  Offline OP
Member
K

Joined: Jan 2007
Posts: 110
USA East Coast
Ohh.. I see where the confusion is.

See, in all of my pathfinding systems, I have never used WED's nodes. I use a low-poly model, and assign it an action which is "pathfind_node". This is a part of the whole pathfinding map. Although I have added to my system over time, I was going to scrap it and start from scratch this time, in order to fit it in with the whole RTS system. See, I'll have an action called "pathind_node", that I will set up to scan every other node, register itself into an array(the influence map), and set itself up. The code will generate the needed number of nodes over the terrain/level, make the nodes drop from above, and position them over the whole level. This done, the ones that are too far above all the others(impassible terrain such as mountains and buidings) will be deleted before they register so that no troops can go there. The rest will register in the array, and the AI will be able to use skills and flags of the nodes as it's influence map.

So if a player sends some troops to a location, the nearest node will become "occupied" by the player. The AI will react accordingly.

I understand how to make the influence map. I understand that perfectly. What I'm having trouble with all of this, is how do set up a function that creates all the nodes, and positions the nodes far enough apart? I was going to make the nodes drop themselves, but how do I tell the code what the boundaries are in which it should create the node models? How high should the nodes be created for them to drop correctly? How many should the function create?


Lead programmer for Two Screws Loose Click here for our forums, and downloads for our games
Re: The RTS ai... [Re: KojaK] #171825
12/14/07 16:34
12/14/07 16:34
Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Gordon_Shumway Offline
Member
Gordon_Shumway  Offline
Member

Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Before I answer, just for me, if I understand you correct:
(LOL sometimes discribing a problem is not that easy )

You have low poly model who acts as a node.
You assign a action to it called "pathfind_node".
Then you want a function who creates lots of such low poly models and align them in a for example grid pattern.
You want to drop the models on your terrain, so you're intresting in a special hight, too.

So, you need a function who does all this ?

Are these your problems?

Bye G.S.


***Neue Webseite!! Mit vielen neuen Infos! http://www.2662-thegame.de.vu***
Re: The RTS ai... [Re: Gordon_Shumway] #171826
12/14/07 20:46
12/14/07 20:46
Joined: Jan 2007
Posts: 110
USA East Coast
K
KojaK Offline OP
Member
KojaK  Offline OP
Member
K

Joined: Jan 2007
Posts: 110
USA East Coast
YES! Thank you! That is exactly what I want.


Lead programmer for Two Screws Loose Click here for our forums, and downloads for our games
Re: The RTS ai... [Re: KojaK] #171827
12/14/07 21:44
12/14/07 21:44
Joined: Nov 2005
Posts: 1,007
jigalypuff Offline
Serious User
jigalypuff  Offline
Serious User

Joined: Nov 2005
Posts: 1,007
would such a function work in a turn based game? to enable the pathfinding on a flat 3d grid?
like this



Why does everyone like dolphins? Never trust a species which smiles all the time!
Re: The RTS ai... [Re: Gordon_Shumway] #171828
12/15/07 22:29
12/15/07 22:29
Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Gordon_Shumway Offline
Member
Gordon_Shumway  Offline
Member

Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Ok, if you want to do it that way, I will give you some hints.
I would make a grid similar to the influence map.
- So you need two variables: grid_x_max and grid_y_max (grid_x means the maximum number of grid tiles in x direction)
- important information: grid_x_max * grid_y_max = number_of_nodes
- tile_width = level_width/grid_x_max (example: 40000/20 = tile_width = 2000 .... tile_length similar with y_max
- example for 3x3 grid (grid_x_max=3, grid_y_max=3)it looks like this
7 8 9
4 5 6
1 2 3
- make while loop from i=1 up to number_of_nodes
- inside the loop: calculate the position of the node (use the cornerpoint or the middle point) - (the next calculation is for your lowest level borders in x and y direction at Zero, if it is not use an offset)
x-position (middle of the tile)= ((i-1)%grid_x_max)* tile_width + tile_width/2 and then
y-position (middle of the tile) = (int((i-1)/grid_x_max))* tile_length + tile_length/2
( for better understanding make a scatch on a sheed of paper then everything should be clear)
- the z-position, I think there are some possibilities like using trace from a position (x,y calculated before, but z much higher then the terrain), so you can calculate a good hight for every node. Or using a very high z-value and let them drop or ......
- use ent_create at the x,y,z position

This could be one way for such a function.
I haven't tested this pseudocode, so I hope everything will be correct. But it is one possible way.

I hope this will help you !!!

Bye G.S.

Last edited by Gordon_Shumway; 12/15/07 22:36.

***Neue Webseite!! Mit vielen neuen Infos! http://www.2662-thegame.de.vu***
Re: The RTS ai... [Re: Gordon_Shumway] #171829
12/17/07 21:11
12/17/07 21:11
Joined: Jan 2007
Posts: 110
USA East Coast
K
KojaK Offline OP
Member
KojaK  Offline OP
Member
K

Joined: Jan 2007
Posts: 110
USA East Coast
Thanks. I now have a blueprint for my code...

Thanks a bunch. That helps a lot.

I do have one more question, what is better, having the troops calculate the path once they are told to move, or calculating the path in advance and have the troops check an array for where to go next? Would it be worth the RAM space to store 100*100 handles, or would it be worth the computing time to find a path through 100 nodes?


Lead programmer for Two Screws Loose Click here for our forums, and downloads for our games
Re: The RTS ai... [Re: KojaK] #171830
12/19/07 15:37
12/19/07 15:37
Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Gordon_Shumway Offline
Member
Gordon_Shumway  Offline
Member

Joined: Feb 2004
Posts: 217
Wennigsen, Germany
These are some questions which are not that easy to answer, because depends on your type of game.
But you can answer the questions yourself:
If your game has 100s of game entities and every entity has to do a full pathscan to find the next waypoint, when the entity arives at a new node ... with this method dynamics of units can be taken into account, BUT this will kill your FPS.

If your game has only a few units this method should be no bigger problem for the FPS.
It also depends on the number of nodes - to find a path through 10000(100*100) nodes can take much longer than calculating a path through 1000(10*10) nodes.

What kind of algorithm you will use, is also an important question. For some applications a Brute-Force-Algorithm could be much faster than for example A*, for other apps A* is the one and only. Sometimes simple obstacle-avoidance could solve problems, too.

All depends on your type of game.

I hope this will help you a little bit.

Bye G.S.


***Neue Webseite!! Mit vielen neuen Infos! http://www.2662-thegame.de.vu***
Re: The RTS ai... [Re: Gordon_Shumway] #171831
12/23/07 17:44
12/23/07 17:44
Joined: Jan 2007
Posts: 110
USA East Coast
K
KojaK Offline OP
Member
KojaK  Offline OP
Member
K

Joined: Jan 2007
Posts: 110
USA East Coast
Thanks. It does help.

However, what is this obstacle avoidance algorithm you keep talking about? For my level plans that could me all I need!


Lead programmer for Two Screws Loose Click here for our forums, and downloads for our games
Re: The RTS ai... [Re: KojaK] #171832
12/27/07 13:44
12/27/07 13:44
Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Gordon_Shumway Offline
Member
Gordon_Shumway  Offline
Member

Joined: Feb 2004
Posts: 217
Wennigsen, Germany
Hi Kojak,
sorry, I can't give you a name for an algorithm or a link, sorry. Just keep on searching for the topic Obstacle Avoidance. This could be enough for your type of game.
Bye G.S.


***Neue Webseite!! Mit vielen neuen Infos! http://www.2662-thegame.de.vu***
Re: The RTS ai... [Re: KojaK] #171833
12/27/07 17:11
12/27/07 17:11
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline
User
JazzDude  Offline
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Raiden posted an obstacle avoidance code in this forum. It's in a Loopix post titled "Avoiding object while walking to player "

Page 2 of 2 1 2

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