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.

DarkBASIC Discussion / AI scripting

Author
Message
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 1st Sep 2009 00:47
can anyone give me a good tutorial on AI?it doesnt have to advanced AI. i know there is a tutorial that comes with DBC but i dont really get it,anyone know any good tutorials
(i have already googled it)

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 1st Sep 2009 02:13
AI is a bit of a general term, can you specify what you want your AI to do?

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 1st Sep 2009 02:18
it really doesnt matter i just want to make somthing do somthing by itself

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 1st Sep 2009 04:03
theres no way I can tell you what to do then, in order to explain how to make AI we need to know what you want the AI to accomplish

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 1st Sep 2009 04:19
AI is supposed to give the illusion that the computer is thinking and planning and/or making choices. It's up to the programmer to create the illusion. A bare bones simple AI would be to use random numbers to do something. Like maybe have the computer guess at a number:



I haven't tested this yet as I'm on another computer. If I get a chance, before you post, I will.

Enjoy your day.
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 1st Sep 2009 04:37
@latch it works wow its really THAT simple? cool!

@smart guy here is what i want it to do,move around randomly,dodging obstacles

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 1st Sep 2009 04:53
okay thats more specific, but more info is still required

first, is it 2d or 3d?

do you have any code to show?

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 1st Sep 2009 04:58
2D first
and nope no code...
i just wanted to experimint with AI for future games

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 1st Sep 2009 05:22
well you have to shape the AI you're making around the rest of the game, so First make a game, then post on here any questions you have about the AI along with your code

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 1st Sep 2009 05:39
wait...i said i just want to experiment,not build a game THEN make the AI

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 1st Sep 2009 05:46
well you cant experiment with AI, you have to have a solid concept and be reasonably far into a program and have stuff for the AI to do

its not just something you can just experiment with

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 1st Sep 2009 06:16
oh well then i will make my game then i will tell you

yeah im southern WATCHA GONNA DO BOUT IT?
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 1st Sep 2009 06:26
This seems the best place to ask this question without starting my own thread.

What's the best way to make AI for tic-tac-toe?

Without caffeine, where would our awesome programers be?
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 1st Sep 2009 10:08 Edited at: 1st Sep 2009 10:10
Quote: "it works wow its really THAT simple? cool!"

Depends on what you want to do. It's much more complex to find a path through a maze than it is to guess a random number! But all AI is is providing an algorithm for the computer to figure out a solution to a problem and then act on the solution making it look like the computer has made a decision. For example, if two objects are a certain distance from a computer controlled object, be it a sprite or a 3d object or wahtever, if you want the computer object to move towards the closer object, a simple AI would be to use the distance formula to check which object is closer and then move the computer object towards that.

Quote: "This seems the best place to ask this question without starting my own thread.

What's the best way to make AI for tic-tac-toe?
"

I made a TicTacToe game for one of the DBC challenges a while back. You can check it out at http://zimnox.com/dbcc/index.php?page=view&challenge=Grid%20Challenge or click on the DBC chaleenges thread and on the first page, go to the zimnox website and look for the grid challenge.

The way I did the AI was to give everything a numeric value. An empty square = 0 . A player's mark in a square = 1, and the computer's mark in a square = -1 . A win was determined by adding the values of 3 squares in a row in any of the 8 possible directions after each turn. If there was a return of +3 then the player had won. If there was a value of -3 then the computer won. If all the squares were played and no rows added up to 3 or -3, then the game was a tie (or a cat as we used to call it). For the computer to choose it's square, it looks for a win first (-3), then it looks to see if the player might win on the next turn (is there a +2 somewhere and an empty square?), then it looks to see if the middle square is open, then it looks for the highest score it can get.

Enjoy your day.
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 1st Sep 2009 22:42 Edited at: 1st Sep 2009 22:43
Wow, that's a pretty good idea. Thanks!
So that way if a row ='s 2 then the computer would block it.

I was thinking of trying to recreate FF9's(Final Fantacy IX) card game but keep it really simple(game and AI) by just randomizing it a little and no specific cards.No media ethier, of coarse, it brings a little challenge into my games.

