Share your cool development tricks.

Everything about development and the OpenMW source code.
Post Reply
User avatar
drummyfish
Posts: 82
Joined: 22 Oct 2017, 10:13
Github profile: https://github.com/drummyfish
Contact:

Share your cool development tricks.

Post by drummyfish » 13 Nov 2017, 16:55

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.
Last edited by drummyfish on 21 Nov 2017, 14:50, edited 2 times in total.

User avatar
scrawl
Posts: 2085
Joined: 18 Feb 2012, 11:51
Contact:

Re: Share your cool development tricks.

Post by scrawl » 13 Nov 2017, 18:14

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.

User avatar
drummyfish
Posts: 82
Joined: 22 Oct 2017, 10:13
Github profile: https://github.com/drummyfish
Contact:

Re: Share your cool development tricks.

Post by drummyfish » 13 Nov 2017, 19:33

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 :)

User avatar
drummyfish
Posts: 82
Joined: 22 Oct 2017, 10:13
Github profile: https://github.com/drummyfish
Contact:

Re: Share your cool development tricks.

Post by drummyfish » 17 Nov 2017, 18:43

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

User avatar
sirherrbatka
Posts: 2121
Joined: 07 Aug 2011, 17:21

Re: Share your cool development tricks.

Post by sirherrbatka » 17 Nov 2017, 20:28

Just use silver searcher. Or git grep.

User avatar
drummyfish
Posts: 82
Joined: 22 Oct 2017, 10:13
Github profile: https://github.com/drummyfish
Contact:

Re: Share your cool development tricks.

Post by drummyfish » 05 Dec 2017, 20:21

I started writing my own small OSG debug library.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests