Introduction To SimAntics

SimAntics is a CISC bytecode language which powers the objects in The Sims and The Sims Online.

Development of SimAntics was coordinated by Jamie Doornbos with the help of Patrick J. Barrett III and Don Hopkins.

Model

SimAntics assembly is assembled into bytecode which is executed within a virtual thread granted to that object. Altogether, the virtual threads are executed synchronously (one after the other) in a nonpreemptive virtual machine, the SimAntics environment.

Each object eventually relinquishes its control to the next object by calling the idle primitive or returning error; a return value of error tells the machine to kill the object and remove it from the lot, and in debug builds of the game, prompting a message that the object has crashed and providing its stack dump.

Terminology

  • action
  • advertisement
  • attenuation
  • autonomy
  • behavior
  • bitfield
  • check
  • entry point
  • function
  • global
  • local
  • menu
  • node
  • object definition
  • parameter
  • primitive
  • private
  • scenario
  • semiglobal
  • slot
  • stack object
  • tree
  • tuning constant
  • variable

Initialisms

  • SAS, CAS: Select-A-Sim, Create-A-Sim
  • GZ: Gonzo, a Maxis game development framework
  • RZ: Rizzo, built on top of Gonzo
  • EASTL: EA's Standard Template Library replacement, now released under the GPL: https://github.com/paulhodge/EASTL
  • LMS: Language Markup System
  • EOD: What it stands for is unknown, but it refers to custom menus that override the panel at the bottom of the screen when your Sim is dancing or playing black jack, for example.
  • AWC

Text language

Edith provides a menu option (File -> Save all behaviors…) that disassembles all of the behaviors in the game into txt files, categorized by their containing IFF files. Before looking at the binary structure of behaviors, it helps to first look at this text representation.

The first line of the disassembly is the name of the IFF file, sans the file extension. For example, in behaviorscuckooclock.txt,
cuckooclock

Following this line is the disassembly for each behavior in the IFF file, sorted by ascending chunk ID. The first behavior in cuckooclock.iff is named "main":
(main).000 Stack Object ID 0 assign ( := ) My object id true:1
(main).001 Global: Idle (with ticks=10) true:2
(main).002 Private: process true:1

As in C and C++, the main function is where execution for the object begins. When our particular object is added to the lot and run for the first time in Live mode, the object's ID will be written into the "Stack Object ID 0" variable. Upon true, it will branch to the instruction at index 1—in our case, simply the next one down. As the branch destination for false has not been specified, it is implicitly defined to error; that is, if the result of the instruction were false, the program would "branch" to error, deleting itself and informing the virtual machine that it has "crashed". Note that an object can delete itself off the lot at any time, without informing the virtual machine of a crash, by simply branching to true or false in the main function. The cuckooclock does not ever delete itself, however, so the only way to remove it is by selecting it with the hand tool and deleting it, which can be seen as "force closing" the process.

The second instruction performs the "idle for X ticks" global with X=10; this relinquishes the object's execution context and returns true after 10 ticks have passed; in response, the program will branch to the instruction at index 2.

The third instruction calls a private subroutine named "process" defined in the very same IFF file and then branches back to the previous instruction. In this short loop, we can see that this subroutine, "process", must return true to hand the context back to the virtual machine.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License