I don't want to take over this tread so forget about last two post and back to travis gatlin.

Without caffeine, where would our awesome programers be?
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 1st Sep 2009 23:53
Quote: "well you cant experiment with AI, you have to have a solid concept and be reasonably far into a program and have stuff for the AI to do

its not just something you can just experiment with"


I do it.

I think what he meant by that tavis was you need somthing to start with in order to experiment with ai, like, say, a movement and camera system, so you can see what ur ai is doing.

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 2nd Sep 2009 00:11
ur missig the point DD

AI is what makes the computer interact with the player and other stuff in the game

so with nothing for the AI to interact with there is no AI

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 2nd Sep 2009 00:42
can i just put in controls for the camera like an FPS game and put in a model somewhere and then give you the code and then you can tell me how to put in the AI?

yeah im southern WATCHA GONNA DO BOUT IT?
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 2nd Sep 2009 03:13
if the point of your AI is to collide/avoid a object at a specific point then yes that could work.

it all depends on what you want to do. if you are just looking for look and follow AI then you just need a enemy and the player.

if you need look and follow with collision then you need a enemy the player controls(object if needed) and some sort of structure object for the enemy to hit/find a path around.

if you want pathfinding and special hiding movements then i doubt you are going to get examples as that is very intense work and no one is going to just throw it out.

another simple type of 3d AI is setting up points (WayPoints) and then move the enemy toward the next point every loop. if it hits a point, switch to the next point.

the last type of AI is kinda a mix of all of them. setting up waypoints but at the same time try and move toward the player while doing it strategicly and hiding behind things lol that is a bit of a booger to do though lol.

New Site! Check it out \/
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 2nd Sep 2009 04:29
Quote: "the last type of AI is kinda a mix of all of them. setting up waypoints but at the same time try and move toward the player while doing it strategicly and hiding behind things lol that is a bit of a booger to do though lol."

you mean battle ai?

yeah im southern WATCHA GONNA DO BOUT IT?
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 4th Sep 2009 02:11 Edited at: 4th Sep 2009 02:12
i got my code,here it is
simple,but it could be used

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 4th Sep 2009 03:16
what do u want ur AI to do?

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 4th Sep 2009 03:24
i told you in my 6th post,i want the cube to move around randomly but never hit the sphere

yeah im southern WATCHA GONNA DO BOUT IT?
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 4th Sep 2009 03:30
So......You want it to avoid the sphere, if i follow you?

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 4th Sep 2009 03:36
whats that supposed to mean?

yeah im southern WATCHA GONNA DO BOUT IT?
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 4th Sep 2009 04:02
Its a Joke....

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 4th Sep 2009 04:13
lol?

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 4th Sep 2009 04:59
this isnt all that complex of an AI

the main commands you will need are:

sprite hit() (to check for collision)
rnd() (to create a random element)
move object (guess what that does)

see if you can figure it out by yourself, if you cant then we will be glad to help

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 4th Sep 2009 05:00
i didnt put sprites in my game i used 3D objects

yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 4th Sep 2009 05:21
WHOOPS!!!! meant object hit() lol

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 4th Sep 2009 05:34
oh ok

yeah im southern WATCHA GONNA DO BOUT IT?
Brick Break
User Banned
Posted: 5th Sep 2009 06:48
Object collision() actually. Object hit() is just for the first time it comes in contact with another object. Yes, I know, I'm back.

WINNER list:
Brick Break, Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 5th Sep 2009 18:46
ok.glad you told me cuz i havnt really worked on it that much lately

yeah im southern WATCHA GONNA DO BOUT IT?
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 6th Sep 2009 00:01
OK im having problems,i say
and it just sits there and every once in a while it will move foreward about one pixel

yeah im southern WATCHA GONNA DO BOUT IT?
Dark Dragon
16
Years of Service
User Offline
Joined: 22nd Jun 2007
Location: In the ring, Kickin\' *donkeybutt*.
Posted: 7th Sep 2009 00:34
Try...



