dMZX Forums: I need some ai help. - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

I need some ai help.

#1 User is offline   weasel 

  • bleh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 7,915
  • Joined: 23-December 00
  • Gender:Male
  • Location:Hillsboro, Oregon

Posted 28 January 2002 - 08:25 PM

I need some suggestions for enemy AI for TeleCrisis+. Basically what I'm looking for is:

* 1 char
* Can hear weapons firing
* Will reload after 32 bullets
* Has a certain view distance, and CANT see through walls
* Takes random amounts of damage to a health total of 100 (about a damage range of 15-100 HP) upon being shot

The part I need the most help with is the view distance and the weapon noises.
Blaugh!
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
0

#2 User is offline   Liquid-salt 

  • BUZZ BUZZZZZ BUZZZZZZGGGGRRGRG!!!   BOOM !&
  • PipPipPipPip
  • Group: Members
  • Posts: 520
  • Joined: 04-January 02

Post icon  Posted 28 January 2002 - 08:57 PM

Ok, my idea for the ear-shot:
There's gonna be a function in the robot's code that will repeat often right? (the kind that checks for which direction to go or something - if none are available, make one)  Well,  have it check for "spacepressed" (assuming that will be the firing button)  and then check the x and y posistions to see if is in ear-shot.  Then.. check the x,y coordinates to see wich direction the player is at.

BTW, you're pretty good, I've seen some of your games. :eyes:/>
0

#3 User is offline   Spinfusor 

  • Whatever does not kill me only makes me stranger
  • PipPipPip
  • Group: Members
  • Posts: 214
  • Joined: 28-January 02

Post icon  Posted 28 January 2002 - 11:24 PM

For the walls, you could try locating the player with playerdist, then checking the x/y coordinates for a solid (or whatever walls you are using) in between.

I can't think of any way for the ammo without using extensive zapping of labels.
S p i n f u s o r
OWNZ ALL UR SPIN
0

#4 User is offline   Yakumo 

  • Daedalus
  • PipPip
  • Group: Members
  • Posts: 146
  • Joined: 25-April 01

Posted 29 January 2002 - 04:53 AM

Ammo is easy... Just either do the aforementioned label zapping (ech) or give the bot an ammo counter that starts at 32 and counts down each time he fires.
0

#5 User is offline   ShloobeR 

  • theire are with too much aaaaaaaaaargh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,984
  • Joined: 07-February 01
  • Gender:Male
  • Location:El Chair

Posted 29 January 2002 - 09:13 PM

WildWeasel, on Jan. 28 2002,21:25, said:

I need some suggestions for enemy AI for TeleCrisis+. Basically what I'm looking for is:

* 1 char
* Can hear weapons firing
* Will reload after 32 bullets
* Has a certain view distance, and CANT see through walls
* Takes random amounts of damage to a health total of 100 (about a damage range of 15-100 HP) upon being shot

The part I need the most help with is the view distance and the weapon noises.

Those are all relatively easy, And

1 char - that's uhm... nothing much

can hear weapons firing - Not only can you do that, but you can have it within a certain distance too

Will reload after 32 bullets - easy

Has a certain view distance - simple

Can't see through walls - That'll be the hardest, you could maybe check EmalkaY's Ai thingamajug, that was pretty cool

blahbalhglablablab - Easy
0

#6 User is offline   hob nado 

  • Ancient Member
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 4,718
  • Joined: 23-September 00
  • Gender:Male

Posted 30 January 2002 - 04:21 AM

There was a pretty good guard-alerting weapons-noise engine back on the old AOL archive, I think I managed to snatch it up before I left AOL, but I'm not sure where it is now...I think it's on a backup tape of mine or something.
0

#7 User is offline   Spinfusor 

  • Whatever does not kill me only makes me stranger
  • PipPipPip
  • Group: Members
  • Posts: 214
  • Joined: 28-January 02

Posted 01 February 2002 - 04:23 AM

Theres a problem with all this....if you do this using a counter for ammo, you will be using two counters (one for the ammo and one for the health), which is bad, seeing you can't use loopcount and will have to spawn a seperate sounter for every robot. That will use up way too many counters, so I would recomend zapping :eyes:/>.
S p i n f u s o r
OWNZ ALL UR SPIN
0

#8 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 01 February 2002 - 05:29 AM

There are two local counters, you know. More of you're using MZXAck.

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#9 User is offline   Nanobot 

  • It's in your blood
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,623
  • Joined: 11-October 00
  • Gender:Male
  • Location:Chico, CA (USA)

Posted 01 February 2002 - 03:57 PM

Three, really. But bullettype can only be set to 0-2 and affects the firing type (duh).
The Nanobox, where wings take dreams...
0

#10 User is offline   Revvy 

  • Jeez guys, there's no need to be narky.
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 3,520
  • Joined: 05-March 01
  • Gender:Male
  • Location:Ontario, Canada

Posted 01 February 2002 - 08:13 PM

There are many mzxak local counters:

board_x, board_y, board_char, board_color
overlay_x, overlay_y, overlay_char, overlay_color
local, loopcount, local2 (mzxak2 only)

See?  Eleven right off the top of my head.  There's probably more though...
<+AFK> Bringing whisky to my mother is like irrigating a lake.

<+AFK> dormando's apathy is palpable.
* AFK palpates
<dormando> stop that

<Malwyn> undressing with revvy a little over a metre away. new definition of awkward.
0

#11 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 01 February 2002 - 09:24 PM

Revolution 8819, on Feb. 01 2002,19:13, said:

There are many mzxak local counters:

board_x, board_y, board_char, board_color
overlay_x, overlay_y, overlay_char, overlay_color
local, loopcount, local2 (mzxak2 only)

See? ?Eleven right off the top of my head. ?There's probably more though...

I hate to tell you this but almost all of those aren't local (or, writeable)

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#12 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 01 February 2002 - 11:29 PM

There are as many local counters in MZX3.1 as you want.

Just use "loopcount" as the robot ID (each robot has a different number for that) example:



: "justentered"
set "loopcount" 1                   <=== this sets the robot ID
set "HP&Loopcount&" 100        <=== MZX reads as "HP1"
set "Ammo&Loopcount&" 32     <=== MZX reads as "Ammo1"

: "loop"
if "HP&loopcount&" =< 0 "dietime"
if Ammo&loopcount& =< 0 "reload"
====Insert movement code====
goto "loop"

: "reload"
wait 10
set "ammo&loopcount&" 32
goto "loop"

: "shot"
dec "HP&loopcount&" random 15-100
goto "loop"

: "Dietime"
=== insert death code (give points/EXP/money whatever)===
die




That is the basic idea for robot ID's, I'm probably not the first to do this, but I've done it for over 2 years now.


Also If you want use the code that changes the robots name in the beginning if you want each to have a different name, mainly this is only if a robot will be copied, (like for an RTS)

@ "baddude&loopcount&"

In that event, just have whatever robot is doing the copying do this

: "justentered"
set "RobotID" 1
end
: "copy"
inc "RobotID" 1
copy block 1 1 1 1 2 2
send at 2 2 "startup"
end

Then have the robot that is being copied do this:

end
: "startup"
set "loopcount" "RobotID"
=== put in all the code to give it hit points and all that good stuff here ===

goto "loop"


I threw together an RTS doing this, it was pretty cool. You can also use the robot ID to track the X & Y coordinates of every robot that has one,

Just have the robot constantly do this (put it in a loop):

set X&loopcount& thisX
set Y&loopcount& thisY

This can be used to compare distance between two robots distance, direction, whatever.

The only real downside to all of this is that putting &loopcount& in every counter like that can quickly make robots large, sucking up that precious robot memory, so keep an eye on it.

Good luck on it, hope this helps a bit.
Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

