Followers 0

# Algorithms

## 6 posts in this topic

Greetings, I am new in game development and I would like to study some algorithms that can be used on games.

Can someone please share their ideas on what algorithm should be use on games

(for example is A* for path finding) and hopefully if they know some problems on that certain algorithm.

Also at the moment I am studying A* algorithm and does anyone know what can be enhance on this algorithm?

Thanks

Edited by Cruzz
0

##### Share on other sites

Thank you sir for your reply and it gave me an idea on how work on this algorithm based on the scenario that you told me. Though can I ask for more scenario that the algorithm might face a problem or its disadvantage given that we only need to find the path not the shortest path or best path for it.

Somehow "multiple units going to one place" this made me realize that what is the path going to the target is only passable by one what will happened to the other variables?

also "one unit going to one of several goals" this means that the algorithm will find the shortest path right?

edit:

another one what if there is two target and they have the same range, where should it start to go?can I ask your suggestion for this sir >.< Thank you very much

for the moment I want to think of scenarios for this algorithm >.<

Edited by Cruzz
0

##### Share on other sites

edit:

another one what if there is two target and they have the same range, where should it start to go?can I ask your suggestion for this sir >.< Thank you very much

Cost, or toss a coin/always pick one/alternate picks each iteration, if the cost is equal.

If you need to go to Albuquerque, and the only connecting flights are Boston to Albuquerque and Chicago and Albuquerque, but you live equidistant between Boston and Chicago, which airport do you fly from? You choose the cheapest cost, either in \$, knowledge of how to get to Boston or Chicago, travel time to Boston/Chicago + flight time to Albuquerque, or some combination of those factors, etc.

1

##### Share on other sites

I see, giving rules or effects on the terrain it is moving can give some factor in where it should go first, though I have a question what if there is no terrain o-o. Just a simple one do you think if we will simulate it. it will always go to Point A or Point B? or it will go alternately every time you test it o-o

0

##### Share on other sites

Thank you sir for your reply and it gave me an idea on how work on this algorithm based on the scenario that you told me. Though can I ask for more scenario that the algorithm might face a problem or its disadvantage given that we only need to find the path not the shortest path or best path for it.

Somehow "multiple units going to one place" this made me realize that what is the path going to the target is only passable by one what will happened to the other variables?

There are further pathfinding methods which handle DYNAMIC situations where they account for moving objects being part of the problem . I recall the map data now included future times when some moving unit would occupy a node on the network and the  traversal logic of other units took that into account as to their possible path options.

Units going thru a restricted gap would bunch up and some kind of 'wait'  action was added to allow the units blocking the desired path to move away and free the gap.

0

##### Share on other sites

Can someone please share their ideas on what algorithm should be use on games

Something that comes up a lot is over-use of IF/THEN statements, which can result in a complicated and confusing mess. If we examine what an IF/THEN statement is all about, then we can begin to understand how to approach much better solutions (which have already been developed.)

IF/THEN clauses are essentially a lookup operation; given one scenario or set of conditions, do the perscribed behavior/function/whatever. If this situation, then do that. It's basically a dictionary entry. A better way is to use a container that allows a sort of Key->Value lookup operation. Given a condition, look up the answer.

So a developer behavior algorithm for eliminating most strings of IF/THEN spaghetti is to re-write the IF conditions as Keys and THEN conditions as Values, and then store them into a dictionary type container for easy lookup.

Edited by AngleWyrm
1

## Create an account

Register a new account