Parametrized Building Blocks

Document History

Created 2001-09-14 by Hans Häggström, a.k.a. zzorn.

Related discussions

Parametrized Building Blocks

Parametrized building blocks and items use a building block factory, a source mesh, and parameters passed to the factory to create differently shaped building blocks or items.

There are many different block factories, for example copy into a grid, stretch, bend into an arc, create stairs, etc. They should be kept general enough to be useful for many purposes. A factory has some identifier that is used to refer to it, and takes a fixed number of parameters, that somehow affect the shape of the block. The factory starts from the source mesh, and modifies it in some way. A simple example is a tiling factory, that takes as input the dimensions of a grid, and copies the source mesh into each grid cell.

The source mesh is just a normal 3D mesh, for example a simple cube, a Lego 1 x 1 piece with a knob, or a 25 cm horizontal slice of a rococo pillar. One source mesh can be used with many different factories to create different blocks, or it can be mainly used with just a few different factories with some restrictions on the values. A building block created by a factory should normally be a single connected shape, and the building strength simulation code can assume that it is more or less homogenous and equally strong. The details of this depends on what restrictions and building strength module a game system decides to use.

The parameter values could be restricted to a fixed range of discrete values, to allow caching and to ease design (for example, only whole Lego knobs on a Lego brick, or building blocks in multiples of 0.25 m or 1 m). This can also be used to prevent too large blocks, that could make simple approximative structural strength calculations unrealistic if it uses blocks as a basic unit.

Both the server and the clients generate the building blocks when needed using factories, and a source mesh fetched from a media server. They can use a cache to keep the currently and recently used blocks in memory. The server just needs to send the client the parameters, factory id, and a reference to the 3D mesh, of any visible building block shape (the building block material information, including a reference to the used textures, is also sent).

Advantages of parametrized building blocks are that they greatly reduce the number of 3D shapes that have to be created. Instead of dozens of building block meshes (2 x 2 m, 2 x 3 m, 3 x 3 m, 0.5 x 1 m, 0.25 x 0.25 m, etc), just one single-brick source mesh is needed, and the others are generated from that, when used.

Initially we will just implement normal, non-parametrized building blocks (this is equivalent to a factory that returns the source mesh unmodified, and takes no parameters).

Parametrized Items

In addition to building blocks, parametrization can be used for items: staffs or swords of different lengths, items of different sizes, and so on.

Not usable for Creatures

We recognize that (composite) creature and other biological shapes have different needs that should be addressed separately. This method is suitable for building blocks and some items.