Skip to content

Tutorials Component World

Takumii edited this page Feb 21, 2014 · 3 revisions

HomeTutorialsComponent ▸ World

World

What is a world

As the name suggest a world is... a world. It can be considered like a universe, they both contain everything. The most important is that every living objects in your game will be in a world.

In a game this can be an entire level, multiple parts of one big level or a dungeon.

For example, in a racing game, we can have one world for one race :

Or we can imagine a more complex way to organize our level with multiple worlds. For example in a heroic-fantasy game, we have a big level composed of three main area: a battlefield, a castle and a dungeon. Between each area there is a loading and once an area is completed we can't turn back. Each area is a world and all objects inside a world will only live for this world.

(Note : On the previous example, the root "Multi-Worlds level" doesn't exist in Pulsar. If you want to create a complex level like this one, you have to create yourself a system to manage multiple worlds in one level.)

How to create a world

A world is represented by the World class.

You can create a World instance :

World myWorld = new World();

How to update a world

In order to make the world living, you need to update it. Otherwise it will be static and nothing happen in a static world, it will be probably boring...

You can update a world this way :

// This is the update method of the Game class
protected override void Update(GameTime time)
{
	// The world is updated each frame
	myWorld.Update(time);
}

In most case the world will need to be updated each frame but it's not necessary depending on your game.