přihlášení / registrace
Česky English

Java sources of
Programming Game AI by Example

About

Programming Game AI by Example is a book written by Mat Buckland.
(September 30, 2004 | ISBN-10: 1556220782 | ISBN-13: 978-1556220784 | Edition: 1)
It is a good book about artificial intelligence in games. Very good for beginners.

But its example sources are written in C++, use Windows libraries and are designed for Visual Studio 2006 and VS 2008. It was very complicated for me to force them to compile in VS 2010 (Express edition). I had to repair some source code, set up VS 2010 (set include and library directories), download and compile new version of luabind etc.
At the end I succeded to setup it – but it is impossible to do it under Linux!

And because I prefere Linux to Windows (no surprise, right?) and Java to C++, I decided to rewrite all examples from C++ to Java. Other reason to do it was that It helped me to practice Java (I am new in Java programming) and it also helped me to understand better all the examples from the book.

Now I decided to provide all my Java source to the world. I hope it could help other people struggling with the C++ source, and Linux (or MAC) users. I also hope to becomme famous all over the world, so don't forget to like my facebook page (a way how you can say thank you :-).

Example

Java applet SimpleSoccer

Updates

Chapters

  1. All chapters (3.8 MiB, ZIP)
    This includes all chapters listed below (as NetBeans projects).
    You don't need to download anything else.
  2. Chapter 2 State Machines (203 KiB, ZIP)
    First project in the book. I have rewritten only those parts of the source code, witch I have to. In every other chapter there is rewritten more code from the "common" directory. There might be some differences between "common" packages in the others chapters (the newer the better).
    Remember, that i tried to write the code as similar to the original C++ source as possible. Therefore I used a lot of "import static" and other weird concepts, witch are not a "good Java practise".
  3. Chapter 3 Steering Behaviors (86 KiB, ZIP)
    Code for individual and group movement including the behaviors of seek, flee, arrive, pursuit, wander, evade, obstacle avoidance, wall avoidance etc.
  4. Chapter 4 Simple Soccer (113 KiB, ZIP)
    Implementation of a simple but entertaining artificial intelligence for a team based sports game.
  5. Chapter 5 Pathfinder (98 KiB, ZIP)
    Code of graph node class, graph edge class, graph class, depth first search, breadth first search, edge relaxation, shortest path trees, Dijkstra's search and A*.
  6. Chapter 6 Scripting Source (2.2 MiB, ZIP)
    This chapter is about using lua language with C and C++ source. It describes lua and luabind. But in Java, there are different projects providing lua support. I decided to use LuaJ.
    I managed to rewrite all examples without the need of changing any lua script, but I had to write help lua scripts imitating luabind behavior.
  7. Chapter 7 – 10 Raven (1.1 MiB, ZIP)
    This last 3 chapters sum all knowledge acquired before and add more (for example path planer, goal arbitration or fuzzy logic).
  8. Python code for Blender 3D.
    Bonus: A ported AI code from Programming Game AI By Example Cap.3 'How to Create Autonomously Moving Game Agents' to Python (Blender Game Engine) by Nakasya Masuta.

Subscribe

Subscribe, if you want to be notified about all updates:

:   5 + 5 = (antispam check)

References

Bug report
reklama

Společnost CDI.CZ
hledá nové PHP programátory.

Požadavky:

  • Zkušenosti s PHP
  • Znalost OOP
  • Zkušenosti s návrhem databáze (MySQL)
  • Znalost problematiky webových aplikací

Strukturovaný životopis můžete zasílat na petr@cdi.cz.

Experimentální nastavení barev:
COLOR
GS
LB
RC
BG
Tato stánka používá ke svému běhu cookies, díky kterým je možné monitorovat, co tu provádíte (ne že bych to bez cookies nezvládl). Také vás tu bude špehovat google analytics. Jestli si myslíte, že je to problém, vypněte si cookies ve vašem prohlížeči, nebo odejděte a už se nevracejte :-). Chci se dozvědět více.