Page 1 of 1

guideline to game/AI construction

PostPosted: Mon Jun 30, 2008 6:32 am
by Thanx
Nowadays game creation is made simpler and simpler by every release of a newer and hopefully better game authoring software. But there are still some parts of a game that not even the best game authoring software, like GE can make easier.
These are marked in the title, and these are what I'd like to help you, as reader to understand a little more...

Part 1 - guideline on game idea(s)
(see part 2 in the next post)

Before you open GE, GM or any other program, you open it with an idea. It may be only a spark, or it may be a complex city in your mind. We all have game ideas. But how well are they thought over? We can all say, well this is what I want, it'll be cool anyway! But it never is bad to think again.
A game is a game because it presents a challenge. This challenge exists because the game has a goal set for you to achieve. If the game is "goalles", then it isn't a real game. Your game might have several goals. These more complex games need more thinking over, I'll explain later. The most complex games can also give one more thing. This makes a bigger challenge - better game. This is if you add a restriction. A restriction is something you tell the player(s) not to do.
Another thing that's vital to a game, is two sides, players, characters, teams, armies, etc. that oppose eachother. Cause a challenge is not a challenge if it is simple to achieve. Even with restrictions, a game has hardly a challenge without additional opponents that are there to bug you, constantly make you hurry.

If you've got these for a game, then the battle is half won! If something was missing from the above, then you might need to rethink something. But don't be affraid. If something is different in your idea, it doesn't mean it's bad. Afterall, that's what gives variety to the gaming world; there are more new ideas. But the above you should consider the definition of a challenge. It is challenge that is important.
Now, if our idea has passed the above, then we go on: A goal most have complications if your game has only 1 goal. This might be some of the above, but if your idea excludes those things, then try and think of a complication, if you don't have one yet. This will make your game spicy. If your game idea already has a restriction. or multiple goals, then complications aren't mandatory, but you can still include that too.
If you have multiple goals, or also restrictions, think them over. Do they connect somehow? This is more interesting when you have an RPG in mind. Do the characters's goals somehow complicate eachother, or will one goal somehow unlock the other? That's what you have to think over. Even if they don't do what I just mentioned, the point is, they have a logical connection, otherwise, the game might get too wide, maybe less understandable for the player.

So now, that we've gone through the game idea, making sure now, that we've got what a game idea needs, the game still needs things. If the idea included such things as characters, then the characters must be detailed. The game plays somewhere, so you must think of scenes/levels; it'd be nice to have a story too. Character detailing, scene planning is 100% based on imagination with our idea. If planning the scene you come to another addition to the idea, then don't be affraid to add the idea. When planning, and in the imagining mode, that's when you can make up nice ideas!
The story also needs only some imagination, but the story is only a story to your game, if it somehow touches the goal, complications, enemies, etc. in oher words, introduces you to the game.
Now the order I wrote through these last things shouldn't be the order you think them through. Things can always be added to everything, but things are based on another. If your game will have more emphasis on gameplay/action, probably character and scene comes first, then the story. If your game might not be too action-packed: making up a grabbing, jolly good story should come first, so that the player gets fired up for the game, and looks at the game from the perspective it gets exciting from. Then based on how the game is structered (wether the game is more based on its levels or its characters) you think over the characters and scenes...

That's pretty much it for game ideas! The reason we talked about them first, is because an AI is 100% based on these, and you need to understand your game before you understand your AI.
See next post for the AI

Re: guideline to game/AI construction

PostPosted: Mon Jun 30, 2008 7:14 am
by Thanx
Part 2 - guideline on AI construction

