Jump to content

  • Log In with Google      Sign In   
  • Create Account


Algorithms


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Cruzz   Members   -  Reputation: 106

Like
0Likes
Like

Posted 03 October 2013 - 05:15 AM

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, 03 October 2013 - 05:18 AM.


Sponsor:

#2 Álvaro   Crossbones+   -  Reputation: 12362

Like
5Likes
Like

Posted 03 October 2013 - 08:37 AM

If you are interested in path finding, make sure you understand A* completely, so you can implement it efficiently and --more importantly-- so you can modify it for situations that don't fit the standard setup (e.g., multiple units going to one place, one unit going to one of several goals...). I wouldn't worry too much about enhancements until you get to that point.

 

There are algorithms for planning (like GOAP), algorithms for playing games like chess and checkers (minimax with alpha-beta pruning), and a new class of algorithms called MCTS that can be used for all sort of situations (playing games where we don't have a reasonable evaluation function (like go), playing games with multiple players, with randomness or with simultaneous decisions...).

 

But I would try to learn this field one problem at a time. Make a program that plays connect-4, or poker, or StarCraft, or your own little game. Then learn whatever you need to know to tackle the particular problem. Over time, you'll learn lots of things about the field, and you'll also know what kinds of things you are interested in working on.



#3 Cruzz   Members   -  Reputation: 106

Like
0Likes
Like

Posted 03 October 2013 - 12:56 PM

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, 03 October 2013 - 01:07 PM.


#4 Paradigm Shifter   Crossbones+   -  Reputation: 5203

Like
1Likes
Like

Posted 03 October 2013 - 02:07 PM

 

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.


"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

#5 Cruzz   Members   -  Reputation: 106

Like
0Likes
Like

Posted 03 October 2013 - 09:14 PM

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



#6 wodinoneeye   Members   -  Reputation: 705

Like
0Likes
Like

Posted 12 October 2013 - 11:29 PM

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.


--------------------------------------------Ratings are Opinion, not Fact

#7 AngleWyrm   Members   -  Reputation: 554

Like
1Likes
Like

Posted 14 October 2013 - 10:17 AM

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, 14 October 2013 - 03:30 PM.

--"I'm not at home right now, but" = lights on, but no ones home




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS