Games
Sandbox and OptiShoot are ordinary worlds under cgame/. They do not get a private loop. Both
publish a character into the Rust step while you are in the world with the cursor captured, and both keep
weapons, menus, and rules in Java.
Sandbox
Package Sandbox. Main starts TitleWorld. New World and World Select
construct a SandboxWorld with a save name. The player is a FirstPersonController.
Terrain is a ChunkStreamingManager with a heightmap generator. Edited chunks are stored beside
the world save.
| Input | Action |
|---|---|
| Mouse | Look |
| W A S D | Walk |
| Shift | Sprint |
| Space | Jump, or swim up |
| Hold left mouse, or Q | Break the targeted block |
| Hold right mouse | Place the hotbar block |
| E | Inventory. Click slots to swap. |
| 1–9 | Hotbar slot |
| T or / | Chat and commands |
SandboxGameplay handles the hotbar, breaking, placing, and the sprint field-of-view bump.
SandboxMenus is the title flow, pause, and inventory. SandboxCommands registers
chat commands, including give. The body does not simulate while the load gate is up, while chat is open,
while the inventory is open, or while look is released.
OptiShoot
Package OptiShoot. OptiShootMain starts OptiShootWorld directly.
The player is a ThirdPersonController with faster walk and sprint. The figure is a
PlayerAvatar built from PlayerSkin.load("sk1.png", "skins/sk1.png"). Weapons are
WeaponController plus definitions from OptiShootArsenal. Hits are
Hitscan against practice targets. None of that is in Rust.
| Input | Action |
|---|---|
| Mouse | Orbit look. Right mouse aims and slows movement. |
| Left mouse | Fire |
| R | Reload |
| View key (default F5) | First person or third-person back |
| Tab | Pause |
| Escape | Quit confirm |
prepareSimulation passes movementMultiplier: the current weapon’s move scale, times
0.78 while aiming. The Rust step uses that scale for the whole frame’s 1 ms steps. Recoil is applied in
Java on top of the orbit angles and is not part of the body integrator.
The load gate is tightened here: mesh ratio 0.35 and a 1.6 s timeout, because the arena is small. Sandbox keeps the engine defaults (ratio 0.72, timeout 12 s) and now finishes when published meshes settle instead of waiting for that timeout.
Adding another game
Create a package under cgame/. Subclass World. Start it from a main
in that tree. If the player should move on the 1 ms clock, publish a
FirstPersonController or ThirdPersonController from prepareSimulation
and pull it back before worldAct. If you only need actors and a camera, leave those methods
empty.