Beginner tutorial: Character (rorbot) mod from scratch, in Blender

Step 40 - Copy the keyframe at pos 1

Select the keyframe at position 1 by clicking it with mouse. Right click the Timeline window and choose Copy from the menu.

40 Blender timeline copy keyframe pos1.png
 
Step 41 - Paste keyframe at pos 39

Since we made it 20 frames between the 2 main poses, the whole anim must last exactly 39 frames so that we end at frame 0. Paste the copied frame at position 39.

41 Blender timeline paste keyframe pos39.png
 
Step 42 - Set total anim length

Use the "End" box to set the total animation length to 39.

42 Blender timeline set anim len 39.png
 
Step 43 - Rename the animation

Right click the animation in the Outliner window and select Rename from the menu.

43 Blender outliner rename anim.png
 
Step 44 - Hit spacebar to play the animation in Blender

You can see the anim is really really basic, but it's a smooth loop nonetheless. Improving it is just a matter of adding more keyframes and doing better poses.

rorbotModTut1-blenderLoop.gif
 
Before you do anything more export your character and try it in game. I think that you scale will be off and you should have your character facing +X not -Y
 
Last edited:
Before you do anything more export your character and try it in game. I think that you scale will be off and you should have your character facing +X not -Y

You're right:
  • The orientation is genuinely wrong, it should be +X, not -Y
  • The scale is correct but comes out wrong in the game because, for some reason, the game scales the mesh by 0.02. I disabled that and added a 'mesh_scale X Y Z' to the character file format, with default value 1.0 for every axis. I suggest you scale the classic rorbot down.
 
Step 45 - Show normals

In 3d graphics, "a normal" is a direction which an element is facing. A face normal tells you which side of the face is "front" and which is "back". This is important because in realtime 3d graphics, faces are visible only from the front, not from the back.

The light blue lines are the normal-indicators. As you can see, all body parts except the head have the normals flipped (pointing inside).

45 Blender 3dviewport display normals overlay.png
 
Step 46 - Fix the normals

Select "Mesh > Normals > Recalculate outside" from the top menu. You'll see how the indicators change - they will all point outwards now.

46 Blender 3dviewport recalculate normals outside.png
 
Step 47 - Fix the rotation

It turns out this tutorial started with wrong orientation axis - the character is facing -Y axis while it should be facing +X axis (as Vido noted). To fix it, we need to rotate both around Y axis.
  1. Go to object mode.
  2. Deselect everything using Alt+A, then select the armature and the mesh.
  3. Activate top-down camera by either pressing Numpad7 key or clicking Y on the gizmo.
  4. Activate rotation mode by hotkey R.
  5. Hold Ctrl to rotate in steps, and rotate exactly 90 degrees so that the character faces the X axis.

47 Blender 3dviewport rotate objectmode and apply transform(2).png
 
Step 48 - Export from Blender

You'll need blender2ogre Blender plugin: https://github.com/OGRECave/blender2ogre - follow the installation instructions in the README: https://github.com/OGRECave/blender2ogre#index. There's an image guide in my terrain tutorial: https://forum.rigsofrods.org/threads/making-a-map-from-scratch-how-hard-can-it-be.3746/#post-18323 (see step12).

To export, you'll need the OgreXmlConverter.exe utility from the OGRE SDK. There are 2 ways to obtain it:
* by installing the game from itch.io (either stable or dev builds work)
* by downloading the packaged OGRE SDK from their website: https://www.ogre3d.org/download/sdk/sdk-ogre
Image guide how to configure the Blender addon: https://forum.rigsofrods.org/threads/making-a-map-from-scratch-how-hard-can-it-be.3746/#post-18324 (see step13)

Finally, do the export using "(top menu) File > Export > Ogre (scene and mesh)". Make sure you use these settings:
  • General/Swap axis: "xz-y" (tooltip: ogre standard)
  • Scene/Export selected only: unchecked
You'll obtain 2 files: "rorbotmod-tut1.mesh" and "rorbotmod-tut1.skeleton"
 
