Monthly Archives: June 2009

AI GAME PROG โ€“ PART 3: CONTESTS


If a proper logic has been devised the next part is to code and test the player.

These two steps have very little to say as it entirely depends on the coding style of individuals.

So in this part I would like to give a general summary of how to participate in an AIP contest….

So here it is…

1. Read the problem statement. Most of the contest organisers wrap a simple concept around a big theme to make it look complex. Try understanding the basic meaning of the statement

2.Download the API provided and try running it on your system using the documentation provided.

3.Frame a problem statement of your own that is very simple. It should just contain the basic information obtained from step1. It need not necessarily be a single sentence.

4.Use this problem statement to understand the game and imagine some possible scenarios in the game.

5. Try to identify the pros and cons for the player due to loopholes in the statement.

6. Now identify scenarios which would make the player be in such advantageous states of the game.(S-E-E logic)

7. Design an offensive logic that will make the player reach such advantageous states.

8.Then identify scenarios which would make the player be in such disadvantageous states of the game.(S-I-P logic)

9. Design an defensive logic that will prevent the player reach such disadvantageous states.

10.Merge both. Take care of the influence of external elements that arise in the game(problem statement).

11. Now adapt the code according the format given in the statement.

(Usually you need to put the entire player logic inside a function with predefined name<given in statement> and return something out of the logic code )

12. Some contests hold testing sessions where you can just submit coding in parts and check its functions for faults.(humans are bound to make mistakes!!!!)
Participate in such sessions to test your players and make final changes.

13. Submit the code after testing phase

14.(lol… ) wait for the result!!!! ๐Ÿ™‚

Hope using these simple steps you find it easy to participate in AIPs and have fun!

cheers
Vidhoonv

AI GAME PROG โ€“ PART 2: LOGIC DESIGN


Took sometime to write content on Logic design .. sorryz for the delay!!!

LOGIC DESiGN

Just try answering these questions:

When you fight your opponent
1.can you win if you can’t find his weakpoints?
2.can you win if he blocks all your punches?
3.can you win if he is stronger(intelligent)?

Obvious the answer is NO. (if you had ever fought … lol)

Likewise the player you build should sustain the opponent. For this me make the player “intelligent”. Intelligence for a player is nothing complicated as it sounds…. it is pretty simple friends.

then

what is the so called intelligence?
“Intelligence” in this context means the logic the player uses to play the game.

I guess “Logic” is to small a word to clear all clouds in your mind. So lets just have a small explanation…

Logic that should be used to code the player has to follow this hierarchy:
1. It should make the player follow rules of the game
2.It should make the player act positively in the environment(by “negative” i mean some stupid techniques like keeping the player idle)
3. It should identify the nature of the opponent before taking up an attacking strategy.

here are some tips to be followed to design a good logic:

1.analyse the game rules. Most of the rules will have clear advantages on certain scenarios and obvious disadvantages on some scenarios. So, the logic designed must try to make the player reach such advantageous scenarios of game.

2.identify what are the possible attacking and defensive strategies for a player in the game.

3. Analyse the coding techniques of the identified strategies and find the most SIMPLE, EASY, EFFECTIVE one. (keep it as “S-E-E logic”)

4. In most games the logic identified will be vulnerable. So first identify all such possible vulnerable scenarios.

5.The best way to protect the player is by coding a defence logic for all the vulnerable scenarios identified. Imagine the most stable, intelligent, possible player and design defensive logic.(“S-I-P logic”)

6.So with both offensive and defensive logic in hand find the effects of external elements on the player built on this logic.

7.Mostly external effects are probabilistic and so possibly both the positive and negative effects can only be taken care of to certain extent. So, just try giving a final touch based on these elements.

Thats it! You will end up with one of the powerful logic possible to play the game.

Hope you got an idea on logic design and elements of consideration to design a good logic.

cheers

Vidhoonv

AI GAME PROG – PART 1 : An Introduction


After some homework here is my first post on “AI” and “AI game programming“…

Try answering these questions before you read:


1.Do you still find comic books and video games interesting after coming to coll?

2. Are you sick of programming to solve puzzles and problems?

3. Are you interested in gaming and game prog?

4.Do you prefer winning a friend in comp game than arm wrestling?

5.Do you read ย any shit found anywher on earth?

If the answer is Yes for any one of the above questions then, am certain that AI programming will evoke interest in you….

In the larger sense the word ‘AI’ has lots of dimensions. But since we are people who love having fun all time in life.. Lets consider only some parts of AI that will make us realise our “life is to have fun” philosophy….

Yes! you got it!!! lets look into “AI game programming“.

What is Artificial Intelligence?
It is the science and engineering of making intelligent machines, especially intelligent computer programs.

Please note down the last three words INTELLIGENT-COMPUTER-PROGRAMS ….

This is what all AI is about… Intelligence.. To include this element in machines or the instructions that drive them..

AI in Game programming????For all beginners… A game consists of the following:

1.an API – that provides the environment(main program)
2.players– that play in the provided environment(functions that implement player behaviour)

3.external elements – that affect the players’ potential

1 and 2 are compulsory where as 3 is optional

Lets take an example:
This was the game implemented for Abacus ’09 AI programming contest …

“Two snakes in space(with bounds) should pick up food for points and should not crash with opponent or boundaries”

So now lets point out various entities of AIP(AI prog) in this example:

1.API – the program that runs the player functions and shows result to players

2.players- the program that defines the logic used for the player to pick food and move without crashing

3.external elements- food and bounds of space are the external elements that affect the game

Among these three elements the “PLAYER” element will only be coded by us(if you are interested in playing the game …lol)

So keep it like this:

Coding the player component is known as AI game programming… !!

Hope you got an idea of what a game API is and what is supposed to be done in AIGP…

(please be patient .. part 2 is being prepared!!)

Cheers

Vidhoonv