Difference between revisions of "Development Tools"

From PioneerWiki
Jump to: navigation, search
(add savefile debug,and reorder stuff)
(Debug savegame files)
Line 25: Line 25:
 
=== Debug savegame files ===
 
=== Debug savegame files ===
  
  ./build/savegamedump path/to/mysave
+
  ./build/savegamedump savefiles/<mysavename>
  
and stuff JSON output e.g. into http://jsonviewer.stack.hu/
+
and look in your savefile folder (e.g. ~/.pioneer/savefiles on linux) at <mysavename>.json file, put JSON e.g. into http://jsonviewer.stack.hu/
  
 
== Profiling ==
 
== Profiling ==

Revision as of 17:04, 26 November 2020

Here we aim to document little known features that developers add to help themselves in the development process, wheather that be debugging, profiling, or what else


Debug

Build debug

   ./bootstrap -DCMAKE_BUILD_TYPE=Debug


To record video from gameplay (e.g. to document unexpected behavior):

   To record video directly from Pioneer you will need to add the line
   RecordVideo=1 somewhere within your config.ini file. Then once ingame
   you can press Ctrl+ScrLk to start or stop recording.

Debug from in-game

Ctrl+I = debug window

Ctrl+F10 open planet viewer, to view selected nav target

Ctrl+F11 reload shaders while running game

Debug savegame files

./build/savegamedump savefiles/<mysavename>

and look in your savefile folder (e.g. ~/.pioneer/savefiles on linux) at <mysavename>.json file, put JSON e.g. into http://jsonviewer.stack.hu/

Profiling

For Profiling, one needs some tools installed?


Build with profiling support

ToDo edit this to improve and make sense and be correct

Profiling: to build with the profiler enabled, simply run ./bootstrap -DPROFILER_ENABLED=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo and compile as normal. The latter flag is not strictly needed, but building with a BUILD_TYPE

To-do: extract wisdome from this conversation, https://github.com/pioneerspacesim/pioneer/pull/4764 and document here


   <fluffyfreak> Gliese852, if you're on Windows then I use
                 https://github.com/VerySleepy/verysleepy a lot of the time
                 [17:37:07]
   <Gliese852> fluffyfreak: thanks, I meant the built-in profiler, it seems that
               if you do nothing, it creates a report on the launch of the
               program, and the launch of a new game [17:54:21]
   <fluffyfreak> If you're running the profile build then you can press Ctrl+p to
                 take a profile at any time [17:58:50]
   <fluffyfreak> hmm, been a while since I used it. There's two modes [17:59:37]
   <fluffyfreak> Ctrl+shift+p = is capture one frame, otherwise Ctrl+p toggles
                 capturing whenever the framerate is "slow" [18:00:12]
   

Using profiler

to do

clang format check

   Yes, for your use you'd likely want to invoke `FORMAT_BASE=master ./autoformat` or `FORMAT_BASE=HEAD~1 ./autoformat`
   - there's little difference between the `autoformat` script and the `scripts/clang-format.sh` script other than the 
   latter prompts you to automatically apply the issues in your files.


Editor integration

There is support for sending Lua code from IDE into running pioneer session via TCP: https://github.com/pioneerspacesim/pioneer/pull/3768 https://github.com/pioneerspacesim/pioneer/pull/4799