Step 49 - create a character mod

Create a directory under 'Documents\My Games\Rigs of Rods\mods' and put the rorbotmod-tut1 mesh+skeleton files there. Finally we need the character description file. Copy this text and save it to file "rorbotmod-tut1.character":

Code:
; Beginner tutorial of character modding
; https://forum.rigsofrods.org/threads/beginner-tutorial-character-rorbot-mod-from-scratch-in-blender.3761/
; -----------------------------------------------------------------------------
;
; This file format lets you compose 'actions' from one or more
;  skeletal animations exported from a 3D modelling tool.
;  NOTE each action is evaluated separately, there is no either-or relation,
;  so you must set each anim's conditions to avoid conflicts.
;
; For explanation of individual parameters,
;  see file source/main/resources/character_fileformat/CharacterFileFormat.h
;
; For authoritative list of SITUATION_ and CONTROL_ flags,
;  see file source/main/gameplay/Character.h in the GitHub repo.
;
; Tip: in game, use 'Game animations' UI panel,
;  open it from top menubar >> Tools >> Character pose util >> tab 'game anims'
;
; -----------------------------------------------------------------------------

; Name displayed in the Selector UI - required
character_name "Tutorial character mod 1"

; Name of the mesh file - required.
mesh_name "rorbotmod-tut1.mesh"

; Scaling factor of the mesh - optional, default is 1.0 on all axes.
mesh_scale 1 1 1
     
begin_action
    game_description "walking forward"
    except_situation SITUATION_IN_DEEP_WATER
    except_situation SITUATION_DRIVING
    for_control CONTROL_MOVE_FORWARD
    except_control CONTROL_RUN
    anim_name "walk-cycle"
    playback_time_ratio 1.f
    playback_h_speed_ratio 1.f
end_action
     
begin_action
    game_description "walking backward"
    except_situation SITUATION_IN_DEEP_WATER
    except_situation SITUATION_DRIVING
    for_control CONTROL_MOVE_BACKWARD
    anim_name "walk-cycle"
    playback_time_ratio -1.f
    playback_h_speed_ratio 1.f
end_action
 
Last edited:
Step 50 - Test in game

You need to download an experimental build from GitHub - visit https://github.com/RigsOfRods/rigs-of-rods/pull/2942, go to "Checks" tab and on the right, open the "Artifacts (2)" dropdown and download the zipped build.

I'm attaching the finalized tutorial character, just place it anywhere in the mods directory as usual. It includes the .blend file and README with CC0 (Creative commons copyleft) license - feel free to edit and publish it in any way you want.

50 ROR mainmenu Settings Selector.png


50B ROR simulation with poseutil UI.png
 

Attachments

Great tutorial, should be very helpful for those interested in modding RoRBot. Hopefully you plan on adding your tutorials to the docs in the future ;)
One thing I'd like to add, the XMLConverter (along with the other tools) can also be downloaded from the Repository: https://forum.rigsofrods.org/resources/ogre-command-line-tools.967/
I created those packages as the XMLConverter hasn't been included with RoR for the past few versions (except for the Itch.io stable release, seems that was fixed recently)
 
Only thing that's missing is material, I had struggle with it since my character date's to 2.6-ish blender, so if you want to use some texture on your your character you must use blender Princlipled BSDF
 
Last edited:
Thanks for the feedback guys!
Docs: First the moddable rorbot PR needs to be concluded. That must definitely be documented. Tutorials like this one can be attractive only for those who like doing things from scratch.
OgreXmlConverter: I think we should bundle it with all ROR downloads. Blender is the go-to tool for modding here and blender2ogre exporter can automate the XML conversion, so having the converter in one place would simplify both writing tutorials and setting up your environment.
Making characters: think the makehuman blender plugin should ideally be the go-to solution for creating characters. I didn't research it yet but it looks very good. The alpha state shouldn't be an issue because I know Python and Blender internals (I coded blender plugin with UI before) so I'm able to patch the software if it has critical issues.
 
Back
Top