Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / AI Demo: Fast, Smart, and No Math (well, very little math)!

Author
Message
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 30th Jan 2005 15:19
Features:
-Uses an AI object instead of complex 3d math
-Fast, adjustable, and accurate Matrix/Object Sliding/Collision system that includes gravity (well, not gravity per-se, but it keeps things on the ground)
-Predictive evasion AI that doesn't get "dumb" and stuck in a corner or cul-de-sac (though it can be "cornered" eventually)
-Chase AI is screen driven, just a like a real player (well, in theory at least).
-Chase camera object uses same AI functions
-Chase AI doesn't get "stuck" behind objects or in cul-de-sacs
-Frames per second @ about 166 (on my pc)

Instructions: the first run through, the AI controls the player. The AI can capture all five balls in about 2 minutes (ompc). After the AI is done, you can choose to play or let the AI go again. Use the left and right arrow keys to turn left and right. The player always is moving forward.

Game mechanics: The evaders (spheres) have a movement advantage over the player to make up for the cornering advantage the player has. The evaders move slightly faster (20%) and have unlimited turning radii. The player's turning is restricted.

I would appreciate feedback on this one. I am planning to fine-tune the AI to improve frame-rates and decision making.

Thank you - I hope you enjoy.

PS. Having trouble posting. I'll post the media file shortly.



"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 31st Jan 2005 00:38
Here's the media files

[href]http://home.earthlink.net/~plewis118/MyGames/Maze AI Media.zip[/href]

(guess this forum won't let me upload media files?)

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
TEH_CODERER
21
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 31st Jan 2005 02:54 Edited at: 2nd Feb 2005 04:50
Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 31st Jan 2005 03:38
Very, very nice. Best AI demo I've seen with pro. Keep up the good work.


CHECK
20
Years of Service
User Offline
Joined: 15th Dec 2004
Location:
Posted: 1st Feb 2005 02:46
nice i like it

CHECK
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 1st Feb 2005 09:14
Sorry all, just noticed a bug:

Change



to



...and it should play nicely with the media files.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Feb 2005 14:51
Update:
-The chase AI is a little smarter and smoother.
-The FPS is, on average, just a bit higher.
-Setting the speed variable at different numbers will work correctly (try cranking it up to 5 or 6 and watch 'em fly!)
-Replaced the boxes with an animated model from a DBPro demo (I don't do models and animation... yet. So please forgive the borrowing)
-Y collision is better (the top of the models can collide now).
-A few other minor fixes.

And thanks for the comments.



And you can still get the media at: [href]http://home.earthlink.net/~plewis118/MyGames/Maze AI Media.zip[/href]

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
FXTC
20
Years of Service
User Offline
Joined: 3rd Jul 2004
Location: CzechRepublic
Posted: 4th Feb 2005 01:25
nice work THX

ai code:


ai code2:


AI code 3


AMD 2,4 512MB RAM,2x200GB hdd,GforceFX5700GT128MB
sadsack
21
Years of Service
User Offline
Joined: 27th Nov 2003
Location: here
Posted: 4th Feb 2005 03:14
hello RiiDii,
in your media file there is no load object "roomdemo.x",100. Can I just make a cube as a room?????
renny
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Feb 2005 09:23
Hi sadsack (sorry for the missing media). "roomdemo.x" is a character model, not the room. It came with dbpro in the roomdemo folder (projects/roomdemo/media/hero). You could maybe use another model, but you would probably have to adjust the animation.

Oh well, I'll try again when I get home. Thanks

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Cryptoman
21
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 4th Feb 2005 10:06
I'll say again that's the best I've seen around here.


RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Feb 2005 13:49
Thanks Trs80!

I've posted the media in a different zip file at:
http://home.earthlink.net/~plewis118/MyGames/Maze AI Media2.zip

@FXTC, Thanks for the comment and the post. Haven't had a lot of time to look at the code - am doing that now. It's great! Great work on the stats and how the AI is working. Very informative. If you don't mind, I might start adding something similar to help demonstrate what the AI is doing in future posts - I think it adds a lot! Also - like your code - much neater (easier to read) than mine.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Neofish
21
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 4th Feb 2005 21:14
It took over 400 seconds to complete although the FPS was nice

RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 5th Feb 2005 00:25
Thanks for the info Neofish! I'm interested in those results (always looking to improve). Can you run the AI about 5 times and let me know what results you get? Avg FPS & Time to complete. Also, let me know if you made any changes, like to the Speed variable. I notice that even though I increased the speed, the time to complete didn't change (I'm still trying to figure that one out).

Thanks again.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
FXTC
20
Years of Service
User Offline
Joined: 3rd Jul 2004
Location: CzechRepublic
Posted: 24th Feb 2005 19:27
Thist code post Chibi Babble:


AMD 2,4 512MB RAM,2x200GB hdd,GforceFX5700GT128MB
Neofish
21
Years of Service
User Offline
Joined: 7th Apr 2004
Location: A swimming pool of coke
Posted: 24th Feb 2005 19:32
I think I removed it so can't test again (too lazy), but the reason it took so long was because it kept walking into the walls and trying and trying to walk up them, stopped, turned the wrong direction and walked back again. Also it can't get under the stairs but thinks it can...

:: AphoticVM oGL Plugin : 0.001% Complete (v0.0.0.1) ::
Wolfish King
21
Years of Service
User Offline
Joined: 23rd Aug 2003
Location: The Netherlands
Posted: 6th Mar 2005 06:04
Hey, I have an error.
#100001: Could not determine parameter type of 'specular 100' at line 82.
What is that?
Dark Angel_1246
20
Years of Service
User Offline
Joined: 7th Jul 2004
Location: Australia
Posted: 25th Apr 2005 14:03
would it be hard to make this work with NGC Collision plugin 3.01

Dark_angel
RiiDii
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 26th Apr 2005 01:42
Quote: "would it be hard to make this work with NGC Collision plugin 3.01"

Not sure. I'm currently avoiding plugins and dlls because I want to dig as deep as I can into DBPro before adding on to it. But it probably won't be too hard, and you can probably make a lot of improvements as well.

The concepts are pretty straight forward though. For horizontal collisions, do a 4,6,8,10, or 12 point check around the object to see if there would be a collision. If so-push the moving object away from that direction a little. The more checks you do, the more smooth and "slidey" the collision system is.

Next is ground checking. This is 2 parts. The first is the matrix check where it checks the height of the points around the object. Again, if the height difference is too great, then the object is pushed away from that direction a little bit.
The second part is ground objects (like the stairs). If the ground object's "top" (y position + (y size / 2) ) is less than a given percentage amount of the moving object (I think I used 1/2 the size) then the moving object is allowed to collide with the ground object. A final check is done twice below the 'feet' of the moving object. Once to check if there is something the object is standing on, and the second check to see if there is something between the feet and the distance the object is about to fall. If there is an object, the distnace to fall is reduce to the distance between the "feet" and the top of the ground object (this prevents bouncing).

The rest is AI stuff and doesn't have a lot to do with collisions.

Really though, I have learned a lot more about using DBPro and collisions. I know that if I wrote this code again from scratch, that it would be a lot better. I would even give a shot at getting it to work with .x levels.

"Droids don't rip your arms off when they lose." -H. Solo
REALITY II

Login to post a reply

Server time is: 2025-05-18 01:49:31
Your offset time is: 2025-05-18 01:49:31