creatures caves welcome, guest
downloads   gallery   dev   community   creatchi   forum   mycaves
bookmarks | search | post new topic
Development Forum
old
Creature history in a genetic splicer   
Arnout

Arnout
Netherlands  


  8/6/2025  1

Hi all, hope you're well.

I know some members here have worked on variations of genetic splicers. For a project, I have been working on my own recently. But after carefully checking the C3DS CAOS glossary and trying different options, I feel somewhat backed into a corner on 1 problem. Explanation and code are below.

My splicer is an agent that creates a "gene soup" of passing creatures. When creatures pass by, it reads their moniker and stores them in up to 10 slots. Naturally, after 10 slots, the oldest moniker is removed to make place for the newest moniker.

*subroutine visitors
*check for visitors and store their genetic information
subr vist
rnge 150
inst
*va99 is the creature
seta va99 null
esee 4 0 0
doif dead eq 0
*and chem 186 gt 0
seta va99 targ
endi
next
doif va99 ne null
*reduce fertility of the target (reduce chem 186 later)
targ va99
*register the moniker of the individual as text
sets va20 gtos 0
*target the ownr again
targ ownr
*if you are not already present in the ownr (sloppy but the best solution I could find)
doif va20 ne ov21 and va20 ne ov22 and va20 ne ov23 and va20 ne ov24 and va20 ne ov25 and va20 ne ov26 and va20 ne ov27 and va20 ne ov28 and va20 ne ov29 and va20 ne ov30
*if less than 10 monikers are stored simply fill up the slots
doif ov04 lt 10
*number of genomes stored ov04
addv ov04 1
*register first moniker
doif ov04 eq 1
sets ov21 va20
*register second moniker
elif ov04 eq 2
sets ov22 va20
*register third moniker
elif ov04 eq 3
sets ov23 va20
*register fourth moniker
elif ov04 eq 4
sets ov24 va20
*register fifth moniker
elif ov04 eq 5
sets ov25 va20
*register sixth moniker
elif ov04 eq 6
sets ov26 va20
*register seventh moniker
elif ov04 eq 7
sets ov27 va20
*register eighth moniker
elif ov04 eq 8
sets ov28 va20
*register ninth moniker
elif ov04 eq 9
sets ov29 va20
*register final moniker
elif ov04 eq 10
sets ov30 va20
endi
*if 10 monikers are already present: remove the oldest and move the rest up 1 slot -> then store the newest on slot 10.
elif ov04 eq 10
setv ov04 10
*move slot 2 on slot 1, move slot 3 on slot 2, move slot 4 on slot 3, move slot 5 on slot 4, etc.
sets ov21 ov22
sets ov22 ov23
sets ov23 ov24
sets ov24 ov25
sets ov25 ov26
sets ov26 ov27
sets ov27 ov28
sets ov28 ov29
sets ov29 ov30
*move the moniker of the latest registered creature into the final slot.
sets ov30 va20
*altogether: the latest registered monikers are always in higher slots.
endi
endi
endi
retn

Under some conditions (currently on click), the splicer crosses 2 random genomes from the soup to create an egg. Here is how that looks:

*subroutine select moniker 1 and moniker 2
subr slct
*first check the exact numbers of monikers to choose from
setv va30 0
loop
addv va30 1
untl va30 eq ov04
*where va30 is the number of monikers
*number for parent 1
setv va31 0
*number for parent 2
setv va32 0
*generate the first parent
setv va31 rand 1 va30
*generate the second parent (no extra rules but should not be equal to the first parent)
loop
setv va32 rand 1 va30
untl va32 ne va31
*clear the available genes
gene kill ownr 1
gene kill ownr 2
*link the parent choices to the monikers in the ownr
*LOAD PARENT 1 INTO GENE SLOT 1:
doif va31 eq 1
gene load ownr 1 ov21
elif va31 eq 2
gene load ownr 1 ov22
elif va31 eq 3
gene load ownr 1 ov23
elif va31 eq 4
gene load ownr 1 ov24
elif va31 eq 5
gene load ownr 1 ov25
elif va31 eq 6
gene load ownr 1 ov26
elif va31 eq 7
gene load ownr 1 ov27
elif va31 eq 8
gene load ownr 1 ov28
elif va31 eq 9
gene load ownr 1 ov29
else
gene load ownr 1 ov30
endi
*LOAD PARENT 2 INTO GENE SLOT 2:
doif va32 eq 1
gene load ownr 2 ov21
elif va32 eq 2
gene load ownr 2 ov22
elif va32 eq 3
gene load ownr 2 ov23
elif va32 eq 4
gene load ownr 2 ov24
elif va32 eq 5
gene load ownr 2 ov25
elif va32 eq 6
gene load ownr 2 ov26
elif va32 eq 7
gene load ownr 2 ov27
elif va32 eq 8
gene load ownr 2 ov28
elif va32 eq 9
gene load ownr 2 ov29
else
gene load ownr 2 ov30
endi
**Notes:
*AL: Before proceeding I should check if it does not crash...
*AL: No crash. Let's try to proceed with creating eggs.
retn