#13 User is offline   Thundercloud 

  • What
  • PipPipPip
  • Group: Members
  • Posts: 262
  • Joined: 04-August 00

Posted 03 February 2002 - 09:36 PM

Why would you need to use loopcount as the robot ID? MZXAk has a robot_id counter doesn't it?

Thundercloud
0

#14 User is offline   apage43 

  • Veteran Member
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,199
  • Joined: 13-November 00
  • Gender:Male

Posted 06 February 2002 - 03:56 AM

I ?once made a robot id engine. You could have lots of robots. Change the colors. Check their hp. Check the id of a bot an an xy coord. blah blah. and otehr crap. I actaully used about 0 counters. it was all managed in a single robot Using AK and Board_color etc. so get and put solids the color of a value in hp . This is a good way to get lots of exta counters.but is quite slow. Infact.
Just thought of this.. u could use color of bot as a local counter.
0

#15 User is offline   weasel 

  • bleh
  • PipPipPipPipPipPip
  • Group: Members
  • Posts: 7,915
  • Joined: 23-December 00
  • Gender:Male
  • Location:Hillsboro, Oregon

Posted 08 February 2002 - 04:32 AM

Whoa, I havent been here in about a month :eyes:/> Im amazed so many people have posted here...thanks for your suggestions.

What I'm trying to accomplish is maybe randomized label zapping for the health points (ie. a :SHOT label would trigger ZAP "SHOT" &DAMAGE&, where DAMAGE is a random number 1-4) and DIRECTONAL based viewpoints (much like Metal Gear, only 3 lines wide and not 1 line wide. NES version, not PSX). It sounds complex...but I'm going for quality in here. Heck, my player weapons engine has a semi-auto pistol and a Sten SMG the overheats! (DONT ASK ME FOR IT. You can use it when TC+ comes out)
Blaugh!
Serious damage to important body parts pretty much ruins any plans you had for living. Bummer.
0

#16 User is offline   Kuddy 

  • nobody
  • Group: DigiStaff
  • Posts: 4,823
  • Joined: 26-January 01
  • Gender:Male
  • Location:Philadelphia
  • 3DS Friend Code:4227-0979-0064

Posted 08 February 2002 - 04:39 AM

WildWeasel, on Feb. 07 2002,23:32, said:

randomized label zapping for the health points (ie. a :SHOT label would trigger ZAP "SHOT" &DAMAGE&, where DAMAGE is a random number 1-4)

I think that's been done before... using loopcount or local as a HP counter and then having :shot take 1-4 off of it would save a lot of memory, but then again, it's your game. If you'd rather use those counters for the vision thingey, go ahead.

And thus, I earn my 5th and final star, having made mostly intelligent posts along the way. *with a tear in his eye* I'd like to thank all the little people... *the screen fades out on him*
Posted Image
bollocks
0

#17 User is offline   Frobozz 

  • Ryiah
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,808
  • Joined: 07-March 01
  • Gender:Not Telling

Posted 15 February 2002 - 05:37 PM

You could always make ammo and health use one counter. That would be useful, considering you probably won't be using a value above 255.

Problem is I can't remember how its done.
0

#18 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 15 February 2002 - 10:42 PM

Frobozz, on Feb. 14 2002,16:37, said:

You could always make ammo and health use one counter. That would be useful, considering you probably won't be using a value above 255.

Problem is I can't remember how its done.

You can break up an integer into smaller integers on a little endian system (like our x86's) by ANDing off the high order/low order bits and if necessary shifting the high order bits into the low order. In MZX you can use modulos and division instead of binary AND and shifting. However, since the words in MZX are signed, so is division, so without some extra conventions you can't stuff 16bits. Most people just use 15bits. So for 7bit (high order, 0-127) and 8bit (low order, 0-255) unsigned integers you can do this:

set "value_1" "packed_counter"
divide "value_1" 256
set "value_2" "packed_counter"
mod "value_2" 128

Easy, yeah?

- Exo
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users