Welcome to the Creatures Wiki! Log in and join the community.

Difference between revisions of "MFC serialized data"

From Creatures Wiki
Jump to navigation Jump to search
(No Creature.unconscious in C1)
(Add CBrain)
Line 884: Line 884:
 
CArchive serialized:
 
CArchive serialized:
  
{{stub}}
+
{| border="1"
 +
|-
 +
! type !! description
 +
|-
 +
| uint32 || number of lobes
 +
|-
 +
| Lobe[number of lobes] || lobes
 +
|-
 +
| Neuron[...] || neurons (number depends on counts inside each lobe)
 +
|}
 +
 
 +
'''Lobe'''
 +
 
 +
Not CArchive serialized:
 +
 
 +
{| border="1"
 +
|-
 +
! type !! description
 +
|-
 +
| uint32 || x
 +
|-
 +
| uint32 || y
 +
|-
 +
| uint32 || width
 +
|-
 +
| uint32 || height
 +
|-
 +
| uint32 || perceptible (0 = no 1 = yes 2 = mutually exclusive)
 +
|-
 +
| uint8 || activity
 +
|-
 +
| uint8[4] || chemicals
 +
|-
 +
| uint8 || threshold
 +
|-
 +
| uint8 || leakage
 +
|-
 +
| uint8 || reststate
 +
|-
 +
| uint8 || inputgain
 +
|-
 +
| uint8[10] || svrule
 +
|-
 +
| uint8 || flags
 +
|-
 +
| DendriteType || d0_type
 +
|-
 +
| DendriteType || d1_type
 +
|-
 +
| uint32 || number of neurons (should be width * height)
 +
|-
 +
| uint32 || number of dendrites
 +
|}
 +
 
 +
'''DendriteType'''
 +
 
 +
Not CArchive serialized:
 +
 
 +
{| border="1"
 +
|-
 +
! type !! description
 +
|-
 +
| uint32 || source lobe
 +
|-
 +
| uint8 || min
 +
|-
 +
| uint8 || max
 +
|-
 +
| uint8 || spread
 +
|-
 +
| uint8 || fanout
 +
|-
 +
| uint8 || min ltw
 +
|-
 +
| uint8 || max ltw
 +
|-
 +
| uint8 || min strength
 +
|-
 +
| uint8 || max strength
 +
|-
 +
| uint8 || migration
 +
|-
 +
| uint8 || relaxsuscept
 +
|-
 +
| uint8 || relaxstw
 +
|-
 +
| uint8 || ltw gain rate
 +
|-
 +
| uint8 || gain rate
 +
|-
 +
| uint8 || lose rate
 +
|-
 +
| uint8[10] || gain rule (these svrules might be out of order?)
 +
|-
 +
| uint8[10] || lose rule
 +
|-
 +
| uint8[10] || suscept rule
 +
|-
 +
| uint8[10] || reinforce rule
 +
|}
 +
 
 +
'''Neuron'''
 +
 
 +
Not CArchive serialized:
 +
 
 +
{| border="1"
 +
|-
 +
! type !! description
 +
|-
 +
| uint8 || x
 +
|-
 +
| uint8 || y
 +
|-
 +
| uint8 || output
 +
|-
 +
| uint8 || state
 +
|-
 +
| uint8 || wta disable (maybe this is a u4 and flag2 is the other u4?)
 +
|-
 +
| uint8 || unknown (maybe this is u4 flag3 and u4 flag4?)
 +
|-
 +
| uint8 || number of d0 dendrites
 +
|-
 +
| uint32 || dendrites starting index
 +
|-
 +
| Dendrite[number of d0 dendrites] || d0 dendrites
 +
|-
 +
| uint8 || number of d1 dendrites
 +
|-
 +
| uint32 || dendrites starting index
 +
|-
 +
| Dendrite[number of d1 dendrites] || d1 dendrites
 +
|}
 +
 
 +
'''Dendrite'''
 +
 
 +