So here the agent chooses two random monikers, next is crossing them and creating an egg:

*subroutine make egg
subr megg
inst
*clear crossing gene 3
gene kill ownr 3
doif gtos 1 ne "" and gtos 2 ne ""
*cross the genomes of the selected parents 1 and 2 and put it in 3
gene cros ownr 3 ownr 2 ownr 1 40 40 40 40
sets ov43 gtos 3
endi
sets va43 ""
doif gtos 3 ne ""
sets va41 gtos 1
sets va42 gtos 2
sets va43 gtos 3
endi
doif va43 ne ""
*make the egg
sndc "egg1"
inst
setv va88 posx
setv va89 posy
addv va88 -22
addv va89 -34
*use unique egg sprite
new: simp 3 4 3 "splicer" 7 17 10
elas 10
fric 100
attr 195
bhvr 32
aero 10
accg 4
perm 60
*move the crossed genome into the egg
gene move targ 1 ownr 3
*random sex
setv ov01 rand 1 2
mvsf va88 va89
tick 60
*tell the egg you have been laid (for creature history and user notification)
hist evnt gtos 1 11 va41 va42
*tell the unborn clones in the ownr they have laid an egg (for creature history)
*we send it to both because we don't know their sexes
hist evnt va41 12 gtos 1 va42
hist evnt va42 12 gtos 1 va41
targ ownr
setv ov05 1
stop
endi
retn

And voila: It generates a child from two cloned monikers and their creature history. But my problem is in a detail of the creature history.

Creatures that are born are always generation 2.

I figured out why: My offspring is generated from the gene soup in ownr. Whereas when you breed creatures (or splice with e.g., the C3 splicer) offspring is generated directly from two parents. This is done using gene move ; which can move offspring monikers (e.g., gtos 1) to an agent - such as in a pregnant creature to an egg. But the moniker of the creature itself (gtos 0) cannot be moved to an agent this way. Therefore: I need to clone the moniker of the parent creatures in the splicer and then generate offspring from the clones, which are then the parents of my offspring. And sure: Biologically, my splicer is the parent of the offspring too. So, meaningfully this is not a huge problem.

Apparently: Cloned monikers generated by the engine are always generation 1. I have already tried exploring different options to make living creatures parents of the offspring throughout the splicer instead. To me, this seems impossible in the current setup.

My somewhat sloppy solution to this would be as follows: We get the generation numbers of the parent monikers (so: the visitors) and store the highest generation number as a variable in the splicer. Then, we manipulate the egg to be 1 generation higher than this. Who knows if this is actually possible to do (and how)?

Who is still around with knowledge about creature history scripts - and would like to help solve this puzzle? :)

 
Gobbo

Gobbo


 visit Gobbo's website: Creatures Conjurer
  8/7/2025

Hi Arnout, I checked it out but I fear I cant help you out. Perhaps the generation can be grabbed but I wouldnt know how it would be called as a variable. Suppose its just a number and it doesnt affect functionality?
 
Arnout

Arnout



  8/7/2025

All good! And no problems with functionality indeed. Creatures are still properly spliced from the cloned monikers. I am just hoping we can implement this as smoothly as possible, so it would be nice if our hatched creatures (at least) have the generational component of the creature history. :)
 


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
0 online
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