Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SlyCooperReloadCoded/8b613312626e7897651ca30049d4b084 to your computer and use it in GitHub Desktop.
Save SlyCooperReloadCoded/8b613312626e7897651ca30049d4b084 to your computer and use it in GitHub Desktop.
Star Wars Starfighter Debug Guide (WIP)
Big thanks to lead programmer (on Jedi Starfighter, was senior programmer for Starfighter) Brett Douville for answering lots of development-related questions about the Starfighter games and for tipping me off about the existence of debug functionality. Also, big thanks to developer Andrew Kirmse for remembering what the combination was to open the command console, 99% of this document would not exist without his help.
The original PlayStation 2 release of Star Wars Starfighter is fully debug-enabled. This info leaked out shortly after release so the backdoor was disabled in all non-PS2 releases of Starfighter. It's untested on PS3/PS4 rereleases. To activate the debugging features, you'll need to either plug a USB keyboard into your PS2 console or enable USB keyboard emulation in PCSX2 (note that you'll need to set custom bindings to unbind certain keys so they don't simultaneously change emulator settings when pressed).
The discovery of the debugging functions after release prompted the removal of the debug backdoor in Jedi Starfighter, however the people responsible didn't do a good job as it's fully functional with a slight modification. However, simply having it enabled breaks the game as just completing a mission, even without executing any commands, causes the game to exit to BIOS afterwards, likely calling the exit command of whatever debugging platform used this. To make matters worse, nothing is printed, so you can't tell if what you've typed in has worked. If that wasn't enough, lots of syntaxes have changed, like "player=$flyactor" doesn't work.
A list of syntax differences discovered so far:
- "player $flyactor" doesn't work, you need to use the actual name of the flyactor.
- "ctrl+ _fm, $flyactor" doesn't work for the same reason.
Spawning in Adi should be entered as shown below:
set $flyactor=adi
gob+ cplayeradi,adi
player adi
_fm.setattrsfromres adi.flt
ctrl+ _fm, adi
daron
- "_player" exists and works in place of things that require the name of the player. Starfighter makes heavy use of this too.
The debugging features:
Pressing Ctrl + F1 enables a debug display.
Pressing PgUp or PgDn goes forwards or backwards one mission, but only works once.
Some of the keyboard keys near ; (semicolon) control wingmate commands and camera modes.
/ * - + on the Numpad control the position of the camera in relation to your ship when in 3rd person view. Can allow for things like a semi-cockpit view.
Tab cycles focus between your ship and other ships in the scene, similar to how the DIRECTOR cheat works, but manual.
Ctrl + A toggles Director Mode on and off, but one that's superior to the one granted by the DIRECTOR cheat, as your ship gains AI instead of disappearing.
Ctrl + S is supposed to toggle the audio, but often leaves sound effects on and only lowers voice audio.
Ctrl + Backspace restarts the current mission, although it doesn't load cutscenes or play the intended music.
Ctrl + P is a toggle that freezes the game while still allowing you to open up the command console.
Pressing Esc and / (forward slash) at the exact same time opens a very powerful command console giving you (theoretically) full control over the game's engine... assuming you know what the commands and their syntaxes are. Below is a list of ones I've found in the game files, in the game's memory, and from my own personal discoveries. Note that this is very incomplete.
quit = exits to PS2 BIOS, might not act the same on real hardware, especially if run from loaders like OPL.
clr = clears console
outputmarker = Makes the console scream "MARKER!" at you. Clever. Likely does more on dev units though.
showversion = Prints build info to console.
performance = Prints performance info to console.
scalecraft = Changes the size of all craft. Can go into the negative values. Hitboxes do appear to get bigger or smaller.
showprojectileinfo = Prints info about projectiles to console.
explosionsoff = Disables explosion effects. Explosive projectiles now just hit the surface and stick to them, doing nothing.
explosionson = Re-enables explosion effects.
toggleexplosions = One-command toggle that switches between the two above effects.
showconditions = Prints WAY too much info into the console to see even 5% of it, but it looks like contitionals and their requirements.
leakmem = Leaks 100 bytes of memory. Has optional syntax to allow for more bytes to be leaked. (leakmem amountinbytes)
crash = Prints "Crashing the game..." to console but never actually succeeds.
playstream
loadstream
pausestream
stopstream
resumestream = Controls for music and possibly other audio streams. If an error happens, use stopstream to stop the music first.
playvideo
loadvideo
pausevideo
stopvideo
resumevideo = Same as above but for video streams, loading existing video files causes a game crash if started from ingame.
viewenv
viewenvagain = env viewer by filename. (viewenv model.pmdl)
viewmodel
viewmodelagain = Model viewer by filename. (viewmodel model.pmdl)
setcamerafov = Changes camera FOV. (setcamerafov value)
dumpframe = Dumps the current frame as an incorrectly-taken screenshot in ".tga" format (likely dumps the image correctly on real hardware). Hostfs needs to be enabled in PCSX2 and run via a hostfs setup.
displaystatusinfo = Prints bonus goal statuses for each mission to console.
showinputcontrollers = Prints active controllers to console.
clearmissionmgrdata = Stops all mission scripts. AI will no longer work, no mission fail or mission success conditions will exist.
togglegamedebugtext = Same as Ctrl + F1.
enableperformance = Claims to enable performance counters but does nothing. Note that graphics for the performance counters do exist and can be loaded with "loadpage diagnostics.page,HR" but they're non-functional.
unbindaifromcraft = Removes AI from selected craft. (unbindaifromcraft craftname)
Example:
"unbindaifromcraft vana" during Last Stand on Naboo makes Vana freeze in place and do nothing because there's no AI for it anymore.
setmissioncomplete = Marks a mission as completed (setmissioncomplete,missionfilename)
ropt = Rendering options. (ropt option, setting)
Examples:
"ropt" prints a few of the rendering-related syntaxes to console
"ropt bgcolor, 255, 0, 0" makes sky very red, the three numbers are Red, Green, Blue values
"ropt drawwire, true" enables wireframe rendering
"ropt fogend, 100" sets where level fog ends, in this case it's 100
"ropt fogstart, 0" sets where level fog starts, in this case it's 0
"ropt fogenabled, false" disables fog
farclip = Render distance. Very performance-demanding, will crash game if set too much is rendered. Higher values mean higher render distance.
freecam = Activates a very unrestrictive freecam with complicated controls. Ctrl + P can be used beforehand to freeze everything in place before moving the camera around. This in combination with dumpframe is most likely how promotional ingame screenshots were taken:
- 1 through 9 on the top row of the keyboard changes the speed of the camera.
- A and G roll the camera to the left and to the right.
- ESDF are standard directional controls.
- R and V are elevation controls.
reset = Unloads everything except music.
restartmission = Restarts the current mission, might cause issues with cutscenes or missions loaded after game reaches mission select screen again.
loadmission = Loads a mission from filename, skips cutscenes and doesn't end correctly, also needs restartmission after loading.
Examples:
"loadmission spacedemo.wrl" loads the map from one of the idle demos, no player ship by default, no demo timer either.
This command can also be used to reach something I call an "empty state":
1. Load any mission through the menus
2. Use "reset" to unload everything
3. Use "loadmission" to load any other mission.
4. Use "restartmission" to properly load everything.
5. Pause and quit to the mission select menu.
6. Enter any other mission.
These steps will cause the menu to unload but no mission ever loads, resulting in an "empty state" where absolutely nothing is happening. This is the perfect place to load missions or look for commands in memory. If you're on PCSX2, making a save state here is a good idea as it will allow you to quickly load into this "empty state" instantly and at any time. If you know how to make custom missions, you can simply make an empty one that's cheat code-activated, which is a lot cleaner and potentially safer than the above method.
overloadmission = The same as loadmission but without unloading any existing assets/scripts. Almost certainly guaranteed to crash and activate the crash handler. I don't see any practical use of this command, however the game does use this in some instances.
loadmap = Loads a map from file. (loadmap scenenameormodelname)
loadscene = Loads a scene from file, related pmdl files listed inside scene files. Sometimes not all the syntaxes are needed and sometimes it will "fail to load the scene into the GOD" for unknown reasons. Emulator savestates are recommended. (loadscene model.pmdl,model.pmdl,scene.scene)
setenv = Sets a currently-loaded model as the background, which is used for skyboxes.
The most-correct I've ever been able to load scenes is by using the following commands with the "factv11.scene" scene:
"loadscene eos_sky.pmdl,factv11.scene"
"setenv factv11.scene,eos_sky.pmdl"
"loadscene fact.pmdl,buildings.pmdl,factv11.scene"
"loadscene buildings.pmdl,fact.pmdl,factv11.scene"
"ropt fogstart,1500"
"ropt fogend,1750"
"ropt fogcolor,4280030502"
"ropt ambient,4281214805"
"ropt ambient,true"
"ropt bgcolor,4280030502"
"farclip 1750"
This loads an old version of the Eos Factory scene.
dpriority = Sets which "layers" have rendering priority over each other. (dpriority scenelement,priority)
Example:
Loading the unused Eos Droid Factory above, then entering these commands in order fixes the starfighter being rendered "under" the terrain:
"dpriority factv11.scene,-1"
"dpriority fact.pmdl,-1"
"dpriority buildings.pmdl,-1"
Note that there's still some remaining issues such as projectiles and craft being rendered "above" everything at all times, even when clipping through them, most noticeable when firing lasers at the ground. Still some unknown stuff.
loadcatalog = Loads a catalog from a file. These contain listings for sound effects and will allow playing those sound effects.
Example:
"loadcatalog caat.catalog" will allow AAT tanks to play their intended sound effects.
loadpage = Loads a page from file, although the element may not be functional on its own. (loadpage page.page,shortnameinsidefile)
Example:
"loadpage diagnostics.page,DI" loads an ingame engine stress meter.
loadpak = Loads a .pak file from the disc. Any syntaxes will print "attempted to load a pak on PlayStation 2 version" which means it's probably not possible. Game is entirely LBA-based meaning file modding is impossible - this would've been the perfect way to load mods if it was functional.
runscript = Runs a script from file.
cmddump = Claims command is unavailable on PS2. Works on Xbox and PC releases, but seems to only dump one or two basic commands.
LoadSandboxButton = Does not work, prints the following to console:
"The LoadSandbox command is only available under windows. User buttons are not supported on this platform."
Sandbox is essentially the same thing as Perforce or GitHub.
player = sets specified ship as player (player craft)
Examples:
"player nsf1" in spacedemo.wrl sets player to one of the Naboo Starfighters, look for craft names inside .wrl files. It's not recommended to use this command by itself as the new player craft will not act as it was originally programmed to.
set $flyactor=shipname
gob+ csshipname,shipname
player $flyactor
_fm.setattrsfromres file.flt
ctrl+ _fm, $flyactor
daron = This set of commands input one after the other with the proper syntaxes and filenames allows you to spawn and control and craft in any mission with it's intended control scheme. (a.k.a. tanks hover above the ground rather than flying like starfighters) "daron" is unnecessary but makes craft invincible because enemies are weak by design. Note that you can use another .flt model to "customize" its controls. For example, Velker can be given the boost/brake of Rhys is rhys.flt is used. Note that some missions might crash at seemingly random points when piloting the wrong craft, as you're not really supposed to be able to do this.
If the craft loses its intended behavior after you take control - which in most cases is ground units - then use aigob+ instead. Note that ground units don't control well on ground that isn't perfectly flat, and their AI will often "fight" against your controls. Disabling the AI makes them lose their flight model and will just act like a starfighter again, so the engine wasn't really designed for using these commands in this way.
To fly the Freefall in any mission, enter these commands in order:
set $flyactor=freefall
gob+ cfreefall,freefall
loadcatalog cfreefall.catalog
loadcatalog caat.catalog
player $flyactor
_fm.setattrsfromres vana.flt
ctrl+ _fm, $flyactor
daron
To fly the endgame boss ship in any mission, enter these commands in order:
set $flyactor=boss
gob+ cdcshammerhead,boss
player $flyactor
_fm.setattrsfromres vana.flt
ctrl+ _fm, $flyactor
daron
FlyRhys
FlyVana
FlyNym
FlyInfiltrator = Quick, one-command versions of the above command, but for the four player craft, one for each craft. bluensf does not have one.
warp = Teleport command, but only to teleport ships to each other. (warp ship, shipatdestination)
You can use this to teleport spawned-in ships to the player ship's location just in case that level spawns you out of bounds.
mv = Coordinate-based teleport command used to teleport a target craft to any coordinates. (mv shipname,X,Y,Z)
Example:
"mv rhys,0,0,0" when controlling Rhys teleports you to the map's exact center.
viewhud = Enters normal player view, used to take control of NPC craft assigned as player craft if using the "player shipname" method.
daron = Enables true invincibility - never lose any shield or HP.
norad = Disables the effects of the "daron" command.
inv = This is Jedi Starfighter's version of the norad command, which has the same function.
minime = same as cheat code, sets minimum HP to 10, unsure if it works if entered into the console
harley = one-hit death mode, probably an inside joke.
harcheat = seems to be another inside joke about Harley. Enables the "daron" cheat, sets the minimum HP of the Rescue boats (and possibly the transport) to 10, then prints "You cheater" to the console. This only works on "Rescue on the Solleu", the level that Harley had a hard time playtesting, apparently. However, this seems to not be the case since, as Brett Douville stated "This is not the level to which Harley meant -- that was the Vana level where she didn't realize you could snipe from above like you can", probably in reference to Secrets on Eos, although the code doesn't work on that mission since it looks for units with the name "rescue" which are only in Rescue on the Solleu.
addfun
subtractfun
defaultfun = joke commands about the old LucasArts work environment, most likely added by level/mission designer Rich Davis.
dispatch = seems to be related to underscore commands somehow.
Example usage:
"dispatch _director,deactivate" which deactivates Director Mode
lod = Level of Detail, useful for viewing individual models in an empty scene. Higher values = higher model detail.
Example usage:
lod 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment