# Real-Time Body Physics (RTBP) by CPVC

### Version v0.4-p8 - Apr 12 2024

# Disclaimer

Play with this at your own risk. I recommend you back up your save files or start a new throw-away game before trying it. I am not liable for any damage this mod does to your computer.

If your firewall complains about The Sims 4 attempting to listen on port 8008 (BOOB) or 8009 (BOOB+1), that's just the command and simulation servers for the mod.

# Installation

1. Move "d3d9.dll" to "...\[TS4_INSTALL_DIR]\Game\Bin\". It should be in the same directory as "TS4_x64.exe". Currently, this mod only works with the 64 bit version of The Sims 4.
2. Move "RTBP" to "...\[MY_DOCUMENTS]\Electronic Arts\The Sims 4\". This directory will house your settings file and log file once it is generated.
3. Copy the folder "RTBP Mod" to "...\[MY_DOCUMENTS]\Electronic Arts\The Sims 4\Mods\".

RTBP can work with ReShade and GShade. Rename the ReShade/GShade "d3d9.dll" to "reshade.dll" and leave it in "...\[TS4_INSTALL_DIR]\Game\Bin\", the same folder as RTBP's "d3d9.dll" and "TS4_x64.exe".

Alternatively, the names "ReShade64.dll", "GShade64.dll", and "ChainD3D9.dll" are also picked up by RTBP and used if they exist.

# Settings

The settings file, located at ...\[MY_DOCUMENTS]\Electronic Arts\The Sims 4\RTBP\Settings.ini" can be modified to change the behavior of the mod.

The section "rtbp.general" is for general settings of the mod, like if you want to start the debug command server or if you want to enable/disable breast and butt physics.

The section "rtbp.leftBreast" sets the settings that control the spring physics of the left breast. If you don't know what these settings do, please read the next section "Simulation Settings".

I think the rest is self-explanatory.

# Advanced Settings: Debug Flags

You can skip this section if you don't want to mess around with debug flags. Most people probably won't.

Debug flags can be set in your settings file, but they're a special case compared to other settings. Debug flags need to be explicitly defined to make them persist in your settings file. When saving your settings file, your "[rtbp.debugFlags]" section will be transfered over, but any debug flags you set using the Commander or through manually entering commands will not be written to your settings file.

This is for safety. Debug flags should not be taken lightly. Testing out alternate breasts and butt physics modes is usually ok, but some debug flags can crash your game or worse. Debug flags need to be tested first, but do this at your own risk. If you like what they do and everything is stable, you may enable debug flags in your settings file.

The default value for every debug flag is "false". As soon as a debug flag is referenced in RTBP, it will be defined and will show up in the commander. If you add an entry to your "[rtbp.debugFlags]" section, but set the value to "false", the entry will be completely ignored.

Debug flags are subject to change and you cannot rely on them working the same way or even existing across different versions of RTBP.

# Simulation Settings

RTBP is based off spring physics. The following settings can be modified through the settings file or by sending commands directly to RTBP in-game.

- angulardamping (ANG_DAMPING): Defines the angular damping variable.
- angularspringk (ANG_SPRING_K): Defines the angular spring K variable.
- damping (DAMPING): Damping is how fast the bouncing stops. Kinda like friction on the spring. Higher values make the bouncing stop quicker.
- gravity (GRAVITY): Gravity is the gravity constant of the simulations, a constant downward force acting on the springs in meters per second. "9.80665" is the gravity of earth. RTBP assumes every sim is 1.7272 meters tall, or 5'8". Higher gravity levels will will make everything sag much more. I wouldn't play with this one either, unless you'd like to pretend your sims live on another planet or if they're training to fight Cell or something.
- mass (MASS): Mass is how heavy the body part is (in kilograms). How resistant it is to its position changing. Higher values will make the targeted body parts heavier in the simulation.
- maxx (MAX_X): max(X|Y|Z) defines how far a simulator can deviate from its target position on the specified axis in the positive direction.
- maxy (MAX_Y): max(X|Y|Z) defines how far a simulator can deviate from its target position on the specified axis in the positive direction.
- maxz (MAX_Z): max(X|Y|Z) defines how far a simulator can deviate from its target position on the specified axis in the positive direction.
- minx (MIN_X): min(X|Y|Z) defines how far a simulator can deviate from its target position on the specified axis in the negative direction.
- miny (MIN_Y): min(X|Y|Z) defines how far a simulator can deviate from its target position on the specified axis in the negative direction.
- minz (MIN_Z): min(X|Y|Z) defines how far a simulator can deviate from its target position on the specified axis in the negative direction.
- power (POWER): Power is is the multiplier for the force that acts on the simulations. At "1.0" the force is unchanged. "2.0" is double, "0.5" is half. I don't recommend playing with this one. I put it in for debugging purposes and will probably remove it in the future.
- springk (SPRING_K): The springK constant defines the spring characteristics of the simulation. Basically how elastic the spring is and how it will respond when force acts upon it. Google "Hooke's Law" for more information. Higher values will make the spring act more springy. "For every action, there is an equal and opposite reaction."

# Commands

You can send commands to RTBP in-game. Start each command with "rtbp.command" then send your command enclosed in quotation marks. Note that this method only works in-game, so you won't be able to send commands in Create a Sim.

Alternatively, you can send commands to RTBP using the RTBP Commander tool. These commands will work in CAS and is the preferred way of tweaking RTBP to your liking.

- dumpSimBuffers: [DIRECTORY] [(OPTIONAL)OUTFIT_INDEX] Saves the geometry of all known sim buffers, or optionally all known sim buffers matching an outfit index, in the Wavefront OBJ format to the directory [DIRECTORY]. These files can be imported into a 3D modeling program like Blender to examine them. Unless you know what you're doing, you won't ever need to execute this command.
- forceQuit: (DEBUG COMMAND) Force the game to quit immediately.
- forceTest: When you really need to know whether RTBP is working or not.
- getDebugFlag: [NAME] (DEBUG COMMAND) Gets the value of a debug flag.
- getPath: [PATH_NAME] Prints the path associated with the specified path name. Valid names are "install", "ts4docs", and "rtbpdocs".
- getSpringValue: [TARGET] [VARIABLE] Prints the value of spring [TARGET], variable [VARIABLE].
- help: [COMMAND_NAME] Prints the help string associated with the specified command.
- listSimTargetss: [TARGET_NAME](Optional) Lists all the simulator targets if no arguments are provided or the simulator target specified by [TARGET_NAME] if it exists.
- listCommands: Lists all registered commands.
- listDebugFlags: (DEBUG COMMAND) Lists all known debug flags and their values.
- listSimBuffers: Lists all known sim buffers and their debug information.
- listSimOutfits: [INDEX](Optional) Prints a summary of all known sim buffers, organized by outfit index. Outfits are groups of sim buffers loaded sequentially when a new sim needs to be rendered.
- loadSettings: [SETTINGS_FILE] Loads the specified settings file and resets all the simulators.
- messageBox: [TITLE] [MESSAGE] Opens a message box with the title "[TITLE]" and message "[MESSAGE]".
- openLogFile: Opens RTBP's log file in notepad.
- ping: Outputs the string "Pong!". No, really, that's all it does.
- printBenchmark: *Experimental* Prints the estimated amount of time that RTBP adds to the Sims 4 rendering loop.
- printFOV: *Currently not implemented.*
- printFPS: Prints the current frames per second of the Sims 4.
- printLog: Prints all lines of the log file.
- printMemory: [ADDRESS] [TYPE] (DEBUG COMMAND) Highly experimental. Don't touch unless you want to crash your game.
- printSettings: Prints all current settings.
- printTime: Prints the current time relative to RTBP's initialization time.
- reloadDynamicLib: Reloads the dynamic library.
- reset: Instructs RTBP to reload the Settings.ini file and apply the settings found within to all active simulators.
- saveSettings: Creates a backup of the existing Settings.ini file then writes a new one using the current settings.
- setDamping: [TARGET] [VALUE] Sets the damping of body part [TARGET] to [VALUE].
- setDebugFlag: [NAME] [VALUE] (DEBUG COMMAND) Sets the value of a debug flag. You won't need to mess with this command unless CPVC asks you to.
- setEnabled: [VALUE] Enables/disables RTBP temporarily.
- setEnabledSpeeds: [PAUSED] [NORMAL] [FAST] [FASTER] Sets the speeds RTBP will simulate at. By default, RTBP only simulates at normal speed.
- setGeneralSetting: [NAME] [VALUE] Sets the value of one of the variables in the [rtbp.general] section. You may need to save the settings and restart the game to see the changes.
- setGravity: [TARGET] [VALUE] Sets the gravity of body part [TARGET] to [VALUE].
- setHalted: [VALUE] (DEBUG COMMAND) RTBP halts the Sims 4 while still handling commands. Useful if you want to halt the game and analyze its memory.
- setMass: [TARGET] [VALUE] Sets the mass of body part [TARGET] to [VALUE].
- setMax: [TARGET] [X] [Y] [Z] Sets the maximum distance a simulator can differ from its target location in the positive direction.
- setMaxX: [TARGET] [VALUE] Sets the maximum distance a simulator can differ from its target location in the positive X axis.
- setMaxY: [TARGET] [VALUE] Sets the maximum distance a simulator can differ from its target location in the positive Y axis.
- setMaxZ: [TARGET] [VALUE] Sets the maximum distance a simulator can differ from its target location in the positive Z axis.
- setMin: [TARGET] [X] [Y] [Z] Sets the maximum distance a simulator can differ from its target location in the negative direction.
- setMinX: [TARGET] [VALUE] Sets the maximum distance a simulator can differ from its target location in the negative X axis.
- setMinY: [TARGET] [VALUE] Sets the maximum distance a simulator can differ from its target location in the negative Y axis.
- setMinZ: [TARGET] [VALUE] Sets the maximum distance a simulator can differ from its target location in the negative Z axis.
- setPower: [TARGET] [VALUE] Sets the power of body part [TARGET] to [VALUE].
- setSpringK: [TARGET] [VALUE] Sets the spring K of body part [TARGET] to [VALUE].
- setSpringValue: [TARGET] [VARIABLE] [VALUE] Sets the value of spring [TARGET], variable [VARIABLE], to [VALUE].
- showLogo: Shows the RTBP logo in the upper left of the screen again.
- test: [AXIS] Tests all simulators on the axis specifed. Valid values are 'x', 'y', and 'z'. If no axis is specified, 'y' is assumed.
- testAngular: Angular physics are experimental. Currently physics only work on the X axis. If you've disabled angular physics, it won't do anything.
- version: Prints the version of RTBP you're currently running.
- writeReadMe: [OUTPUT_FILE] Generates a readme and writes it to the specified path.

# Command Targets

When a command requires a "[TARGET]", this is your list of options:

- balls: male and female left and right balls
- breasts: female left and right breasts
- dick: male and female left and right dick
- fbutt: female left and right butt
- lball: male and female left balls
- lbreast: female left breasts
- lfbutt: female left butt
- lmbutt: male left butt
- mbutt: male left and right butt
- rball: male and female right balls
- rbreast: female right breasts
- rfbutt: female right butt
- rmbutt: male right butt

# Postscript

Thank you for helping me develop RTBP through your bug reports, suggestions, and other feedback.

This file has been automatically generated. Please let me know if there are any mistakes. Thanks!