Sign in to follow this  
Andrew2110

ChuChu Rocket AI Help

Recommended Posts

Andrew2110    122
Hey Guys, I'm making a ChuChu rocket style game for a bit of fun (Gameplay video: http://www.youtube.com/watch?v=WHBsA-PZXiA). Whilst it would be easier to make it a multiplayer only - I'd like to add some AI to the game. The rules for the game are as follows: - 4 players - Each player has a 'hole' in which to direct their mice. - Mice come out from 'spawners' in a north / south / east / westerly direction. - Users place arrows to direct mice towards their hole. My thought for how to do this so far (I've cut myself off half way through, because I believe there must be a more graceful solution possible than this really messy solution?) - Set AI Players 'home' (place where they want to target mice) as 'MyHouse' - Make and sort an array of 'spawners' in order of distance to 'MyHouse'. Save array as 'SpawnerArray'. - For every element i in 'SpawnerArray' do: - Traverse from the direction of spawn until obstacle hit - Is obstacle hit == MyHouse - do nothing for this spawner and continue in for loop - Else Is obstacle hit a wall? - If yes - traverse along route travelled, is there a single arrow that could be placed to direct mice to my house? - If yes - Do I have this kind of arrow available to me? - If yes - place arrow, break out of routine. - If no (not a wall), is this another players arrow? ... Any advice to this would be greatly appreciated.

Share this post


Link to post
Share on other sites
Emergent    982
In what follows I'll ignore competition and just try to place arrows that direct all mice to your "mouse hole."

First I'll consider the single-spawn-point version:

Perhaps view this as a graph search, where each search node is a mouse path. Then, placing an arrow in the path will change it into another path... so the edges of the graph correspond to single arrow placements in the path. Now, there is a subset of paths that end in your "mouse hole." You just need to find the shortest path in this graph of mouse paths that gets you to one of these. If you can come up with a nice heuristic, then you can solve this with A*.

Next, the multiple-spawn-point version:

Now each search node is not a path, but rather a directed graph (a path being a special case of this). Your goal set for your search is the set of trees rooted at your "mouse hole."

The only question is whether such an approach could be made fast enough.

Others may have more clever solutions.

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