You had an = where you should have had a +.

(\__/) HHAHAHAHAHAH!
(O.o ) / WORLD DOMINATION!!!!!!!!!!
(> < )
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 9th Sep 2009 00:44
Oh, OK didn't think about it that way

yeah im southern WATCHA GONNA DO BOUT IT?
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 9th Sep 2009 00:52
is This AI?


yeah im southern WATCHA GONNA DO BOUT IT?
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 9th Sep 2009 01:39
OK i think i got my first AI
here it is...


yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 9th Sep 2009 02:53
not sure thats really AI, but I guess it could be depending on where u draw the line

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 9th Sep 2009 04:41 Edited at: 9th Sep 2009 04:42
A.I. is when the computer has to make a choice based on certain conditions.

So what you should do is make the ball go around randomly and if it's about to hit the end of the matrix or the cube then change directions.

The conditions are:

if ball if about to hit end of matrix then turn around.(kind of in a random direction)

if ball if about to hit cube then turn around.

A good game is one percent inspiration, ninety-nine percent perspiration.
Brick Break
User Banned
Posted: 9th Sep 2009 04:52
@travis- Honestly, I wouldn't call either one of those AI. I guess the first one's closer because it at least gives the illusion of AI...

What I mean is that in order for an object to be considered intelligent, it has to think/make decisions. It has to respond to its environment intelligently. To make it AI, you would have to push it just a little bit further by having it react to input. The randomness is part of it, and is what gives the computer the ability to think for itself. However, the computer is blind without getting input from somewhere. If you want to apply lifelike AI, you have to have it react to at least one of the 4 senses (actually 6, but let's just leave out taste and balance)

sight-raycasting Yes, Sparky's.
sound-distance (I answered it )
touch-collision
smell-waypoints (talk to TheComet)

WINNER list:
Brick Break, Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 10th Sep 2009 00:41
i think i got somthing here it is...


yeah im southern WATCHA GONNA DO BOUT IT?
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Sep 2009 00:46
maybe ur not getting exactly what AI is, AI is a computer simulating intelligence by making decisisions based on input

this input could be the player firing a gun at the enemy, the cimputer hearing you walk down a hallway, etc

basically its the computer deciding what to do based stimulus and cant really be made is such a small program

AI int really used until you have a full working game

what you have there isnt so much simulated intelligence as it is randomized movement with a collision check

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 10th Sep 2009 01:18
dang...
what if i made it to where it i play a 3D sound and the person comes to where the sound came from?

yeah im southern WATCHA GONNA DO BOUT IT?
Brick Break
User Banned
Posted: 10th Sep 2009 01:46
That would be good.



Use the above code for your basic enemy movement.

WINNER list:
Brick Break, Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Sep 2009 02:26
ur still missing the point, can anyone else explain my point to him in different words?

t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 10th Sep 2009 04:06 Edited at: 10th Sep 2009 04:07
As I have already said before:

Quote: "A.I. is when the computer makes a choice based on certain conditions."


Just like in tic-tac-toe the computer must pick where he must go:



Should he block the other player or should he just go randomly...hmmmm...
?

This is what A.I. is.

A good game is one percent inspiration, ninety-nine percent perspiration.
Brick Break
User Banned
Posted: 10th Sep 2009 04:18
OR, it could be a program that simply moves the enemy intelligently, like my amazing and completely original function.

WINNER list:
Brick Break, Latch, Lee Bamber, TDK, TheComet
Thanks for the help!
That1Smart Guy
15
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 10th Sep 2009 05:01
thats about right, thanx razer

and what choice is the computer making in ur latest program? not a one, hence it isnt AI

Travis Gatlin
14
Years of Service
User Offline
Joined: 14th May 2009
Location: Oxford, Alabama
Posted: 10th Sep 2009 05:15
@brick break,yor code isnt working it says "program ran into a function declaration"

yeah im southern WATCHA GONNA DO BOUT IT?

Login to post a reply

Server time is: 2024-05-04 05:38:01
Your offset time is: 2024-05-04 05:38:01