My first attempt at AI

posted in Beals Software
Published July 04, 2005
Advertisement
Wow, I went to PlanetSourceCode.com and found some of my old code, including my first attempt at AI. It was done two years ago, so I don't think its so bad (especially since I've never read any articles or actually tried to learn AI.)

Here's a link (7/13/05 doesn't work)

I just want to point out that this is old code and uses coding techniques and naming conventions that I DO NOT. I have greatly improved both since I uploaded this code to PSC (2/16/2003).

Any comments other than about the coding and naming, please go ahead and post them.
Previous Entry Source Code
0 likes 6 comments

Comments

Rob Loach
haha, PlanetSourceCode was halarious. I used it for everything about four years ago. When I decided to finish up with Visual Basic and move onto C++, I put up some of my stuff: for shame!
July 04, 2005 09:23 AM
NickGeorgia
Nice state machine ya going there :)

Rob, that is a sweet tutorial on DLLs.
July 04, 2005 02:03 PM
The Forgotten Mindset
Hey, Programmer16 I didn't know you had a journal :)

Good luck with your library, I'm doing kinda the same thing too.
July 05, 2005 09:38 AM
Programmer16
Hey Mindset! I just started it (actually, after reading yours :D)
July 05, 2005 11:14 AM
Rob Loach
I think you're missing the point of a state machine. You use them so you don't have that use hugely ugly case statement. You pretty much have a base class named State (or something like that) and have all states that you plan on having derived from this base state class. Therefore when you do an update all you do is call CurrentState->SomeFunction and it manages calling the correct function for you instead of having to do something like:
switch(*Dtrmnr)	
	{
	case Hungry:
		{
                ....

July 05, 2005 12:59 PM
Programmer16
Yeah, this was when I was just starting though. I've got a class based state machine that I use now (maybe I'll update the code using my new state machine. Maybe add a few states... hmm gives me something to do.)
July 05, 2005 02:20 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement