Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Class Structure

Will Stott edited this page Aug 10, 2014 · 1 revision
  1. For now most objects will need to be 'global' variables. (Scope of entire package, and defined without var keyword.)
  2. We can 'Export' certain functions and objects (I think) inside package.js. As far as I can tell we should aim to only export Engine.

client

Engine(Client) {
	
	// Optional modules

	Renderer { update() }
	Physics { tick() }
	Audio {}

	// Obligatory modules

	Time { // framerate, and framelength are accessible here.
			// We should also be able to edit speed of time
		}

	Network { sync() }

	World {
		Bundles [] // Where a bundle is {
						entities: [],

						// Calls onLoad in every Entity after callback from LoadBundle
						}

		Entities [] // Where a entity is {
						assets: [_id],
						onLoad: {},
						start: {},
						update: {},
						tick: {},
						sync: {}
						}
		World.loadBundle{}
		World.removeBundle{}

		//World.message(‘player_death’), calls the function player_death on every entity, as an example

	}

	BundleHandler {
		//Loads/Unloads bundle and stores loaded Assets in Assets
	}

	AssetHandler {
		// Will wrap the PIXI system for textures.
		Sounds
		Music
	}

	Globals {

	}
}

server

Engine(Server) {
	Synchronizer {
		//Validates incoming packets and synchronizes collections.
	}

	Entities {
		//Define entity data, permissions, etc for each entity to validate against for incoming packets. Entities can be items, monsters, players, whatever
	}
}

Clone this wiki locally