|
-
M.D.
yep, agree that the node count is getting a bit much, but i think i need those nodes because i need to know edges of different terrain so a path can move around if need be. If i remove the nodes then i limit the effectiveness of the terrain cost. Unless your seeing something i'm not.
One thing i want to fix is the connections. Take the river near the shop.

the far left node has a connection to all those nodes, so when the A* finds that node it will expand all those nodes, now i'm not sure if thats good or not, because say if the left node had only a connection to its right neighbour node and we wanted to move to the far right, A* would go through all the nodes to get there rather than just the first (left node) and its farthest (right) node connection. Then again if we only wanted to move in the middle, only half of the nodes would need to be expanded. (the more nodes expanded , the more work a priority queue has to do), Well i think so anyway
the major problem i see now though is getting that terrain data. Simply accessing a number is sooooooo much faster than accessign an associative array. I've been thinking of regular expressions to create patterns which hold the connection position and its cost, but this means the time to find the correct pattern is based on the size of the string and that could be real bad.
Last edited by mr_malee; 02-22-2007 at 08:17 AM.
-
M.D.
can't upload the new version but the time is (at best) less than half by using this:
node[6][x][y]
than
node[6][x+""+y]
if i can somehow use a 1D array it could be even faster
Last edited by mr_malee; 02-22-2007 at 08:31 AM.
-
M.D.
i'm a silly billy, all i had to do was this:
when pushing a connection to another connection, simply push the cost into another array, when A* loops through the connections, the id for the connection is the same as the id for the cost. Duuuuurrrrrrrr
massive speed increase:
http://soap.com.au/rts
-
Style Through Simplicity
Looking awesome mate . Can't wait to see it with changeable terrain and multiple units.
Ali
-
performance increased yes,- but still its eating to much CPU (almost everything) if I just swing the mouse a little bit- what are you checking or performing anyway when the character isn´t given a path or just not walking?
-
Style Through Simplicity
CPU usage is fine for me.
Ali
-
M.D.
hardly anything, one enterframe which records the current tile mouse position, weight at this position all which format into a textfield, also run the control function of the player which just checks if its path is null, if it is it doesn't move.
the background is one big bitmap the size of the stage, in total there are three bitmaps in memory:
tileset, weightset, stageBmp.
stage is low quality
can't think of anything else, i've got some big array's i guess but that shouldn't really affect performance. Hmmmm, anyone else getting a massive CPU hog?
EDIT - try it again without info displayed or being accessed, offline mem usage: 16mb, cpu usage: < 20%
Last edited by mr_malee; 02-22-2007 at 07:36 PM.
-
Script kiddie
I get 50% CPU usage while he's walking on any path with one or more lines in it. :s
-
Style Through Simplicity
I get about 4%-10% CPU usage by the way. Thats with supreme commander running in the background as well as 10 other programs.
Ali
-
M.D.
thats what i wanted to hear
-
Flash Incompetent
don't really have any knowledge to contribute to this thread but just wanted to point out something that seemed a little off to me...

edit: just to clarify, seems there is no reason to dip down by the mountains...
-
It has only jumped up to 44% for me when I was clicking a lot other than that it varies around 25%. Nice path finding although it's a bit funky. I was thinking of a system using nodes and line of sight like how a person would find a path. Use line of sight and make nodes along the way. In effect this would make it so you have to move strait until you explore a place then you just follow your previous nodes although this could end up taking a lot. Also, an idea that slimslaby had was instead of having it like a radio connection and so if the guy ran out of the signal then you couldn't see it or anything it would just run on an ai to control it until it gets back in range of the signal. Then you could add something like programmable ai's although this would make it a very complex project but this game would be fun.
-
M.D.
its faster to move through the sand than the mud. If i slowed down the movement even more this path would be better than if it went straight through the mud.
mud weighs .5 * 2
rough sand weighs .3 * 2
movement speed: 2 - weight
yeah, so i guess just tweaking the heuristic and movement. In the above example if my total movement speed is 10 then the above path is silly.
my cost (that is from parent node to connection) uses Euclidean distance: sqrt x * x + Y * y
my heuristic uses Manhatten distance (connection to goal): abs x + abs y
also closed nodes are never re-opened, opening them again could make better paths i think.
so i guess if i swap those round i could get different results. Thanks for the screenie, i'll look into different settings and choose one that seems the most normal looking
Last edited by mr_malee; 02-22-2007 at 09:17 PM.
-
just a sidenote:
wouldn´t it be interesting to add psychologic and body health/ status variables into the choise or weight of certain spots. I mean the mud area might be dirty but if you dont have the energy for the long run your body certainly would prefer the dirty way.
Or imagine that just like ant- algorithms where you get from time to time real pathways in the tiles (visible) and the unit/ character prefers that way under certain conditions. A thief or a spy but perhaps might prefer walking not on the road.
about performance:
got a very old computer here (700 Mhz) and I do very well noticed a big performance difference. It feels like as if even the character moves already a path or reached his goal the CPU still calculates all kind of pathes on each frame,- at least when I move my mouse. If I hold my mouse link the character moves smoothly- very strange
-
M.D.
not sure what i can do about that, i can't re-create the problem. A path is only created when clicked, never on its own. Have you tried focussing the movie and then moving the mouse around.
The wmode is transparent as well, so it could be a problem there. Try grabbing the swf from the cache and testing it offline. I'd really like to know if it still happens outside of a browser.
edit - nice suggestions by the way, that would turn pathfinding into a whole new concept, giving each entity its own personality, i guess its also possible to add into the algorithm. Imagine if one entity could detect other paths and attempt to intercept, like a flanking manouver, if the moving entity only sees forwards, sneak attacks could be made
Last edited by mr_malee; 02-22-2007 at 10:42 PM.
-
about the suggestions:
well I came up with the idea because of ChaseNYC´s post. Because I thought how odd- the lazy me would rather prefer getting dirty but because of that using less energy.
about the performance:
yes its the damn wmode again that prevends me from using flash movies the propper way (why do even people like it- just because of IE?). Works like a charm without the wmode with wmode ~ 40-60% slower (Opera 9.10)
-
Style Through Simplicity
 Originally Posted by renderhjs
about the suggestions:
well I came up with the idea because of ChaseNYC´s post. Because I thought how odd- the lazy me would rather prefer getting dirty but because of that using less energy.
Isn't the mud supposed to be harder to walk through though? That would use more energy that walking on a path even if the path was slightly longer.
Malee - Are you planning to have different cost effectiveness for different units? So a foot soldier might try to avoid mud etc as much as possible while an off road vehicle wouldn’t pay so much attention to the cost. An air vehicle wouldn’t even take costs into account of course.
Ali
-
M.D.
cheers, thanks for that, i can sleep a little easier.
wmode's a nasty habit i have, it just makes things run so much faster in IE. I'll take it out
-
and a helicopter taking the straight path (air route). I really find the idea interesting as it would give the game alot more variety. That way it really takes difference in using different units for different tasks.
-
M.D.
yeah thats what i would like, different units acting upon different costs, one way i thought is just send a variable to the pathfinder saying ignore costs below a certain value or make costs below this value 0. But this assumes that all units are grounded, air units wouldn't need the same pathfinder, or any at all, it would basically be, click and move.
I want my RTS to be as close to the operation of red alert (my favorite) i don't think things like a threat map came into context with red alert, it was basically choose a good path or your gonna get screwed. When you think about it, if the pathfinder was so smart as to avoid mud because of energy, or avoid battles, the strategy and difficulty of the game play is reduced, i know it sounds like a cop out, but i want players to "control" their units not just click and make them do everything themselves.
I hope you know what i mean.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|