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.

Author
Message
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 20th Oct 2003 00:25
im new to db i got it bout a week ago and im making a 1st person shooter and its goin long nice, with the help that db has i it, but i a want to kno how to make the ai try to dodge the bullets you shoot. And how to make more than one level, or how to chang guns.
And if anyones gunna help me can i use the code you give me in my game?

tim
UnderLord
21
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 20th Oct 2003 06:25
i can only answer one of your questions....and if people post code for you then use it is royally free but since i do the same thing for the time being i'd put in credits of somthing along the lines of "Thanks to everyone on the DB forums for your help!"

but to get enemys to dodge bullets would be a little complex i wouldent know how to get that to work =\ wait for someone more experienced sorrie =)

http://www.freewebs.com/ingamers
Black Hydra
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 20th Oct 2003 07:18
What your asking cannot be summed up. There isn't a built in function that will make an AI. Using logic you can figure out how to make realistic AI's but the more realistic the harder they are to make.

I have the suspicion that you know very little about programming (If I am wrong then ignore me) . Don't worry about AI's. Make a game like Space Invaders or Pong. The AI on that is blatently obvious (if you can call it an AI). AI's are one of the most advanced tasks a programmer can handle.
Aramil
21
Years of Service
User Offline
Joined: 27th Oct 2003
Location: Wherever my feet take me
Posted: 3rd Nov 2003 02:41
Black Hydra, you sure know how to encourage someone!

...into giving up
Don't be such an optimist. People might actually, possibly might think you're trying to help!
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 3rd Nov 2003 03:09
well skater1, y dont u try writing the AI that can possibly happen when facing an enemy. try using "psuodo code" if i'm spelling it write. e.g "if the enemy is exactlly pointing at me then change his position +1 or -1 when u shoot at him, but if he isnt pointing at me then let the bullet hit him". in real life that can be a fact only if the enemy is "NEO". no one can dodge bullets
about making levels, y dont u check out a decent level making software, u'll find lots of em.
about changing weapons, try loading all the weapons that u have. then label each weapon, say "weapon1:" for weapon number 1. at the begining of ur loop put in an if statement, say "if inkey$()="q" then goto weapon1". dont forget that at each weapon hide the other weapons.
hope i helped.

‘Those who ignore the lessons of the past are doomed to repeat them’ (Napoleon)
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 4th Nov 2003 02:30
yea u did thanks well i stopped makin that game but ill add that in cuz i still like playing it

tim
Dizzy
21
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Brit in the US
Posted: 4th Nov 2003 05:50 Edited at: 4th Nov 2003 05:56
The term Artificial Intelligence, or AI can easily scare people off because it sounds so complicated. But imho it is one of the most rewarding parts of programming, and can be a lot simpler than people make it out to be.

The example above is about 'Roaming AI'. The three most basic types of roaming AI are Chasing, Evading and Patterened Roaming.

Obviously the above question is about evading and, like the Digital guy says, it's simply just a case of checking where a certain object is and then reacting to it (see Pseudocode). If you want to make the alien seem a little smoother and less mechanical just apply some randomness into the decision making. For a Chasing AI you just do te same thing but in opposite directions. Patterned roaming is a little more complicated but just requires some mathematics - a little bit of trigonometry can go a long way (or you could just use arrays to store the patterns).

AI really isn't that scary but it can get pretty complex pretty quick if you get into it, and that's not necessarily a bad thing.

===
"Life would be so simple if only we had the source code!" - someone else
Black Hydra
21
Years of Service
User Offline
Joined: 2nd Oct 2003
Location:
Posted: 5th Nov 2003 02:35
I didn't mean to scare him off or degrade him.

My purpose in my comments is to start off by a much simpler game. By doing this you will learn more about how programs work. It is easy to say AI's are easy because in truth everything in programming is easy (just follow me with this). It is when you use things in conjunction with each other that makes it hard.

AI's are a conjunction of many things in a game and have to be thought out logically. You have to know the game itself in and out to know how to do an AI. This means that a first person shooter does not give users the best description for how to do an AI.

I am sorry but to someone new an AI can be confusing and hard (it obviously is) and it is hard to have someone else to make one as it is different for every game.

I didn't want to sound discouraging but AI's are not something that can be summed up. Looks like, unless someone would patiently look through your source code, you will have to pretty much figure it out for yourself.
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 7th Nov 2003 04:29
wat is the persuado code or watever. Yea i just dont want him to stand there wen i shoot at him thats it. In my game which i started again my iraqi soldier just stands there and shoots at me. Well he walks towards me,but thats it. Thanx a lot in advance!!

tim
Neophyte
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 7th Nov 2003 21:46
@skater1

"wat is the persuado code or watever."

Psuedo-code is just make believe code. Its something simple like-If this then do this. Its not real code just a guideline on how to go about writing real code.

