Page 1 of 1

Share your cool development tricks.

Posted: 13 Nov 2017, 16:55
by drummyfish
I just thought we could enrich each other by sharing our tricks and scripts. New devs will be able to copy the scripts right from here. Or just talk about whatever funny hacks you used for debugging or anything :) Here's what I have:
  • my OpenMW cheatsheet: https://github.com/drummyfish/my_text_d ... tsheet.txt
  • scripts for running the game:
    quick_run.sh

    Code: Select all

    #!/bin/bash
    
    ./openmw --skip-menu --no-grab --load-savegame ~/.local/share/openmw/saves/testing/test1.omwsave
    test_run.sh - This is the command I call right from vim during development.

    Code: Select all

    #!/bin/bash
    
    clear; clear; make && ./quick_run.sh
  • script for searching for keyword in the source codes:
    search_code.sh

    Code: Select all

    #!/bin/bash
    
    clear
    clear
    
    grep --color -inr "$1" ../apps/
    grep --color -inr "$1" ../components/
    
  • snippet I copy/paste into source code when I need to print the scene graph:

    Code: Select all

    void printScene(osg::Node *n, int maxDepth=-1, int currentDepth=0)
    {
        if (maxDepth >= 0 && currentDepth >= maxDepth)
            return;
    
        for (int i = 0; i < currentDepth; ++i)
            std::cout << "  ";  
    
        std::cout << n->className() << "(" << n->getName() << "), mask = " << n->getNodeMask() << std::endl;
        
        if (n->asGroup())   
            for (int i = 0; i < (int) n->asGroup()->getNumChildren(); ++i)
                printScene(n->asGroup()->getChild(i),maxDepth,currentDepth + 1);
    }
    
EDIT:

- To record videos of bugs, vanilla behavior etc. I find SimpleScreenRecorder the best option.
- For shader development I use http://glslsandbox.com.

Re: Share your cool development tricks.

Posted: 13 Nov 2017, 18:14
by scrawl
scripts for running the game:
If you usually use those same arguments, you can just add them to openmw.cfg, for example:

Code: Select all

skip-menu=1
And instead of a savegame, I use a start script file (--script-run) to set up a testing character with a bunch of items, spells, etc.
snippet I copy/paste into source code when I need to print the scene graph:
There's also the 'showSceneGraph' console command (invoked with or without an object). It is a lot more verbose as well.

Re: Share your cool development tricks.

Posted: 13 Nov 2017, 19:33
by drummyfish
There's also the 'showSceneGraph' console command (invoked with or without an object). It is a lot more verbose as well.
Thanks, it goes right into my cheatsheet. I'll still keep my snippet to be able to do filtering etc. though :)

Re: Share your cool development tricks.

Posted: 17 Nov 2017, 18:43
by drummyfish
Also I forgot to mention that to find some work to do you can:

Code: Select all

./search_code TODO
or

Code: Select all

./search_code FIXME

Re: Share your cool development tricks.

Posted: 17 Nov 2017, 20:28
by sirherrbatka
Just use silver searcher. Or git grep.

Re: Share your cool development tricks.

Posted: 05 Dec 2017, 20:21
by drummyfish
I started writing my own small OSG debug library.