Game Programming and Development Tools

BlitzBasic AI help, plz – matthias

Matthias

Member

Posts: 23
From: Spencer, Iowa, USA
Registered: 07-28-2004
Hello

I'm trying to design a good game but I can't figure out a good way to get my AI's to go through mazes or anything like that. Does any one know a way to make a good obstacle avoiding AI?

PS. There is actually a section for this in the code database, but apparently no one has noticed it's there
I mean the thing is practically empty, save for a Blitz program for making a ball bounce in a curved path, which has an obsolete version still haging around, and some Algorithm which I'll look at shortly, among other things.

Main point being, with all respect, that we must be lazy or selfish or something... I personally am going to make it a goal to put some stuff up there soon for the good of us all.

[This message has been edited by matthias (edited November 03, 2004).]

[This message has been edited by matthias (edited November 03, 2004).]

CobraA1

Member

Posts: 926
From: MN
Registered: 02-19-2001
quote:
Main point being, with all respect, that we must be lazy or selfish or something... I personally am going to make it a goal to put some stuff up there soon for the good of us all.

Go ahead .

It's more we have real lives than laziness, though: Most people here don't actually look at the CCN forums too much. They're too busy raising families .

quote:
Does any one know a way to make a good obstacle avoiding AI?

Try A*.

------------------
Reasoning with non-believers without encouraging them to read the Bible, I have found, is quite useless. God's word convinces - not our own reason.
--CobraA1

Switch Mayhem now available! Get it here
Codename: Roler - Writing object code and GUI.

ArchAngel

Member

Posts: 3450
From: SV, CA, USA
Registered: 01-29-2002
quote:
Main point being, with all respect, that we must be lazy or selfish or something... I personally am going to make it a goal to put some stuff up there soon for the good of us all.

actually, we're really nice compared to alot of ppl out there. according to techie ettiquitte, when asking for help you have to be precise and list what you have done before expecting someone to help you. it's only polite. how can you expect someone to help you if they neither know what they want and you haven't even worked on it. as CobraA1 pointed out, we have lives...
but... I'm not accusing you of this, just throwing it up.

------------------
Soterion Studios

[This message has been edited by ArchAngel (edited November 05, 2004).]

CobraA1

Member

Posts: 926
From: MN
Registered: 02-19-2001
quote:
as Klumsy pointed out

LOL, you awake today?

------------------
Reasoning with non-believers without encouraging them to read the Bible, I have found, is quite useless. God's word convinces - not our own reason.
--CobraA1

Switch Mayhem now available! Get it here
Codename: Roler - Writing object code and GUI.

AmazingJas

Member

Posts: 437
From: Sydney, NSW, AUSTRALIA
Registered: 04-03-2003
The rolls royce method is certainly using the A* algorithm, though it's not the easiest thing to come to grips with, and it can be a CPU cycles hog if not implemented carefully. There is a couple of good tutorials on the topic at either the official blitz basic forums, or blitzcoder, sorry can't remember exactly where, you'll find it just as quickly as I could though.

Of course simpler problems can be solved in simpler methods. One poor man's version is simply to have an array set up for each cell in your map, and then create some code to work out which cell your character is about to step into. If the cell is tagged as an obstacle, than change the direction to left/right or whatever is closer to the target. Crude, but quick and dirty.

Matthias

Member

Posts: 23
From: Spencer, Iowa, USA
Registered: 07-28-2004
Yah, sorry guy, you're right. I don't get on CCN very much at all unless I have a problem... that's selfishness there. What does the Word say, "remove the plank form your own eye" or something. Okay, my bad.

AmazingJas, I have considered that actually, but it would likely make my ppl really dumb... I don't know, maybe I should try putting it to code and testing it out. But if a wall comes right between them and the obstacel they'd just run back and forth on the near side, right?

I was, with the help of a friend, making one that used mini-maps and line-drawing-distance-finder method (yup, it's a new one ) to decide which direction whould take him further towad the taget. Still by no means deadend proof and long and cviluted. (i knw that is speelt ronk... sry)

I'll check those sites though, thanks all!

AmazingJas

Member

Posts: 437
From: Sydney, NSW, AUSTRALIA
Registered: 04-03-2003
Depends on the complexity of the obstactles. The thing is, that even with algorithms like A*, you don't want to be mapping dead ends into your levels as then you'll require extra recursion (searching) in real-time which can slow you right down.

If you go to my website: www.spacialfx.com and download my Crazy Chicky game, you can see how well the simple approach works. It's a pacman-ish clone. The enemies don't start homing in until you get within a certain range, but I think it works pretty effectively.

ArchAngel

Member

Posts: 3450
From: SV, CA, USA
Registered: 01-29-2002
quote:
LOL, you awake today?

apparently not...
dang.. it sounded like you!

------------------
Soterion Studios