After the game idea is done, we make the game, and all what it needs. this is where GE gives help, so I wont talk about that. But in most game authoring software you cannot make the computer enemies without coding. This is probably the hardest part of the game, and the part most people ask for help on...
If you haven't rethought your game, marking in your mind what the goal, restriction, etc. is, then do it now, without knowing those, the AI's a rough pain in the stomach, head, and those typing fingers....
There are 2 types of AI, as there are in a way, 2 types of enemies in your game. First type - the more complicated AI, is where the computer enemy has to do what you, as human player has to. Therefore the Artificial Intelligence - as its name suggests, will have to copy your intelligence to compete with you. Second type - most of the times this should be easier, is when the enemies have a different goal than you, mostly to stop you reaching your goal. Then it's the enemies restriction, to loose, or give what you need.
Making up what you need is quite simple. Usually the shooter and fighter games need the simpler type 2. Think of Winter Blast. Usually a strategy game needs the more complicated AI type 1. If you're curious about how to make type 2, then you might want to jump this next part...

Creating AI type 1
Let's get through the hard part! Now- I will not be giving code examples, because as many games there are, that's how many code examples that can be made up. I'll be helping you in structuring your AI, based on the structure of your game.
Now, in strategy games, most of all, the enemy has the same goal as you, if not maybe type 2 is better for you, but if you're not sure, just read through. Let me introduce you to the simplest way of making this: The AI should have be able to know a set of goals it sets. Like upgrading itself, or taking over board spaces, or maybe weakening the enemy. These can be subgoals, that help achieve the actual goal of the AI. Then here's the trick: The AI must be able to tell which is more important at the moment. IIf you need only a dumb AI, just simply give subgoal a priority based on a simple condition, and then have the AI do what must be needed to be done based on which priority wins. If somehow you end up with equal priorites (which I recommend you try to avoid), then probably it'd be better to use a rand function to flip the coin.
Now if you don't want a dumb AI then go over what the goal, restriction and other things are. The basis is still the same, setting priorities, but in a different way. You must have the AI check all conditions that it knows, and then compares the conditions to see which is better for different things. Again, it might happen, that a condition is equally good for 2 different actions; try to avoid that, but then, eiher deside priority on another condition, or use the good ol' rand function...
Also make sure that both AIs recognise the restrictions, and that if they bump into one of your restrictions then program the AI to know what it should do in this case. Wether that's givingup the way it's going, or bridging over the problem that depends completely on how you want the game to play. These are the most important parts of an AI, think these over, deside on a programming technic that will best suit your AI needs, and then: program. Good Luck! :wink:

Creating AI type 2
This will be a bit easier, but if the game is that complex, this might get just as hard... The AI still has a goal, probably the destruction of the "alien lifeform", which is eventually you. Now the computer might have its own difficulties killing you.
If you made a good scene, then there'll be barriers of some form. The AI must recognise these. It must know how to go around the barrier, if it can. Usually there's a distance at which the enemy sees you, that's what should activate the AI, otherwise, make a simple path or something that the AI will do. Cause maybe the player will already see the enemy for a while, when the enemy doesn't see the player, and the player will see a still character...
Before the AI attacks, it'll need to know where you are exactly. Then find the way to you, excluding ways that bump into a barrier. If it has found the way, then it starts going after you. The AI should upgrade its path once in a while, cause you can't expect the player to just stand there and die for you. Now we always like adding special things, like special attacks, well that's not that hard. Make the AI see when it has gotten in range, and then have it choose, based on its own condition (or also on the player's condition, if it knows his too), and then strikes the way it should in that condition.
Now that's pretty much it. Maybe you want the AI to return to its original position when its job was finished. Just set the spot, find shortest way, and that's it.

If your AI wasn't supposed to kill the "alien lifeform", then it should have at least some goal, otherwise it isn't an AI.
Usually these are what an AI is built on. It first needs to find out what it needs to do. Either on priorities, or maybe it will ony do one thing. The next step is to find out how it can do it. Here's where the AI takes the conditions sorrounding it, and then the AI, using the conditions for calculating, will find out what's the best action for him. Also using the conditions it calculates HOW it can do what it wants, and then "executes" the task.

I hope this was helpful for someone out there! If you have questions, just ask! :) :wink: