Skip to content

Instantly share code, notes, and snippets.

@ammaraskar
Last active December 29, 2023 01:15
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ammaraskar/62f4af3a02e82e0ea11be62999854194 to your computer and use it in GitHub Desktop.
Save ammaraskar/62f4af3a02e82e0ea11be62999854194 to your computer and use it in GitHub Desktop.

Sims 2 Effects Editing

Sims2 has a pretty versatile effects system, these are used for some things you might expect, such as the smoke and sparks coming out of the UFOs in strangetown:

image

However, they are also used for things you might not expect such as the plumbobs floating over buildings in the neighborhood view and even the fly throughs that play when you load into a neighborhood.

The compiled versions of these effects live in the Res/Effects/effects.package. While we have done some work to decode the overall structure and some fields of that format here, there is now a much easier way to edit these effects.

LazyDuchess and I found that the game still looks for and compiles these effects from their developer friendly textual representations. This means that you can now edit and make new effects using the same scripting format that the original Sims 2 artists did.

The File

Sims2 looks for a file under TSBin\Plugins called main.fx. So for example if you have all the expansions you would create a text file The Sims 2 Ultimate Collection\Fun with Pets\SP9\TSBin\Plugins\main.fx.

This file should contain the effects you want to add/override. So for example, we can override the afformentioned smoke coming from the strangetown UFOs to be giant orbs that turn from green to red:

particles test
  life 5
  rate 30
  source -point
  emit -dir (0, 0, 1) 1 -speed 5
  texture "effects-puff"

  color (0.0, 1.0, 0.0) (1.0, 0.0, 0.0)
end

effect neighborhood_house_smoking
   particleEffect test
end

and we get:

image

I have a giant dump of effect names from the base game here.

Syntax

The basic structure of the file is a list of blocks like

<effect_type> <name> <effect_options>
  <effect_parameter_1>
  <effect_parameter_1>
end

We haven't really fully explored the options of the effects system but there are a few types of effects used in Sims 2:

  • particles
  • decal
  • camera
  • model
  • screen

The effect type is the root of visual effects and contains the effect name used in the game's scenegraph assets.

Each of these types of effects has its own set of parameters. Almost every parameter can be given a "curve" of values that change over its lifetime, so for example instead of just alpha 0.3 you can do alpha 0.1 0.3 1 to make a particle that starts faded out and becomes more opaque.

Here are some parameters we know:

Particles

life - How long the particle should last in seconds.

rate - The number of particles spawned per second.

source - Defines where the particles come from, can be made into different shapes somehow.

emit -dir (x, y, z) -speed <speed> - Which direction to emit particles into and at what speed.

alpha - The transparency of the spawned particles.

color - The color of the spawned particles.

Flythroughs

As mentioned in the intro, flythroughs when loading into a hood are actually powered by this effects system. For example this turns the strangetown flythrough into a very spinny time in the ground:

camera my_custom_flythrough
   life 10
   heading 0 1 2 3 4 5 6 7 8 9 10 11 12
end

effect strangetown_flythroughfx
   cameraEffect my_custom_flythrough
end

This works for any hood in the game as long as you make an effect called <hood_name>_flythroughfx

Learn More

If you are going to play around with this, I highly recommend grabbing LazyDuchess's TS2-HiddenCheats from here: https://github.com/LazyDuchess/TS2-HiddenCheats It is meant to be used with Sims2RPC and it will show errors when parsing the fx file in a console so you can actually debug when effects aren't loading and why:

image

You can learn more about the particle effect's system from its developer Andrew Willmott here: https://www.andrewwillmott.com/talks/swarm-procedural-content

Some notes from me reverse-engineering the binary effects format can be found here: LazyDuchess/OpenTS2#7

@ammaraskar
Copy link
Author

Known commands per effect type (syntax not known yet). I'll update this as I go along.

particles

  • color
  • alpha
  • size
  • aspect
  • rotate
  • source
  • emit
  • force
  • attractor
  • warp
  • randomWalk
  • stretch
  • life
  • rate
  • inject
  • maintain
  • material
  • texture
  • frames
  • align
  • collide
  • terrainCollide
  • terrainRepel
  • deathEffect
  • path
  • collider-plane
  • billboardMaterial

effect

  • color
  • alpha
  • size
  • aspect
  • rotate
  • source
  • emit
  • force
  • attractor
  • path
  • warp
  • randomWalk
  • life
  • rate
  • inject
  • maintain
  • collide
  • terrainCollide
  • terrainRepel

decal

  • color
  • alpha
  • size
  • aspect
  • rotate
  • life
  • texture

camera

  • control
  • life
  • heading
  • pitch
  • roll
  • fov
  • nearClip
  • farClip
  • orbit

model

  • name

screen

  • mode
  • strength
  • length
  • color
  • texture

sequence

?

@ammaraskar
Copy link
Author

Example of what the textual version of one of the neighborhood decals looks like:

decal neighborhood_farmfields03
  texture "neighborhood-decals-farmfield03"

  life 20
  alpha 0.8
  size 90
end

effect neighborhood_farmfields1
   decalEffect neighborhood_farmfields03
end

Swapped out with the swan texture:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment