• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
comfy chair

Production graph search

12 posts in this topic

In my game, I have modelled the production of items as a graph, where each node is an item (type) and the connections between them are processes to turn one or more material items into one or more products.

Now I want the player to be able to set a production goal, that is a desired number of items he wants produced of a give type.

The task is now for the computer to find the most efficient way of fulfilling the goal. There can be a number of material items already in store, and there can be a cost in time and energy for the processes. The cost in time and energy should be minimized.

Which search algorithm should I use? Neither A* nor BFS seem appropriate... Edited by comfy chair
1

Share this post


Link to post
Share on other sites
This could be quite a bit more complex than a simple path search (how complex is your production tree by the way?) so you might want to look into [url="http://en.wikipedia.org/wiki/Automated_planning_and_scheduling"]automated planning techniques[/url]. Although I never did anything major with them so I might not be able to give you much more advice than that.
1

Share this post


Link to post
Share on other sites
Barring any other knowledge about your data structure, you are going to need to fully explore all possible paths of production in order to know which is the [i]most[/i] efficient. Thus, Dijkstra's algorithm seems like a good bet to start with. Imagine your edge weights as material costs instead of road lengths and it should be easy enough to apply.
1

Share this post


Link to post
Share on other sites
The linear programming approach looks suitable for this problem. I don't have much experience with LP though. I hope you will post again if you think of more.

With this solution, will it be possible to present the user with a production plan for each of his orders, that he can inspect (and possibly cancel)?
The production plan would be: "Produce x items a, y items b" and so on. Edited by comfy chair
0

Share this post


Link to post
Share on other sites
Combine solving the traveling salesman problem with the knapsack problem and you have two NP-hard problems -- [i]at the same time[/i]. Don't be fixated on getting "the right answer". You won't. However, you can get something that is reasonable.
0

Share this post


Link to post
Share on other sites
Investigate using swarm/particle theory. It solves Traveling Salesman in freakish time. It can be reworked to incorporate the bin-packing as well.

Also, this is probably a good place for either MCTS or a straight up GA. Anything that converges on a solution rather than trying to build one from scratch is a good bet.
1

Share this post


Link to post
Share on other sites
I haven't used these techniques before. But they look great, and not too complicated. I guess it's time to learn something new.
0

Share this post


Link to post
Share on other sites
[quote name='IADaveMark' timestamp='1351630364' post='4995571']
Anything that converges on a solution rather than trying to build one from scratch is a good bet.
[/quote]
Also, when the user changes an order to 3 instead of 2 products, it would be really nice if the computer could continue where it left off with the previous solution instead of starting over, and thereby save tons of computation. This would give real-time responsiveness and make the game a lot more fun.
MCTS seems to have this ability.
0

Share this post


Link to post
Share on other sites
[quote name='IADaveMark' timestamp='1351606008' post='4995412']
Combine solving the traveling salesman problem with the knapsack problem and you have two NP-hard problems -- [i]at the same time[/i]. Don't be fixated on getting "the right answer". You won't. However, you can get something that is reasonable.
[/quote]

Do we know that traveling salesman and/or knapsack can be reduced to the poster's problem? I don't think we've established that the problem is NP-hard. In fact, I don't think we've committed to a particular problem statement at all.

Also: For a very long time, I have been inclined to dismiss NP-hard problems as unsolvable and move directly to heuristics or stochastic search (my current favorite is the cross-entropy method). But there is a middle ground: Many np-hard problems can be solved to within "epsilon" in polynomial time -- and some algorithms that [i]can[/i] have exponential complexity practically never do (e.g., simplex algorithm). I'm developing a newfound respect for the Operations Research guys.

[quote name='comfy chair' timestamp='1351597140' post='4995361']
The linear programming approach looks suitable for this problem. I don't have much experience with LP though. I hope you will post again if you think of more.
With this solution, will it be possible to present the user with a production plan for each of his orders, that he can inspect (and possibly cancel)?
The production plan would be: "Produce x items a, y items b" and so on.
[/quote]

Sure, that's what's the flows represent. If you were to cancel production partway through, you'd be left with whatever quantities flow into the nodes corresponding to that timestep.

Let me play with this a little and see what I can do.

[quote name='comfy chair' timestamp='1351638052' post='4995606']
Also, when the user changes an order to 3 instead of 2 products, it would be really nice if the computer could continue where it left off with the previous solution instead of starting over, and thereby save tons of computation. This would give real-time responsiveness and make the game a lot more fun.
[/quote]

You can "warm start" most solvers with an old solution to a similar problem. Edited by Emergent
0

Share this post


Link to post
Share on other sites
[quote name='Emergent' timestamp='1351644874' post='4995646']
In fact, I don't think we've committed to a particular problem statement at all.
[/quote]
Now that you mention it, there are some additional features that I would really like to have in this game system.

The first is choice between inputs.[s] Instead of requiring "2 of a", I would like to see "2 of a" OR "2 of b". This opens the door to a lot of realistic simulation of assembly processes.
Perhaps this requirement could be fulfilled by just adding more processes, I don't know.[/s]
On second thought, I think I will implement this as separate processes, but give the designer some shorthand tags to make it easier for him to make alternative processes.

The second is a quality level computed on each item. Each process would contain a formula that calculated the value of properties on its output(s), from the properties of its inputs.
The optimizer would then try to optimize for speed, quality, or a balance between the two. Edited by comfy chair
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0