• 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
Tourist

Design of AI for my Game

8 posts in this topic

I am trying out a project for applying Neural Network in my game.

 

Game has a player who can move either up or down.

 

Objects: Coins which move in constant velocity towards the direction of a player and moves past if he doesnt catch

 

Coins generated in a random way originating from random spots 

 

Output: On whether the player should move up or down

 

Input: 

This is where am having troubles. Since the number of coins in screen and its position are going to be varying, i dont think that can be applied as input. I would like to know how to approach inputs in this ? Any similar articles where this is applied will help too. 

Thanks

 

 

0

Share this post


Link to post
Share on other sites
Perhaps you can divide the screen into some grid and use as inputs whether each grid is occupied or not, or perhaps how fast an object in the grid is going. You can make the grid have variable resolution, so the resolution is better near the player (the grid should probably be relative to the player).

Anyway, that's the first thing that came to mind.
1

Share this post


Link to post
Share on other sites
  1. If all coins are thrown towards the player, staying still is an optimal strategy that catches all coins. Can you explain coin movement more precisely? Does player motion affect coin movement? Also, how is the player's motion constrained? Looping movement (e.g. along a circle) would make the problem easier.
  2. Assuming that the purpose of the game is catching as many coins as possible and that some running around is needed, a straightforward neural network could be a bit too stateless: AI needs to plan what coins should be caught, and in what order, or let go. With n coins on the playfield, there are less than n!*2^n plans and a relatively long time to evaluate them.
  3. If you really need to use a neural network (homework?) an obvious brute force input choice is the number of coins that will cross each position of the player movement line at each future time (quantized into small bins), plus player position and velocity. You should be able to exploit and enforce translational symmetry along time and possibly space in network structure.
1

Share this post


Link to post
Share on other sites

@LorenzoGatti 
for the first point - answer is no. Coins are moving towards the direction of player and there is a vertical movement which will decide if a player will come in contact with the coin or not. 
 

for point 2  - easier decision is choosing which direction to move ? Would that be possible to design ? As am restricting directions to just up and down. (decision in my hands)

 

Point 3 - Tht looks like a gud suggestion too, but it looks like we are doing most of the work there :)

 

@IADaveMark 
Yes, I am attempting this project just to learn and get some practical experience on application of AI to Games. Am developing the game and trying to apply AI to the mainPlayer. ML approach need not necessarily be Neural Networks, but i thought its a decent choice. Correct me if am wrong there. 
 

Thanks 

0

Share this post


Link to post
Share on other sites
You are probably wrong about neural networks. Neural networks have very limited applicability to games. You can actually compute where you have at what times to be able to catch each of the incoming coins, and then use some sort of dynamic programming algorithm to make a plan that maximizes the number of coins caught.

Also, how is this an application to games? About the only point of game AI for is to produce a good gaming experience for the player. For games like go this probably means making the AI agent as good as possible at playing the game. The situation you describe doesn't seem to have a player at all, or you are putting some algorithm in the place of the player; it isn't entirely clear to me why you would want to do that.

Game AI is about how the bad guys behave (and the occasional computer-controlled allied too).
0

Share this post


Link to post
Share on other sites

Whilst I don't believe a Neural Network is appropriate for this, as Alvaro said, the applicability to games is limited and unnecessary when you can easily compute the correct answer, it can be done using a neural network.

 

Premise: A neural network usually has a fixed number of inputs. Since this game data in its raw form is variable, we need to do some pre-processing, sometimes called feature extraction. Pretend we are programming a neural network to identify letters in an image. The letter could be made from any number of pixels. To make the data fit the network we have to define features. A common one for this example would be dimension ratio. Letter height/width gives us a single value, and helps us identify the letter. A lower case 'o' for example would have a ratio of 1, where the letter 'l' may have a ratio of 2 as it's height is roughly double it's width.

 

You could use a similar system, one example feature could be the ratio of coins above the player to the ratio of coins below. Combine that with distance and direction of nearest coin, and you have a very simple network that will do what you ask. You could get more complex and calculate some fairly complex features, for example, total displacement to collect coins below against coins above.

 

To be honest the only reason I use neural networks for anything in games is personality. To change the behavior of a network, you simply load in a different set of weights and bam, you instantly have a more cautious/aggressive AI. But to sum up here is an example network for your game, it is very simple and could have many features added.

 

 

3 Inputs, 1 output

 

Input 1: Ratio of coins, number above/number below

Input 2: Distance player must travel to collect all coins above

Input 3: Distance player must travel to collect all coins below

Output 1: True means player travels down, false means player travels up

 

Hopefully something here will be helpful. In the above example, input 2 and 3 can be combined into a single input fairly easily. I think I would also have 2 outputs. This would allow you to pick a random direction when both outputs are false or true, to add some randomness to the AI.

Eg.

Output 1: True (Player should go up)

Output 2: True (Player should go down)    If you have a system like this, then you could pick randomly when ever the network produced conflicting results, for more precise play use a single output.

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