Basic AI Demo (Now Open Source)
-
- Halfling
- Posts: 76
- Joined: Tue Dec 19, 2006 12:19 am
- x 8
Basic AI Demo (Now Open Source)
Hi guys, i started developing this 3rd person ai demo to see if i could build a near-complete ai system for a game. Unfortunately it was difficult for me to code such challenging things after 9 hours of work time. With the inability to find some visuals for the demo i lost my appetite and quit after a few weeks. Here you can see what i ve done so far.
Ogre, Physx and OpenAL is used.
Navigation system uses Recast
Steering and decision systems are hand written.
Although the decision system is mature enough(a hierarchical state machine with priorities) the states of the agents are purely written so they do not seem that intelligent.
The agents try to get behind the walls to get cover when they see an enemy. For this i used the sensor grid algorithm which you can read in the ai wisdom 3 book.
With the help of some good looking animations and more detailed agent logic it could be a much more better one.
Download : zzz.rar
Source Code : zzz_source.rar
Short Video : http://www.vimeo.com/12833880
[vimeo]12833880[/vimeo]
Ogre, Physx and OpenAL is used.
Navigation system uses Recast
Steering and decision systems are hand written.
Although the decision system is mature enough(a hierarchical state machine with priorities) the states of the agents are purely written so they do not seem that intelligent.
The agents try to get behind the walls to get cover when they see an enemy. For this i used the sensor grid algorithm which you can read in the ai wisdom 3 book.
With the help of some good looking animations and more detailed agent logic it could be a much more better one.
Download : zzz.rar
Source Code : zzz_source.rar
Short Video : http://www.vimeo.com/12833880
[vimeo]12833880[/vimeo]
Last edited by DarkScythe on Sat Mar 10, 2012 7:08 pm, edited 4 times in total.
-
- Greenskin
- Posts: 120
- Joined: Thu Sep 20, 2007 10:13 am
Re: Basic AI Demo
This looks really cool. Why not make a thread at a few artists forums, show off whats done, list what you need, and take a break for a bit?
-
- Gnome
- Posts: 334
- Joined: Thu Jun 28, 2007 2:12 pm
- Location: Brazil
- x 5
- Contact:
Re: Basic AI Demo
do you plan to release the code? would be really useful for us that are making first/third person shooters too. for example id love to know how you made the enemy aiming system, it looks very similar to how a human does.
congrats!
congrats!
-
- Halfling
- Posts: 76
- Joined: Tue Dec 19, 2006 12:19 am
- x 8
Re: Basic AI Demo
Sorry my source code is too messy to be open sourced but i can share any knowledge i have.
My aimig system is not actually a system but a few lines of randomiser code It is simple but it does the job for me.
You can tweak the numbers to get better/worse aiming for certain postures like crouching or running.
My aimig system is not actually a system but a few lines of randomiser code It is simple but it does the job for me.
You can tweak the numbers to get better/worse aiming for certain postures like crouching or running.
Code: Select all
Vector3 closest = agent->getKnowledge()->getEnemy(id).GetPosition();
float coeff = agent->GetPosition().distance(closest) / agent->getAttackRange();
Vector3 target = closest;
target.x += coeff * Math::RangeRandom(-1.0 , 1.0);
target.y += coeff * Math::RangeRandom(-0.125*agent->getEyePos().y, 1.50*agent->getEyePos().y);
target.z += coeff * Math::RangeRandom(-1.0 , 0.0);
agent->Shoot(target);
- SimNation
- Halfling
- Posts: 67
- Joined: Sun Dec 13, 2009 12:39 pm
- Location: Paraíba, Brasil
- Contact:
Re: Basic AI Demo
Hey dude, congratulations for you job. I still believe that a messy code is better than no code at all Think about it.
"Thus without desire you can see its marvels, with desire you can only see its surface". - Dao De Jing
-
- Gnoblar
- Posts: 18
- Joined: Tue Jun 29, 2010 4:28 pm
- x 5
Re: Basic AI Demo
OMG, this is exactly what I am looking for!
Is there any way to, you know, share your code?
I would like to see your camera colission avoidance implementation as well as your project structure.
"Hide", "Seek" and "Attack" is perfect for my game, and you already did this.
Congrats!
Is there any way to, you know, share your code?
I would like to see your camera colission avoidance implementation as well as your project structure.
"Hide", "Seek" and "Attack" is perfect for my game, and you already did this.
Congrats!
-
- Halfling
- Posts: 76
- Joined: Tue Dec 19, 2006 12:19 am
- x 8
Re: Basic AI Demo (Now Open Source)
Ok i opened the source with mit license.
There are minimal comments so it is probably that you will have difficulty understanding the code.
Feel free to ask anything.
There are minimal comments so it is probably that you will have difficulty understanding the code.
Feel free to ask anything.
-
- Halfling
- Posts: 60
- Joined: Fri Dec 25, 2009 3:31 pm
Re: Basic AI Demo (Now Open Source)
Excellent, Thanks for releasing the source. I will try to integrate the ai part with mine.
-
- Greenskin
- Posts: 100
- Joined: Mon Aug 30, 2010 9:35 am
- x 11
Re: Basic AI Demo (Now Open Source)
Thanks! I'm programming my own Ogre AI engine and my pathfinding system works very badly So I'll use your example code I also want to make my Ogre AI engine free and open-source because I haven't ever seen any example of AI in Ogre!
-
- Gnoblar
- Posts: 3
- Joined: Fri Jun 04, 2010 8:32 pm
Re: Basic AI Demo (Now Open Source)
Excellent! But I have problem with this application on vista. After running application i see error "APPCRASH". Any ideas?
I'm polish so errors are in Polish too.
Error:
Nazwa zdarzenia problemu: APPCRASH
Nazwa aplikacji: whatever.exe
Wersja aplikacji: 0.0.0.0
Sygnatura czasowa aplikacji: 4c225adf
Nazwa modułu z błędem: whatever.exe
Wersja modułu z błędem: 0.0.0.0
Sygnatura czasowa modułu z błędem: 4c225adf
Kod wyjątku: c0000005
Przesunięcie wyjątku: 0002f024
Wersja systemu operacyjnego: 6.0.6001.2.1.0.768.3
Identyfikator ustawień regionalnych: 1045
Dodatkowe informacje 1: fd00
Dodatkowe informacje 2: ea6f5fe8924aaa756324d57f87834160
Dodatkowe informacje 3: fd00
Dodatkowe informacje 4: ea6f5fe8924aaa756324d57f87834160
I'm polish so errors are in Polish too.
Error:
Nazwa zdarzenia problemu: APPCRASH
Nazwa aplikacji: whatever.exe
Wersja aplikacji: 0.0.0.0
Sygnatura czasowa aplikacji: 4c225adf
Nazwa modułu z błędem: whatever.exe
Wersja modułu z błędem: 0.0.0.0
Sygnatura czasowa modułu z błędem: 4c225adf
Kod wyjątku: c0000005
Przesunięcie wyjątku: 0002f024
Wersja systemu operacyjnego: 6.0.6001.2.1.0.768.3
Identyfikator ustawień regionalnych: 1045
Dodatkowe informacje 1: fd00
Dodatkowe informacje 2: ea6f5fe8924aaa756324d57f87834160
Dodatkowe informacje 3: fd00
Dodatkowe informacje 4: ea6f5fe8924aaa756324d57f87834160
- chaosavy
- Silver Sponsor
- Posts: 578
- Joined: Mon Jun 15, 2009 8:29 pm
- x 64
- Contact:
Re: Basic AI Demo (Now Open Source)
Nothing in the error message seems to point towards the problem. I'm Polish too (been living in America longer though). Check your Ogre.log file (it should be in the working directory debut\ or release\) and hopefuly it will give you more leads.
Visit http://www.VoidDestroyer.com to check out my space sim project - Void Destroyer
-
- Gnoblar
- Posts: 3
- Joined: Fri Jun 04, 2010 8:32 pm
Re: Basic AI Demo (Now Open Source)
This is OGRE log(attachment)
- Attachments
-
- Ogre.log
- (23.11 KiB) Downloaded 2627 times
-
- Gnome
- Posts: 334
- Joined: Thu Jun 28, 2007 2:12 pm
- Location: Brazil
- x 5
- Contact:
Re: Basic AI Demo (Now Open Source)
this will be very useful for my engine which is using recast too ;D
i have named your engine as zzzEngine =P
thanks
i have named your engine as zzzEngine =P
thanks
- mkultra333
- Gold Sponsor
- Posts: 1894
- Joined: Sun Mar 08, 2009 5:25 am
- x 114
Re: Basic AI Demo (Now Open Source)
Only just found this, looks pretty interesting. I'm trying to find a basic game engine that actually does stuff instead of just being incomprehensibly abstract, and it looks like you've got a lot going here. I'm working on getting it to compile, since it uses a lot of stuff like MyGui that I don't have. If it works I think it might be more useful that you give it credit.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
-
- Halfling
- Posts: 76
- Joined: Tue Dec 19, 2006 12:19 am
- x 8
Re: Basic AI Demo (Now Open Source)
You can just completely remove MyGui since it was like a place holder in this project.
Thanks for all the feedback.
Thanks for all the feedback.
-
- Gnoblar
- Posts: 2
- Joined: Sat Nov 20, 2010 9:24 pm
Re: Basic AI Demo (Now Open Source)
Let me start by saying great work, I love it
I managed to get it to compile by ripping out ParticleUniverse and MyGUI. It also now starts and loads, however all the players/AI seem to fall through the floor and continue falling... like there's no collision detection...
Any idea on how to fix this? I didn't remove nVidia PhysX and when I try to walk into other players I can't so obviously there is some collision detection but no collision detection with the floor.. bit strange
EDIT: If it makes any difference I'm using v2.8.3 of the nVidia PhysX SDK. Also for some reason when I die I float upwards towards the floor of the scenery.
I managed to get it to compile by ripping out ParticleUniverse and MyGUI. It also now starts and loads, however all the players/AI seem to fall through the floor and continue falling... like there's no collision detection...
Any idea on how to fix this? I didn't remove nVidia PhysX and when I try to walk into other players I can't so obviously there is some collision detection but no collision detection with the floor.. bit strange
EDIT: If it makes any difference I'm using v2.8.3 of the nVidia PhysX SDK. Also for some reason when I die I float upwards towards the floor of the scenery.
-
- Halfling
- Posts: 76
- Joined: Tue Dec 19, 2006 12:19 am
- x 8
Re: Basic AI Demo (Now Open Source)
Sounds like a physx problem(i also used 2.8.3). The level is a triangle mesh shape and all characters have a character controller so they should collide. Be sure to have the latest physx system software.
Also you can try to add some boxes(commented out at the end of Level constructor) to see if they also fall through the ground.
Basically the ai system is not bounded to physx but it is used in various places like projectiles, camera collision, player-level collision etc. so it will need some more effort to make it work without physx.
Also you can try to add some boxes(commented out at the end of Level constructor) to see if they also fall through the ground.
Basically the ai system is not bounded to physx but it is used in various places like projectiles, camera collision, player-level collision etc. so it will need some more effort to make it work without physx.
-
- Gnoblar
- Posts: 2
- Joined: Sat Nov 20, 2010 9:24 pm
Re: Basic AI Demo (Now Open Source)
The boxes also fall down.. it's strange. Your precompiled executable works just fine, but my compiled one still seems to have collision problems. I ripped out Guisystem, ParticleManager.
Also my Menustate looks like this
Also you have put in Application.cpp:
//PS->Initialize();//do it in states
I couldn't find it in the states so I uncommented it because I thought perhaps it wasn't initializing but I get this error when starting the application:
OGRE EXCEPTION(4:ItemIdentityException): An object of type 'ManualObject' with name 'mVisualDebugger' already exsists. in SceneManager::createMovableObject at ..\..\..\..\OgreMain\src\OgreSceneManager.cpp (line 6484)
Also my Menustate looks like this
Code: Select all
void MenuState::Initialize()
{
//UISYS->LoadLayout("main");
//UISYS->SetCursor(true);
//UISYS->SetCrossHair(false);
//button callbacks
//MyGUI::ButtonPtr btnPlay = UISYS->GetGUI()->findWidget<MyGUI::Button>("btnPlay");
//MyGUI::ButtonPtr btnExit = UISYS->GetGUI()->findWidget<MyGUI::Button>("btnExit");
//btnPlay->eventMouseButtonClick = MyGUI::newDelegate(this, &MenuState::OnPlay);
//btnExit->eventMouseButtonClick = MyGUI::newDelegate(this, &MenuState::OnExit);
SSYS->LoadState("game");
}
//PS->Initialize();//do it in states
I couldn't find it in the states so I uncommented it because I thought perhaps it wasn't initializing but I get this error when starting the application:
OGRE EXCEPTION(4:ItemIdentityException): An object of type 'ManualObject' with name 'mVisualDebugger' already exsists. in SceneManager::createMovableObject at ..\..\..\..\OgreMain\src\OgreSceneManager.cpp (line 6484)
-
- Gnoblar
- Posts: 12
- Joined: Wed Oct 10, 2007 1:52 am
Re: Basic AI Demo (Now Open Source)
the source code link is broken,would you give a new source code link for download?
-
- Halfling
- Posts: 76
- Joined: Tue Dec 19, 2006 12:19 am
- x 8
Re: Basic AI Demo (Now Open Source)
It works for me, can you check it again?
-
- Kobold
- Posts: 25
- Joined: Tue Feb 19, 2008 1:55 pm
Re: Basic AI Demo (Now Open Source)
your code its ai junkie style! good work
I am development a similar ai system but more advanced for project final in university.
I am development a similar ai system but more advanced for project final in university.
-
- Gnoblar
- Posts: 12
- Joined: Wed Oct 10, 2007 1:52 am
Re: Basic AI Demo (Now Open Source)
I try many times, but can't download.DarkScythe wrote:It works for me, can you check it again?
Could you send "zzz_source.rar" to me? My E-mail address is Thanks !
Last edited by jacmoe on Mon Feb 07, 2011 5:03 am, edited 2 times in total.
Reason: Removed email address - use the email button. :)
Reason: Removed email address - use the email button. :)
-
- Gnoblar
- Posts: 10
- Joined: Sat Oct 09, 2010 9:24 pm
Re: Basic AI Demo (Now Open Source)
I'm having the same problem as madik, my Ogre.log shows no clue about what could be the problem.
It works perfectly on my PC, but it crashes on my laptop. Same OS on both: Win7.
It works perfectly on my PC, but it crashes on my laptop. Same OS on both: Win7.
- Attachments
-
- Ogre.log
- (23.11 KiB) Downloaded 228 times
-
- Gnoblar
- Posts: 1
- Joined: Sat Nov 28, 2009 2:13 am
Re: Basic AI Demo (Now Open Source)
Hi - I have the same problem! When you compile the debug version of the program runs without problrmu. However, after compiling the release version of the program throws me APPCRASH. If you have solved this problem, please advice.
-
- Halfling
- Posts: 56
- Joined: Thu Nov 19, 2009 9:39 am
- x 12
Re: Basic AI Demo (Now Open Source)
Hi; me and mironix are working on fixing this (altough we abandonned physx because of the not possibility to use it properly in multiplatform -macos physx do not have gpu support..-) and i will releaase a fixed & compiled version working toward ogre 1.7.2 (it might not use sounds anymore altough)
i'll update this post soon.
i'll update this post soon.