header general

Creating Hub Structures in ZDoom

This is a brief discussion on how to create maps in a hub structure within a ZDooM environment. A "hub" structure is a loose definition of the original "hub & spoke" structure. A hub & spoke design is one where there is a central map (the hub), and peripheral maps connected to the hub via spokes. [Very similar to a cart wheel, with the central hub being the point through which the entire structure connects.] A good example is the first Hexen mission. Subsequently, any collection of maps that allow players to return to maps already traversed (or allowed back-and-forth travel between maps) became known as hub-based wads.

There are two parts to creating a set of maps within a hub structure. The first part involves setting up your MAPINFO definitions, and the second part involves setting up your maps. (This discussion assumes you are familiar with the use of a MAPINFO lump.) To set up your MAPINFO, you'd need to assign your maps to a "cluster". [From the ZDooM wiki:] A cluster definition begins with the keyword “cluster”. For purposes of ZDoom, clusters are used to displays messages when moving between maps and to optionally group different levels into a hub.... When leaving a hub, the game will remember the contents of the level when the player left it and restore the level to that state when the player returns to it. The following is an example of a MAPINFO definition for maps in a hub:

    map map10 "Command Center"
    sky1 sky1 0.0
    music D_DOOM2
    cluster 1

    map map11 "Power Plant"
    sky1 sky1 0.0
    music D_TENSE
    cluster 1

    map map12 "Krakatoa"
    sky1 sky2 0.0
    music D_ADRIAN
    cluster 1

    map map13 "Valhalla"
    sky1 sky2 0.0
    music D_ROMERO
    cluster 1

    map map14 "Temple of the Ancients"
    sky1 sky2 0.0
    music D_SHAWN
    cluster 1

    clusterdef 1

You'll notice that each map has to be defined within its cluster (in this case, "cluster 1"). Also note that cluster 1 is defined as a hub via the lines "clusterdef 1" & "hub". [The definitions for map names, skies, and music are all optional in the context of defining clusters and hubs.]

This next section covers how to set up your maps. Assuming, for a moment, that you have a true hub-spoke wad in which the player starts in the hub map and can travel to 3 other maps, you'd do the following:

    1. In the "hub" map, your Player 1 start would have a default argument value of 0. [Let's say the map is Map01.]

    2. In Map01, you'd have exits to each of your other maps. For simplicity's sake, assume the player returns to Map01 at the same point that s/he leaves it. At each exit you would have a player start. For the exit/return point for Map02, you can assign an argument value of 1 to the player start (although you can just as easily assign an argument value of 2 or 3 if you wish). For the exit/return point for Maps03 and 04, you can assign an argument value of 2 and 3 to the respective player starts.

    3. In Map01, your exit command would use Teleport_NewMap (map, position). So, to exit to Map02, you'd have Teleport_NewMap (2, position). For the sake of simplicity, assume the position (which is the player start argument value for the destination map) is 0. So your exit would be Teleport_NewMap (2, 0).

    4. In Maps02 to 04, assign an argument value of 0 to the respective player starts. (You can assign a different value, depending on the argument you use in the exit command from Map01. See 3, above.)

    5. In Maps02 to 04, create your exit points to return to Map01.

    6. For Map02, your exit command would be Teleport_NewMap (1, 1); for Map03, it would be Teleport_NewMap (1, 2); and for Map04, it would be Teleport_NewMap (1, 3). The position values here correspond to the player start arguments you assigned in 2, above.

If you wanted to create direct connections between the peripheral maps (i.e., Maps02 to 04) that would not require going through the hub (Map01), you'd create similar exit/entry points, taking care to use different player start arguments (unless the entry points happen to coincide with those from Map01, in which case you wouldn't need new arguments).

We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.