Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411491 Posts in 69377 Topics- by 58433 Members - Latest Member: Bohdan_Zoshchenko

April 29, 2024, 07:04:32 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Algorithms
Pages: 1 [2]
Print
Author Topic: Algorithms  (Read 4578 times)
st33d
Guest
« Reply #20 on: January 24, 2010, 12:14:14 PM »

As the algorithm works, then each waypoint should assign a parent. Determining the path is then simply a matter of following the parent of each waypoint back to the start position.

I've done an implementation of AStar in this java Snake game for a mobile phone:

http://www.robotacid.com/pmobile/snakeAI2/applet/index.html

The project is open source and there's links to the code on the page.

Logged
Sigma
Level 1
*


View Profile WWW
« Reply #21 on: January 25, 2010, 02:49:24 AM »

because I think its a processor intensive job

It is generally a good practice to not assume things when it comes to performance. Make the simple implementation first (even if you suspect that it might perform poorly) just to get the functionality in there and working. Regularly run your code through a profiler throughout the development, and address things that stand out as problem areas in the profiling results. Usually, it's not going to be the ones you would have guessed.

Why take the time to optimize your adjacency-finding code at this stage, when you don't know if it's going to cause a problem?

suggest me a profiler compatible with all envi say as3, c++ etc

Thanks
Logged

Sigma
Level 1
*


View Profile WWW
« Reply #22 on: January 27, 2010, 09:39:28 PM »

Depends on how often those waypoints change,

is it possible how to change waypoints at runtime? how and when?
Logged

kiwi
Level 0
***


View Profile WWW
« Reply #23 on: January 28, 2010, 12:26:36 AM »

is it possible how to change waypoints at runtime? how and when?

Well, for instance, you might want to dynamically load/unload parts of the map if it is too big.
And then there's the possibility of adding and deleting road blocks to force a player to go through a certain path, dunno, for instance he wants to go south and bam, a tree falls on his path, that waypoint doesn't exist anymore, or you complete a quest, a door opens and then you have a new waypoint.

There's a lot of stuff to be said here depending on how you design your game, but I think an adjacency list would be feasible in all scenarios.
Logged

Sigma
Level 1
*


View Profile WWW
« Reply #24 on: January 29, 2010, 01:55:31 PM »

is it possible how to change waypoints at runtime? how and when?
but I think an adjacency list would be feasible in all scenarios.

ya i agree with you. thanks for the reply.
Logged

Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic