
Motive.c: The Soul of the Sims (1997) - mountainplus
http://www.donhopkins.com/home/images/Sims/
======
blixt
I wanted to get a feel for the logic so I made a quick carbon copy in
JavaScript with a simple UI to play with:

[https://codepen.io/blixt/pen/ayyjpZ](https://codepen.io/blixt/pen/ayyjpZ)

~~~
DaiPlusPlus
I noticed this (the original code, and your implementation) seems to only
describe the "state of feelings" for a simulant and how they generally only
get worse over time. I'm now keen to see the code that then provides direction
and action for the sim based on this state; e.g. "I'm feeling hungry, I should
eat, what should I eat?" and the process that determines what it should eat -
and how to go about it. I know The Sims employed more than just A*-towards-
nearest-unoccupied-food-source, but what makes a Sim choose hamburgers from
the outdoor grill over making dinner in the kitchen?

~~~
DonHopkins
This demo (starting at 13:06) shows how the SimAntics visual programming
language works, and how objects publish advertisements for their available
actions (which show up on the pie menus that the user can select, or which the
characters can autonomously choose to perform).

[https://www.youtube.com/watch?v=-exdu4ETscs&t=13m6s](https://www.youtube.com/watch?v=-exdu4ETscs&t=13m6s)

Advertisements appeal to characters based on their current motivations
(feelings, hunger, etc), their distance from the object, their relationship
with the object (so you prefer to sleep in your own bed), and SimAntics
scoring functions that can perform arbitrary calculations.

Then it shows how all that works together in the "Food Chain", a complex Rube
Goldberg device comprised of many different objects, that compels characters
to perform the many sequential steps required to prepare and eat food (when
then compels them to poop, which makes them need a shower, which makes them
tired, and so on).

The main loop of the "autonomy" algorithm that decides what to do next (if you
don't tell them what to do) searches for the top several advertisements with
the highest score, and then chooses randomly between them. If they always
chose the top scoring best thing to do, then their lives would be too
mechanically optimized, lacking in whimsey and spontaneity, and anything the
user told them to do would deviate from the optimal path, making their lives
less efficient, more miserable.

So for better game play and happier users, we randomly dumbed them down a bit
so they needed the user's guidance to have a better life (but we didn't make
them so dumb that users couldn't fuck up their lives even more, either).

[http://simswiki.info/wiki.php?title=SimAntics](http://simswiki.info/wiki.php?title=SimAntics)

~~~
DaiPlusPlus
> If they always chose the top scoring best thing to do, then their lives
> would be too mechanically optimized, lacking in whimsey and spontaneity, and
> anything the user told them to do would deviate from the optimal path,
> making their lives less efficient, more miserable.

Couldn't they add a "monotony" factor to the SimMotive struct that increases
as their daily life becomes too uniform, which in-turn leads to greater
overall unhappiness if it's too monotonous, or greater overall stress if their
days become entirely unpredictable?

~~~
harryjo
That would cost more CPU for the same result.

~~~
DonHopkins
The trick of optimizing games is to off-load as much as the simulation from
the computer into the user's brain, which is MUCH more powerful and creative.
Implication is more efficient (and richer) than simulation.

During development, when we first added Astrological signs to the characters,
there was a discussion about whether we should invent our own original "Sim
Zodiac" signs, or use the traditional ones, which have a lot of baggage and
history (which some of the designers thought might be a problem).

Will Wright argued that we actually wanted to leverage the baggage and history
of the traditional Astrological signs of the Zodiac, so we should just use
those and not invent our own.

The way it works is that Will came up with twelve archetypal vectors of
personality traits corresponding to each of the twelve Astrological signs, so
when you set their personality traits, it looks up the sign with the nearest
euclidian distance to the character's personality, and displays that as their
sign. But there was absolutely no actual effect on their behavior.

That decision paid off almost instantly and measurably in testing, after we
implemented the user interface for showing the Astrological sign in the
character creation screen, without writing any code to make their sign affect
their behavior: The testers immediately started reporting bugs that their
character's sign had too much of an effect on their personality, and claimed
that the non-existent effect of astrological signs on behavior needed to be
tuned down. But that effect was totally coming from their imagination!

They should call them Astrillogical Signs!

~~~
DonHopkins
The create-a-sim user interface hid the corresponding astrological sign for
the initial all-zero personality you first see before you've spent any points,
because that would be insulting to 1/12th of the players (implying [your sign]
has zero personality)!

[https://www.youtube.com/watch?v=ffzt12tEGpY](https://www.youtube.com/watch?v=ffzt12tEGpY)

------
DonHopkins
Here's some more Sims stuff:

[http://donhopkins.com/home/TheSims](http://donhopkins.com/home/TheSims)

[http://donhopkins.com/home/TheSimsDesignDocuments](http://donhopkins.com/home/TheSimsDesignDocuments)

------
pavlov
Something about this program reminds me of the text-mode BASIC games that used
to be published in books and magazines in the 1980s.

I remember typing the programs and simultaneously trying to imagine how the
simple logic I was entering might build up to something awesome that could be
lurking there, just out of my sight between the numbered lines. Most of the
time it was a disappointment, but a few of those games did manage to elevate
themselves to some kind of unexpected, exciting life that I couldn't have
known from just reading the program.

(Of course my standard for excitement was very low.)

~~~
yawaramin
You have a point. In a certain light, The Sims is a more complex version of
Conway's Game of Life, with its simple life-or-death rules for the cells in
the game.

------
frik
Could be one of the few lines of source code survived, as an small office fire
in 2001 caused troubles.

Basically the predecessor of The Sims was SimTown (also by Maxis). It was a
smaller scale SimCity meets The Sims gameplay.
[https://en.wikipedia.org/wiki/SimTown](https://en.wikipedia.org/wiki/SimTown)

Later SimsVille was meant to evolve the gameplay in the same direction again,
though it go canceled (source code lost due office fire).
[https://en.wikipedia.org/wiki/SimsVille](https://en.wikipedia.org/wiki/SimsVille)

Almost all the [Maxis] games development data was lost during a small office
server room fire [in 2001], that resulted in most of the game being developed
again from scratch, according to this source:
[https://www.unseen64.net/tag/maxis/](https://www.unseen64.net/tag/maxis/)

~~~
frik
Initial 1996 design document of The Sims, when it was still called "Happy-
Friends-Home" from the same website:
[http://donhopkins.com/home/TheSimsDesignDocuments/HappyFrien...](http://donhopkins.com/home/TheSimsDesignDocuments/HappyFriendsHome-2-10-96.pdf)

------
asciimo
I had a revelation while playing the Sims, and this code lays it bare. I found
I was spending more time managing these values for my Sim than I was for
myself. I have not enjoyed most single player games since.

~~~
seanp2k2
Realizing that _Sims_ games are really meta-games about life is how you
actually win any _Sims_ game. The only winning move is not to play.

------
wolco
Love how simple it is. A good lesson for anyone trying to kaie a gake. Make
the core simple and that will allow complex interactions hetween them.

~~~
pavel_lishin
> _kaie a gake_

What does that mean?

~~~
delinka
I assumed "make a game" as typed on a mobile device without autocorrect.

~~~
0x0
m->k and k->i looks like the right hand on the keyboard was misaligned one row
too high.

~~~
jklein11
Wouldnt that be "jaie a gaje"? The k and m are offset in different directions.
This looks like the kind of havoc a mobile keyboard would wreak.

~~~
0x0
Nah. Depends if you're going slightly "north-east" or slightly "north-west".
Also probably depends on your locale.

------
ENTP
I always thought sims borrowed the idea from Little Computer People (~1985)
[https://en.m.wikipedia.org/wiki/Little_Computer_People](https://en.m.wikipedia.org/wiki/Little_Computer_People)

------
trynewideas
looks like someone copied the code over here:
[https://github.com/AlexanderPatrick/MPhil/blob/7592cd0dfe7c4...](https://github.com/AlexanderPatrick/MPhil/blob/7592cd0dfe7c495c94a3037504e390598dcdfb76/Assets/Scripts/Sims/Sim.cs)

------
bluejekyll
Is there an advantage to storing this as an array, indexed by enum, rather
than a strict of 16 floats?

I can't think of a reason. Having to index by enum seems like it could be
error prone.

Also, in the init(), instead of looping over all indexes of the array and
setting 0, couldn't a memset be used?

~~~
buzzybee
It enables the coder to engage in some late binding without engaging in a lot
of casts or more elaborate metaprogramming: the enum index used for assignment
is itself an assignable value and therefore can be passed around and
manipulated if the algorithm needs it. It's a very intentional tradeoff of
structure and long-term clarity for a faster turnaround to make design
changes.

I haven't even checked to see if the final program uses it. It's the kind of
thing, though, that you might go in thinking, "maybe I will need that", and it
doesn't add too much overhead to your prototype.

------
mjbellantoni
Is there a bug in the line computing Motive[mHappyWeek]? It seems like it
should have Motive[mHappyDay] instead of Motive[mHappyNow] on the right hand
side.

------
Dowwie
What would this look like if it were using behavior trees, hierarchical fsm,
or whatever the prevailing pattern is used today?

~~~
DonHopkins
That code is just a prototype, the seed around which the rest of the game
nucleated. There is a big thick layer of behavior trees, hierarchal state
machines and lots of whatever layered on top, including a visual behavior tree
programming language called "SimAntics" and an editing tool called "Edith",
which is described and demonstrated here (starting at 11:20):

[https://www.youtube.com/watch?v=-exdu4ETscs](https://www.youtube.com/watch?v=-exdu4ETscs)

Here's another demo of some tools for making and managing user created content
for The Sims, and SimSlices's amazing version of SimCity embedded in The Sims!

[https://www.youtube.com/watch?v=Imu1v3GecB8](https://www.youtube.com/watch?v=Imu1v3GecB8)

~~~
DonHopkins
To clarify: SimAntics, the behavior tree visual programming language actually
existed before Will wrote the "Soul of the Sims".

SimAntics was used in SimCopter for controlling the little Sims with simpler
souls who walked around the city, for dispatching the police, firemen and
medics who picked up injured Sims and brought them back to the helicopter, as
well for implementing the notorious gay easter-egg with a bug that caused
hundreds of shirtless "himbos" in fluorescent fog-piercing speedos (using the
same special render as runway lights) to swarm all over the city hugging and
kissing on Friday the 13th!

[https://en.wikipedia.org/wiki/SimCopter](https://en.wikipedia.org/wiki/SimCopter)

[https://www.youtube.com/watch?v=x4mh7Pc5MSI](https://www.youtube.com/watch?v=x4mh7Pc5MSI)

[https://www.youtube.com/watch?v=ozL3LtSsYd8](https://www.youtube.com/watch?v=ozL3LtSsYd8)

------
rburhum
The simplicity makes it beautiful.

------
brian-armstrong
The formatting in this code is atrocious. It's so much harder to find bugs
when the code itself is so disorganized

~~~
blixt
This code was not made for bug fixing though, it’s just a prototype - the
expression of an idea. The accompanying text even says as much - of course the
final game couldn’t possibly have a single sim’s mood in a global variable.

