@typechecked/matter-bootstrap
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@rbxts/matter-bootstrap

Handles everything to setup Matter. Includes a versatile plugins system to enable any mix of these functions:

  • Hot-reloading
  • Networking (using @rbxts/yetanothernet)
  • Component replication
  • Matter debugger
  • ...and more! You can create your own plugins as seen in the example game

Code examples

See the example game for more details

// server/bootstrap.server.ts
import { ServerScriptService } from "@rbxts/services"
import { Game } from "@rbxts/matter-bootstrap"
import PlayerEntities from "shared/plugins/PlayerEntities"

// A simple game with one system and one plugin
const helloWorldGame: HelloWorldGame = new Game({
	// The greetPlayers system will say hi for us
	systemsFolder: ServerScriptService.TS.systems,
	plugins: {
		// And the PlayerEntities plugin will create Player components to say hi to
		playerEntities: PlayerEntities
	},
})

helloWorldGame.begin()
// server/systems/greetPlayers.ts
import components from "shared/components"

// Greets new players
export = function({ world }: HelloWorldGame) {
	for(const [,playerRecord] of world.queryChanged(components.Player)) {
		if(playerRecord.new && !playerRecord.old) {
			// Player has just spawned, greet them!
			const player = playerRecord.new.instance
			print(`Hello, ${player.DisplayName} (@${player.Name})`)
		}
	}
}

Readme

Keywords

none

Package Sidebar

Install

npm i @typechecked/matter-bootstrap

Weekly Downloads

2

Version

2.0.1

License

MIT

Unpacked Size

24.4 kB

Total Files

23

Last publish

Collaborators

  • typechecked