GameLib is a collection of libraries for creating applications in Cakelisp.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Macoy Madson af35b040cf Made some changes to monkey 3 years ago
Dependencies Minor cleanup of audio, update cakelisp 3 years ago
src Got particles tracking pitch position 3 years ago
test Made some changes to monkey 3 years ago
tools Added automated asset building 3 years ago
.clang-format Got Ogre initialized 3 years ago
.gitignore Updated ignores, fixed aubio test 3 years ago
.gitmodules Added pitch detection via Aubio 3 years ago
BuildHotReloadable.sh Detect input pitch using circular buffer 3 years ago
BuildLoader.sh Got hot-reloading working on VocalGame 3 years ago
BuildTools.sh Added Tracy profiler 3 years ago
Build_Debug.sh Detect input pitch using circular buffer 3 years ago
COPYING Load meshes and create nodes separately 3 years ago
LICENSE Initial commit 3 years ago
ReadMe.org Remove selected only stumbling block 3 years ago
RunProfiler.sh Added Tracy profiler 3 years ago
UpdateBuildCakelisp.sh Update Cakelisp for macros, auto null 3 years ago

ReadMe.org

#+TITLE:GameLib

GameLib is my library for making games. It is the successor to base2.0.

GameLib is written in Cakelisp.

Setup

Clone the repository and its dependencies:

git clone https://macoy.me/code/macoy/gamelib.git
git submodule update --init --recursive

Build:

./Build_Debug.sh

This step will take a while the first time, because it builds Cakelisp, Ogre, SDL, and all the test programs. Subsequent executions will use the cakelisp_cache and will be much faster.

Note that changes to the 3rd-party dependencies will not automatically be detected.

You may need to follow the instructions in the Asset pipeline section if you are failing during the Asset-Building stage. (You may also comment out any VocalGame.cake lines in the build script to avoid building any assets.)

Asset pipeline

You should do it manually once to ensure your environment is properly configured, then refer to test/src/VocalGame.cake function process-3d-assets for how to automate it.

Blender setup

  • Install Blender. I can confirm Blender 2.91 works.

  • Copy blender2ogre to Blender plugins:

cp -r Dependencies/blender2ogre/io_ogre/ ~/.config/blender/2.91/
  • Open Blender, then open Preferences (Edit->Preferences), and click Add-ons

  • Search for "Ogre" and check the box to enable the OGRE Exporter

  • Build Ogre, if you haven't already (run BuildDependencies_Debug.sh)

  • Set OGRETOOLS_XML_CONVERTER to where you built OgreMeshTool. You'll need to browse to gamelib/Dependencies/ogre-next/build/Debug/bin/OgreMeshTool_d

You are now ready to export. Open your model or create one, then do File -> Export -> Ogre3D. See the following section for settings.

OGRE Export Settings

  • Don't export materials. These are v1 materials as far as I know, which don't work with Ogre 2

  • Don't export scene. I don't use these files

  • Ensure mesh export version is set to v2

  • Don't export selected only

Materials and Textures

The blender2ogre plugin doesn't do much to help with Ogre v2 materials.

For a textured mesh:

  • UV unwrap mesh

  • Create new image for texturing

  • Add a new material and set the diffuse input to your new image. Name the material what you'd like it to be called in the game as well

  • Paint the texture as desired

  • In the Image Editor window, do Image -> Save As and save the image to a lossless format (I used PNG)

  • Run the following to convert the image to .dds (which will be a larger file, but will load drastically faster):

      convert assets/MyTexture.png data/Materials/Textures/MyTexture.dds
  • Export the mesh. Because export materials doesn't do us any good yet, we only export the mesh to get the updated UV coordinates and material (name only)

  • Create a .material text file like below:

      hlms MyMaterial pbs
      {
          roughness	0.4
          fresnel		1.33
    
          diffuse_map		MyTexture.dds
          // normal_map		Rocks_Normal.tga
          // roughness_map	Rocks_Spec.tga
          // specular_map	Rocks_Diffuse.tga
      }
  • Finally, add the material to the Ogre::Item:

     item->setDatablock("MyMaterial");

    This is only necessary if the mesh didn't already have the Material name set.

Converting .mesh.xml to .mesh

You shouldn't need to do this step if you set OGRETOOLS_XML_CONVERTER, but in case blender2ogre didn't recognize it, here's how I worked around it:

cd Dependencies/ogre-next/build/Debug/bin
./OgreMeshTool_d -e -O puqs ../../../../../test/data/Models/Suzanne.mesh.xml

Run this after you've made an attempted export from the Blender OGRE plugin.

Animations

  • Rig your mesh as you would normally in Blender

  • Open the Dope Sheet, and switch mode to Action Editor

  • Use the New button to create an action. The name you use here will be the name needed for the code (the animation name)

  • Create the action's keyframes

  • Open the NLA editor, and click Push Down Action to create an NLA track. Blender2Ogre uses NLA tracks to determine which animations to export

You can repeat this for all the different actions you want for a given skeleton.

The name of the skeleton comes from the name of the Object which has the armature modifier's mesh. This may mean shared skeletons will be created in duplicate due to having different object mesh names.

Terms

GameLib is copyright (C) 2020 Macoy Madson <macoy@macoy.me>.

Licensed under GPL-3.0-or-later.

Contact macoy@macoy.me if you would like to negotiate an exception for your use-case.