If you click on the "Source" button underneath Dizzy's post you'll see what I mean.
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 8th Nov 2003 02:13
ok would could u just do smtin like
if camera veiw can see object 1 then move object 1 sumwere
i dont kno how to do that but that would be cool if anyone knew how to and could help me or if it was even possible.
thanx

tim
D I G I T A L
21
Years of Service
User Offline
Joined: 22nd Jun 2003
Location: Dubai, UAE
Posted: 9th Nov 2003 02:07
i wouldnt use the camera or even touch it if i were u. if ur shooting bullets at him, i'll use the distance between the bullet and him. "so how can i know the distance?". this is a good equation for knowing it.
enemy position:
ex#=object position x(enemy)
ey#=object position y(enemy)
ez#=object position z(enemy)

your bullet position:
bX#=Object position X(bullet)
bY#=Object position Y(bullet)
bZ#=Object position Z(bullet)

the equation:
distance = sqrt((ex# - bX#)^2 + (ey# - bY#)^2 + (ez# - bZ#)^2)

"now, how can i use all that to make the enemy dodge the bullet?"
simple, just by giving an if statement to the distance between them, e.g if distance < 50 then move the enemy to the right or to the left.
i think thats about it, i hope i helped.

‘Those who ignore the lessons of the past are doomed to repeat them’ (Napoleon)
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 9th Nov 2003 07:09
yea it helpd a lot thanx

tim
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 9th Nov 2003 14:15
Quote: "Black Hydra, you sure know how to encourage someone!

...into giving up
Don't be such an optimist. People might actually, possibly might think you're trying to help! "


What black hydra said was completely.... true. It made alot of sense

"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush

Mercenaries in Space demo @ http://www.davidtattersall.me.uk
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 9th Nov 2003 23:11
i have 1 last question but its not about ai um its about sound.
ok i used the code
if mouseclick()=1 then play sound 1
but if i hold the button down it makes like a weird sound and then 1ns i let go then it plays the sound, but i have an ak in my game wich is automatic.

tim
David T
Retired Moderator
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: England
Posted: 9th Nov 2003 23:17 Edited at: 9th Nov 2003 23:17
That's because you kep restartign the sound every loop the mouse is down:

if mouseclick()=1 and sound playing(1)=0 then play sound 1

"The trouble with the French is that they have no word for 'entreprenuer'" - Pres. George W Bush

Mercenaries in Space demo @ http://www.davidtattersall.me.uk
Hamish McHaggis
21
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 9th Nov 2003 23:19 Edited at: 9th Nov 2003 23:20
if mouseclick()=1 and sound playing(1)=0 then play sound 1

EDIT

Oops, posted at the same time.

Do you bite your thumb at me sir?

Athelon XP 1600 Plus - Nvidia Geforce MX400 - 256mb RAM
MicroMan
21
Years of Service
User Offline
Joined: 19th Aug 2003
Location: Stockholm, Sweden
Posted: 10th Nov 2003 01:03
Making games is hard work. It's like building a castle. If you come to the building site on the first day of the job and expect to single handedly build a beautiful castle with arched parapets and slender towers, you are likely to go away very disappointed and look back on a pile of rubble.

Game making is the hardest programming disciplin there is. Unlike in application programming where everything you do is triggered by something the user does -- clicking a mouse, choosing a menu, changing a window. While the application program otherwise sits quite idle waiting for input, a game has to do a lot, A LOT, of stuff in a few milliseconds. It has to show graphics, play sound, move the player, update every other animated entity in the area, and it has do do all that over and over again several thousand times a second because if it doesn't, then the game experience will be bad.

Game making is an acquired skill, and it takes a while to acquire it. I agree with Black Hydra in that you should lower your sights if this is your first attempt at game making. Don't worry about AI now. Don't even worry about FPS, because they're one of the hardest kinds of game to make good (and game making is hard enough as it is). Make a Pong, make a Pac Man, make an Arkanoid, and make a Tetris clone.

They are simple games, yet all the elements of games are in them: ai, game loops, sounds, graphics. And as you make them, you learn the craft, and you learn the skills required to tackle harder games. You become better. You learn what it takes to make a game, and at the same time the task is not so horrendously difficult as to put you off game making for good. So do 2d games before you attempt 3d ones. Make simple games before you try to make hard ones.

It takes time to learn game making.

Cheers,
Microman

-----
They SAID that given enough time a million monkeys with typewriters could recreate the collected works of William Shakespeare... Internet sure proved them wrong.
-----
skater1
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location:
Posted: 10th Nov 2003 01:14
yea i kno have a lot of trouble with the game im making right now so i am gunna try to make pong. Its just ive tried to make some 2d games and seeing that i started with 3d it seems so much harder.
well thanx everyone.

tim

Login to post a reply

Server time is: 2024-11-25 16:46:09
Your offset time is: 2024-11-25 16:46:09