creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
On Fixing C2's Wallbumping   
GimmeCat

GimmeCat
United Kingdom  


  4/25/2018  5

Over the years, we've all been frustrated by C2 creatures' penchant for throwing themselves against walls, and many efforts have been made to create smarter genetic breeds that avoid this problem. However, to my knowledge, little - if any - attention has been given towards the other half of creature behaviour: their scripts.

Genetics are important. But arguably I'd say the behaviour scripts are even moreso. You can gengineer your norns with all the Turnase you like, but no gene can tell them if there's a wall to their left when they decide to act.

That's where the behaviour scripts come in.

scrp 4 0 0 42
impt 5
pose 60
walk
wait 30
impt 1
loop
wait 20
stm# writ targ 23
ever
endm


Here is the script that controls what happens when a norn, through its genetics, decides "I want to go WEST." The genetics triggers the action, but the action itself is fully scripted.

First, pose 60 is chosen, which is 'facing west', and then the command 'walk' is given. Walk is a hardcoded behaviour that makes a norn walk in the current direction until interrupted or a new decision is picked. 'Wait 30' gives the norn about a second of walking before the script sends a brain stimulous saying "okay, you've started walking west."

Without this script, a norn would do and feel nothing when its genetics say 'go west.'

So, why is this important to wallbonking? Well, you'll see that there's no checking for walls in that script. But there is in this version:

scrp 4 0 0 26
impt 5
pose 60
gsub glef
anim [061062063064R]
wait 30
impt 1
loop
wait 20
stm# writ targ 23
ever
subr glef
doif obst 0 lt 200
say$ [There's a wall to my left!]
wait 20
say$ [Let's go right instead.]
done
wait 7
mesg writ from 27
endi
retn
endm


Here, the script checks for a wall within 200 pixels of its intended direction. If it finds a wall, the action is cancelled and the opposite action, 'go east' is triggered instead. The same logic can then be applied to the 'go east' script, the EXTRA scripts, and the Retreat script.



Retreat handles it a little differently, because it's a single script that must handle both directional cases:

scrp 4 0 0 21
--snipped for brevity--
subr relw
targ _it_
setv var0 relx
targ ownr
doif var0 lt 0
say$ [I'm scared of IT to my left!]
wait 20
doif obst 1 lt 200
say$ [But there's a wall to my right!]
wait 20
done
stop
endi
endi
doif var0 gt 0
say$ [I'm scared of IT to my right!]
wait 20
doif obst 0 lt 200
say$ [But there's a wall to my left!]
wait 20
done
stop
endi
endi
retn
endm


Here, the script decides whether _it_ (the thing the Norn is scared of) is to the left or right of him. If it's to the left, a check is made for walls to the right. Likewise if _it_ is to the right, the norn will check for walls behind him to the left. The fleeing action is simply cancelled if a wall is found, because unlike the general 'go east/west' scripts, the 'flee' poses are genetically coded to turn the norn in the opposite direction of _it_, meaning there is no way to make him run the other way without making him look at something else first. And that wouldn't work very well!




There are some caveats to this solution, of course. For one, this won't stop norns wallbonking when they're trying to reach an unreachable target. That would require some very complicated calculations, and those cases are so rare as to be not worth the extra strain on the game.

It also won't stop a long-wandering norn from bumping into a wall if there wasn't one within 200 pixels when they began walking. But it WILL stop them doing it again when the wall is right there. So just one bonk - and no more.

~~~~~~

I intend to release this both as a standalone fix COB, and also package it with Better Albia 1.5 (coming very soon!)

BA 1.5 will also include a fix for the world wrap bug, with many thanks going to Elegnaim for their attempt which inspired me to try making my own version. Both versions should remain available if you prefer one over the other.

 
GimmeCat

GimmeCat



  4/25/2018  4

So I've released a COB, but this is only half the solution. I had a dilemma because BA 1.5 is going to include a world wrap fix, and it modifies many of the same scripts this one needs to modify.

After mulling it over, I've decided to package them both into the BA - Extras COB, which will be downloadable seperately from BA and also packaged with it. Though I would recommend EVERYONE who plays C2 to use Better Albia, I also think choice is important, so if you don't want BA you'll still be able to get this fix.

Look out for that soon. Got a few more things to fix up before I upload the lot.

 


downloads
cobs
adoptions
creaturelink
metarooms
breeds
 
gallery
art
wallpaper
screenshots
graphics
promos
sprites
dev
hack shack
script reservations
dev resources
active projects
dev forum
 
community
links
advice
chat
polls
resources
creatchi
 
forum
bookmarks
general
news
help
development
strangeo
survivor
mycaves
log in
register
lost pw
1 online
Malkin
creatures caves is your #1 resource for the creatures artificial life game series: creatures, creatures 2, creatures 3, docking station, and the upcoming creatures family.

contact    help    privacy policy    terms & conditions    rules    donate    wiki