This step gives you the mental model for how an ompgo component is put together.
An ompgo project is a Go shared library that open.mp loads as a component. The runtime receives open.mp events, builds typed Go events from them, and calls your gamemode handlers.
The basic flow looks like this:
- open.mp loads your compiled shared library.
pkg/runtimebootstraps the component.- The runtime receives C-API callbacks from open.mp.
- Your gamemode methods handle those events in Go.
pkg/omp: events, entities, constants, andomp.BaseEventHandlerpkg/omp/<group>: subsystem helpers likeplayers,core, andvehiclespkg/runtime:Bootstrap, lifecycle hooks, error policies, and extra handler registration
Most new code should import from pkg/omp and pkg/runtime.
You need four things:
- A
mainpackage. - A gamemode type that embeds
omp.BaseEventHandler. - One or more event methods such as
OnLoadorOnPlayerConnect. - A call to
runtime.Bootstrap(...)ininit().
Before you start, make sure you have:
- Go 1.25+
- CGO enabled with
CGO_ENABLED=1 - An open.mp server with the C-API component available as
$CAPI.soor$CAPI.dll
- If you want the shortest route to a working project, continue to Step 2.
- If you already created a project and only need code structure, skip to Step 3.
Move to the next step once you understand that pkg/runtime handles the component wiring and your code mostly lives in gamemode methods.