Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 2.74 KB

OTTER.md

File metadata and controls

47 lines (30 loc) · 2.74 KB

Porting from Otter

This doc contains tips for porting a game from Otter to Lutra. Unfortunately, it's somewhat out of date and incomplete, but should provide a starting point to work from.

Namespaces

Lutra has a lot of the same classes and utility classes as Otter, but under more specific (or different) namespaces. Try importing relevant namespaces if imports are no longer being found, eg. Lutra.Graphics, Lutra.Input, Lutra.Utility. The vector types used by Lutra come from System.Numerics unlike Otter which has its own.

Changed function/property names

Here is a list of common changed names that were found when porting a project from Otter to Lutra.

  • Util.Lerp is now MathHelper.Lerp, alongside many other useful maths functions for gamedev
  • Vector2.Normalize is now static and doesn't modify the Vector2, so vec.Normalize() would become vec = Vector2.Normalize(vec)
  • scene.GetEntitiesAll() is now scene.Entities
  • Color constructor from hex string is now static method Color.FromString(str)

TODO: Eventually, I will take another pass over the changes made to TMFBMA and update this section with more of the changes.

Deprecations

Some features have been kept in for Otter compatibility, but tagged as obsolete/deprecated. I don't intend for these to be used in new games using Lutra, but were helpful for porting TMFBMA from Otter.

  • Layer can still be set on Entities but this is deprecated. Layer should now be set on individual Graphics, but will fall back to the Entity's Layer value if not set.
  • Surface can still be set on Entities but this is deprecated. Surfaces should now be added on individual Graphics, but will fall back to the Entity's Surface value if that list is empty.
  • Setting Camera properties directly on Scene is now deprecated in favour of CameraManager.
  • Util.Log with String.Format params is deprecated in favour of log level specific methods without params.

Input system

The input system has been significantly redesigned in Lutra. It should still be just as flexible as Otter's, including creating virtual controllers that can aggregate various inputs. Controller now refers to a physical controller, and all the virtual components are named as such: VirtualController, VirtualButton, etc.

Audio

Lutra has no built in audio systems, but has optional audio libraries.

  • Lutra.Audio.OpenAL is very basic, but provides Sound and Music classes that implement a decent subset of Otter's functionality.
  • Lutra.FMODAudio is an FMOD integration library.

Window

Window properties are no longer on Game, but on the Window property of Game. For example, MouseVisible, LockIntegerScale, Title etc.