So is my idea right Apoc? The Only problem now is to find a good code example for A*/Dijistrika's. That hopefully is in c# XD
There was one on codeproject in C#. It was very general though.
Haha, I was thinking of more dynamic ways of pathing for my bot;
My net was out so I opened up notepad, jotted some notes and wrote some functions and code just to find out I replicated Dijkstra's method.
But my question is, I want to reliably be able to save and read from nodes of "waypoints" live when pathing.
For example, say I've mapped out 100 "waypoints" in a square area, How could I save that information effectively; ONLY to run the method to the 10 immediate nodes around me?
EDIT:
I just took a crap and I think I have a fairly reliable way of saving information that could easily be scanned through very quickly. It would save information in the form of nodes, which would have and ID, and 5 waypoints within them. It would allow for smaller calculations without much sacrifice and you would have the ease of format.
Last edited by suicidity; 01-17-2009 at 08:10 AM.
I had a look at an article at gamesutra: Link
It proposes that you can use sectors for marking the walkable areas, and portals describe how the sectors are connected.
Each sector is defined by two points. The portals are pretty simple to calculate, it is just a part of an edge that is shared by two sectors.
It seems quite logic and simple, but I have a hard time figuring out which sector you are in given a x,y coordinate.
A trivial solution would be to loop though all the sectors in the map and figure out which sector you are in. Another solution is to have some kind of lookup table, or maybe to sort the sectors according to x coordinates and use binary search on them.
Anyone have some thoughts about this?
You could use a simple STL Container to store the sectors and use the stl sort algorithm on them, you'll have to overload the > or < operator for your sectors in order to make the algorithm function, you can then use the STLs search algorithms they've implemented a binary_search and some other search algorithms.
I hacked 127.0.0.1
So i've gotten it so i can log my Actions.
Aka heres what i've done so far
A Basic Add Coordinate / Check ThingCode:loc = new byte[500, 500, 1000]; //500 by 500 Grid w/ 1000 Z /// <summary> /// Checks the Location /// </summary> /// <param name="_x">Your X</param> /// <param name="_y">Your Y</param> /// <returns>-2 = Not in bounds, -1 No Pass, 0 Not Sure, 1 OKAY</returns> public int checkLocation(int _x, int _y, int _z) { ##CODE } /// <summary> /// Adds the Location of a XYZ Location /// </summary> /// <param name="_x">X - Coord</param> /// <param name="_y">Y - Coord</param> /// <param name="_z">Z - Coord</param> /// <returns></returns> public bool addLocation(int _x, int _y, int _z) { ##CODE }
Now i am still trying to figure out
#1 How to store the 3d Array <.<
#2 Since i am storing the Z it would take Forever to find a good path. I think
So how do you guys do it?
I was thinking maybe like path Segments but i want to to be more free and find unique paths to go each place by randomizing it some.
Well if anyone has any commens post belowth.
Last edited by luciferc; 01-17-2009 at 04:54 PM.
So i made another picture to illustrate my ideas b/c i love pictures alot.
For Last Pic: the 9 steps is acually 8 if i did Diaginoal walking but i didn't b/c there were red squares.
Been spending about 3 days just working on pathing XD. Super fun :O.
I even made a grid display XD. That has colors n stuff.
Last edited by luciferc; 01-17-2009 at 08:07 PM.
What do you mean by that? Lol
Btw
I did something cool.
I printed out my Map. XD
Its in a Text file that is 500x500.
-'s = A Unknown Spot
•'s = A Traveled Spot
U have to scroll to about the Center and go down its in the center Area. Over 600 + •'s
Download PathMap.txt
Last edited by luciferc; 01-17-2009 at 09:50 PM.
Cypher is also an idiot. It used a 3D mesh.
3D boxes. And it did just fine with stairs and overlapping regions.Code:method MapLocation(float X, float Y, float Z) { variable float X1 variable float X2 variable float Y1 variable float Y2 variable float Z1 variable float Z2 variable string RegionName ; Dont map if we are flying (On a flight path) if ${Me.Flying} || ${This.MappingDisabled} { return } X1:Set[${X}-2.5] X2:Set[${X}+2.5] Y1:Set[${Y}-2.5] Y2:Set[${Y}+2.5] Z1:Set[${Z}-3] Z2:Set[${Z}+3] RegionName:Set["${CurrentZone.FQN}${Time.Timestamp}${CurrentZone.ChildCount}"] CurrentZone:AddChild[box,${RegionName},-unique,${X1},${X2},${Y1},${Y2},${Z1},${Z2}] This:Output["Area not found, mapping! Added (${RegionName} ${X}, ${Y}, ${Z})."] ;Connect To Previous and Current This:ConnectNeighbours[${RegionName}] }
Apoc is my thinking Right?
The Pretty Picture above.
>Also whats the best way to save it?
I tried serializing but it wasn't working for a 3d Array.
Last edited by luciferc; 01-18-2009 at 12:11 PM.
How would i be able to make sure it is enabled to be Serialized?
Also for Lists wouldn't i have to search thru the whole list instead of Calling [x,y] etc.