Not CArchive serialized:
 +
 
 +
{| border="1"
 +
|-
 +
! type !! description
 +
|-
 +
| uint32 || source (index into source lobe's cells)
 +
|-
 +
| uint8 || home x
 +
|-
 +
| uint8 || home y
 +
|-
 +
| uint8 || suscept
 +
|-
 +
| uint8 || stw
 +
|-
 +
| uint8 || ltw
 +
|-
 +
| uint8 || strength
 +
|}
  
 
== Creatures 1 CBiochemistry ==
 
== Creatures 1 CBiochemistry ==

Revision as of 02:08, 17 September 2021

MFC serialized data is used in Creatures 1 and Creatures 2 for saved worlds (.sfc files) and creatures (.exp files). Similar to CreaturesArchive data, it contains serialized objects from the game engine, essentially an on-disk representation of the internal game state. Objects are serialized using the built-in Windows MFC serialization routines.

Although the format is not fully understood, openc2e is capable of extracting enough data from SFC files to enable default worlds (or any without creatures present) to be loaded almost entirely. Its source code contains a Python script for doing this, as well as the C++ code used by the engine itself.

SFC files

SFC files (.sfc) are the world save format for Creatures 1 and Creatures 2. They contain all modifiable information about worlds - such as rooms, agents and creatures.

The default world - which the Emergency Kit and World Switcher use to reset or make a new world - is stored in Eden.sfc, and the current world in World.sfc - although you can also use different files if you're using cheats or the World Switcher. Third-party worlds come with their own SFC files.

EXP files

EXP files (.exp) are files for exported creatures in Creatures 1 and Creatures 2. EXP files include a snapshot of the chemical condition of the norn, the genetic D-DNA, the state of the norn brain and information about pregnancies. A common trick for preserving the original exp file in Creatures 1 was to open its properties and check 'read-only'. The game would not then delete the original file upon importing the creature, although it made the game hang a bit.

Common structures

MFC serialized data is a dump of binary engine data, with most objects serialized with a CArchive header.

CArchive object header

Objects serialized through CArchive start with a header which specifies whether the object is:

type description
uint16 persistent id
uint32 32-bit persistent id (only if 16-bit persistent id == 0x7FFF)

If the persistent id is 0, this is a NULL object.

If the persistent id & 0x8000 is not empty, then this is a new object using an already-seen class at persistent_id & ~0x8000.

If the persistent id is -1 (0xFFFF), then this is a new object using a new class, specified by the following:

type description
uint16 schema number
uint16 class name length
... class name in ASCII

If the persistent id is anything else, then it is a reference to an already-seen object.

New persistent ids are assigned whenever a new class is seen, and whenever a new object is seen (if both, then the new class is assigned an id first).

strings

type description
uint8 length
uint16 length (only if 8-bit length == 255)
uint32 length (only if 16-bit length == 65535)
char[length] string

Creatures 1 Object

Parent class of other objects, and appears as the first part of their data. CArchive serialized:

type description
uint8 unused portion of classifier (e.g. eventno, which makes no sense here)
uint8 species
uint8 genus
uint8 family
uint8 movement status (0 = autonomous, 1 = mousedriven, 2 = floating, 3 = invehicle, 4 = carried)
uint8 ATTR
uint32 limit_left
uint32 limit_top
uint32 limit_right
uint32 limit_bottom
Object carrier
uint8 ACTV
CGallery sprite
uint32 tick time
uint32 tick state
Object OBJP
char[4] current sound name
uint32 OBV0
uint32 OBV1
uint32 OBV2
uint32 number of scripts
Script[number of scripts] scripts

Script

Not CArchive serialized.

type description
uint8 eventno
uint8 species
uint8 genus
uint8 family
string text

Creatures 1 Entity

An object part, CArchive serialized:

type description
CGallery
uint8 current sprite
uint8 image offset
uint32 z-order (maybe a signed integer)
uint32 x
uint32 y
uint8 has animation
uint8 animation frame (only if has animation)
char[32] animation string (null-terminated) (only if has animation)

Creatures 1 CGallery

CArchive serialized:

type description
uint32 number of images
char[4] filename
uint32 first sprite
uint32 refcount
Image[number of images] images

Image

Not CArchive serialized:

type description
CGallery parent
uint8 status (bitfield: 0 = incache, 2 = ownmem, 4 = locked)
uint32 width
uint32 height
uint32 offset

SFC structures

Creatures 1 SFC file

All CArchive objects in a Creatures 1 SFC file have a schema number of 1.

type description
MapData world map
uint32 number of objects
Object[number of objects] objects
uint32 number of sceneries
Scenery[number of sceneries] sceneries
uint32 number of scripts
Script[number of scripts] scripts
uint32 scrollx
uint32 scrolly
Creature current norn
FavoritePlace[6] favorite places
uint16 size of speech history
string[size of speech history] speech history
uint32 number of macros
Macro[number of macros] macros

Script

Not CArchive serialized.

type description
uint8 eventno
uint8 species
uint8 genus
uint8 family
string text

FavoritePlace

Not CArchive serialized.

type description
string name
uint16 x
uint16 y

Creatures 1 MapData

CArchive serialized:

type description
uint32 unknown, always zero
uint32 time of day
CGallery background sprite
uint32 number of rooms
Room[number of rooms] rooms
uint32[261] groundlevel
Bacterium[100] bacteria

Room

Not CArchive serialized:

type description
uint32 left
uint32 top
uint32 right
uint32 bottom
uint32 type (0=Indoors, 1=Surface, 2=Undersea)

Bacterium

Not CArchive serialized:

type description
uint8 state (0 = Not present, 1 = Dormant, 2 = Active)
uint8 antigen
uint8 fatal_level
uint8 infect_level
uint8 toxin1
uint8 toxin2
uint8 toxin3
uint8 toxin4

Creatures 1 Macro

Currently running scripts, CArchive serialized:

type description
uint32 destroy object afterwards
uint32 INST
uint32 text length?
string script
uint32 instruction pointer
uint32[20] stack
uint32 stack pointer
uint32[10] vars
Object OWNR
Object FROM
Object EXEC
Object TARG
Object _IT_
uint32 PART
char[4] label of most recently visited subroutine
uint32 address of most recently visited subroutine
uint32 WAIT

Creatures 1 Scenery

Subclass of Object:

type description
Entity part

Creatures 1 SimpleObject

Subclass of Object:

type description
Entity part
uint32 z-order (should match the part's z-order)
uint8[3] click bhvr
uint8 touch bhvr

Creatures 1 PointerTool

Subclass of SimpleObject:

type description
sint32 relx
sint32 rely
Bubble speech bubble
char[25] text (null-terminated)

Creatures 1 Bubble

Subclass of SimpleObject:

type description
uint8 life
uint32 creator
char[25] text (null-padded)

Creatures 1 CallButton

Subclass of SimpleObject:

type description
Lift
uint8 button id

Creatures 1 CompoundObject

Subclass of Object:

type description
uint8 number of parts
CompoundPart[number of parts] parts
Hotspot[6] hotspots
uint32[6] functions_to_hotspot

CompoundPart

Not CArchive serialized:

type description
Entity entity
sint8 x
sint8 y

Hotspot

Not CArchive serialized:

type description
sint32 left
sint32 top
sint32 right
sint32 bottom

Creatures 1 Vehicle

Subclass of CompoundObject:

type description
sint32 x velocity * 256
sint32 y velocity * 256
sint32 coordx * 256
sint32 coordy * 256
uint32 cabin left
uint32 cabin top
uint32 cabin right
uint32 cabin bottom
uint32 bump

Creatures 1 Lift

Subclass of Vehicle:

type description
uint32 number of floors
uint32 next or current floor
sint32 current call button
uint8 delay counter
uint32 floors[0].y
CallButton[8] callbuttons

Creatures 1 Blackboard

Subclass of CompoundObject:

type description
uint8 background color
uint8 chalk color
uint8 aliascolor
uint8 text x position
uint8 text y position
BlackboardWord[16] words

BlacboardWord

Not CArchive serialized:

type description
uint32 value
char[11] text (null-terminated)

Creatures 1 Creature

Subclass of Object. Same as in EXP files.

EXP structures

Creatures 1 EXP file

All CArchive objects in a Creatures 1 EXP file have a schema number of 1.

type description
Creature exported creature
CGenome genome
CGenome child genome (e.g. the zygote) (only if pregnant)

Creatures 1 Creature

Subclass of Object:

type description
char[4] moniker
char[4] mother's moniker
char[4] father's moniker
Body body
Limb head
Limb left thigh
Limb right thigh
Limb left arm
Limb right arm
Limb tail
uint8 direction facing
uint8 downfoot (0=left 1=right)
uint32 foot x
uint32 foot y
uint32 z-order
string current pose
uint8 expression (0=normal 1=happy 2=sad)
uint8 eyes open
uint8 asleep
string[100] poses
string[8] gait_animations
CreatureVocabulary[80] vocabulary
ObjectPosition[40] remembered object positions
Stimulus[36] stimuli
Brain brain
Biochemistry biochemistry
uint8 sex
uint8 age
uint32 biological tick
char[4] gamete (my moniker)
char[4] zygote (child's moniker, if pregnant)
uint8 dead
uint32 age in ticks
uint32 number of instincts to be processed
uint32 dreaming
CInstinct[number of instincts to be processed] instincts
Goal[40] goals for remembered objects
SimpleObject zzzz
SimpleObject stars
SimpleObject bubbles
uint32 status of hand before it was disregarded
uint32 voice_lookup_table[0][0] (NOTE: voice data is similar to VCE files, but the lookup table comes first)
... up through voice_lookup_table[0][26], inclusive
... up through voice_lookup_table[2], inclusive
char[4] voices[0].name
uint32 voices[0].delay_ticks
... up through voices[31], inclusive
char[4] history_moniker
string history_name
char[4] history_moms_moniker
string history_moms_name
char[4] history_dads_moniker
string history_dads_name
string history_birthday
string history_birthplace
string history_owner_name
string history_owner_phone
string history_owner_address
string history_owner_email
uint32 history_state (0=ok 1=dead 2=exported)
uint32 history_gender
uint32 history_age_in_seconds
? padding

CreatureVocabulary

Not CArchive serialized:

type description
string in
string out
uint32 strength

ObjectPosition

Not CArchive serialized:

type description
uint32 x
uint32 y

Stimulus

Not CArchive serialized:

type description
uint8 significance
uint8 input
uint8 intensity
uint8 features (bitfield, 0=modulate 2=iprange 4=ifasleep)
uint8 chemical0
uint8 amount0
uint8 chemical1
uint8 amount1
uint8 chemical2
uint8 amount2
uint8 chemical3
uint8 amount3

Goal

Not CArchive serialized:

type description
uint32[17] drives

Creatures 1 BodyPart

Subclass of Entity:

type description
uint32 angle
uint32 view

Creatures 1 Body

Subclass of BodyPart:

type description
uint8 body_data[0][0].x
uint8 body_data[0][0].y
... up through body_data[0][9], inclusive
... up through body_data[5], inclusive

Creatures 1 Limb

Subclass of BodyPart:

type description
LimbData[10] limbdata
Limb next limb

LimbData

Not CArchive serialized:

type description
uint8 startx
uint8 starty
uint8 endx
uint8 endy

Creatures 1 CBrain

CArchive serialized:

type description
uint32 number of lobes
Lobe[number of lobes] lobes
Neuron[...] neurons (number depends on counts inside each lobe)

Lobe

Not CArchive serialized:

type description
uint32 x
uint32 y
uint32 width
uint32 height
uint32 perceptible (0 = no 1 = yes 2 = mutually exclusive)
uint8 activity
uint8[4] chemicals
uint8 threshold
uint8 leakage
uint8 reststate
uint8 inputgain
uint8[10] svrule
uint8 flags
DendriteType d0_type
DendriteType d1_type
uint32 number of neurons (should be width * height)
uint32 number of dendrites

DendriteType

Not CArchive serialized:

type description
uint32 source lobe
uint8 min
uint8 max
uint8 spread
uint8 fanout
uint8 min ltw
uint8 max ltw
uint8 min strength
uint8 max strength
uint8 migration
uint8 relaxsuscept
uint8 relaxstw
uint8 ltw gain rate
uint8 gain rate
uint8 lose rate
uint8[10] gain rule (these svrules might be out of order?)
uint8[10] lose rule
uint8[10] suscept rule
uint8[10] reinforce rule

Neuron

Not CArchive serialized:

type description
uint8 x
uint8 y
uint8 output
uint8 state
uint8 wta disable (maybe this is a u4 and flag2 is the other u4?)
uint8 unknown (maybe this is u4 flag3 and u4 flag4?)
uint8 number of d0 dendrites
uint32 dendrites starting index
Dendrite[number of d0 dendrites] d0 dendrites
uint8 number of d1 dendrites
uint32 dendrites starting index
Dendrite[number of d1 dendrites] d1 dendrites

Dendrite

Not CArchive serialized:

type description
uint32 source (index into source lobe's cells)
uint8 home x
uint8 home y
uint8 suscept
uint8 stw
uint8 ltw
uint8 strength

Creatures 1 CBiochemistry

CArchive serialized:

type description
Creature owner
uint32 number of emitters
uint32 number of receptors
uint32 number of reactions
ChemicalData[256] chemicals
Emitter[number of emitters] emitters
Receptor[number of receptors] receptors
Reaction[number of reactions] reactions

ChemicalData

Not CArchive serialized:

type description
uint8 concentration
uint8 decay

Emitter

Not CArchive serialized:

type description
uint8 organ
uint8 tissue
uint8 locus
uint8 chemical
uint8 threshold
uint8 rate
uint8 gain
uint8 effect

Receptor

Not CArchive serialized:

type description
uint8 organ
uint8 tissue
uint8 locus
uint8 chemical
uint8 threshold
uint8 nominal
uint8 gain
uint8 effect

Reaction

Not CArchive serialized:

type description
uint8 reactant1_amount
uint8 reactant1_chemical
uint8 reactant2_amount
uint8 reactant2_chemical
uint8 rate
uint8 product1_amount
uint8 product1_chemical
uint8 product2_amount
uint8 product2_chemical

Creatures 1 CInstinct

CArchive serialized:

type description
InstinctDendrite[3] dendrites to be stimulated
uint32 decision to be taken (motor)
uint32 reinforcement chemical (reinforcer)
uint32 reinforcement amount
uint32 phase

InstinctDendrite:

Not CArchive serialized:

type description
uint32 lobe
uint32 cell

Creatures 1 CGenome

CArchive serialized:

type description
uint32 length, in bytes, of genes data
char[4] moniker
uint32 sex (1=male 2=female)
uint8 life stage
... genes data, as in GEN files

External links