2.0 Help

Sample Game Plugin

The SampleGamePlugin demonstrates the basics of how to build a custom plugin for game code that can run both in a stand-alone application (such as plPlayer) as well as inside the editor.

Prerequisites

GameState

The SampleGameState class shows how to implement a simple game state that adds high-level game logic, such as handling a game UI. See plGameState and plGameApplication for further details.

Components

  • The DemoComponent shows how to modify the transform of an object dynamically.

  • The DebugRenderComponent shows how to use debug rendering.

For further details also see plComponent.

Project

Under Data/Samples/SampleGame you will find an editor project which uses the SampleGamePlugin. Note that the project references the plugin as a runtime plugin (under Project > Plugin Settings > Plugin Selection...). This makes the custom components available to the editor.

When you press 'Play' in the editor, the scene will be simulated and the custom components, such as the DemoComponent, will take effect.

When you press 'Play the Game' a full game window is launched and now even the custom game state is instantiated and executed. Consequently, the UI will appear and you can interact with it. Note that this still runs inside the editor process.

You can also export and run the scene externally in the stand-alone plPlayer application.

See Also

Last modified: 09 June 2024