Page 1 of 2

Hub Homeworld

Posted: Wed Mar 22, 2017 7:15 pm
by Hidden Hands
How would I go about programming a HUB homeworld in my game? I would like to feature a hub that has portals to all the different levels in the game, similar to HEXEN but more in the lines of Spyro the Dragon on the PS1.

Also, if I WERE to do this, would it be harmful to the four levels I have already created? IE; I have four levels that lead into each other, but I want to change it so that after completing the first level, you return to the hub world where portals to all my other levels are located. Can someone advise me on this please?

Here's an example of what I mean. Watch from 3:00


Thanks in advance.

Re: Hub Homeworld

Posted: Thu Mar 23, 2017 11:11 am
by juizzysquirt
Hidden Hands wrote:How would I go about programming a HUB homeworld in my game? I would like to feature a hub that has portals to all the different levels in the game, similar to HEXEN but more in the lines of Spyro the Dragon on the PS1.
All you need is this: https://zdoom.org/wiki/MAPINFO

Here's a rough example, I hope I'm not too far off since it's been while I've messed around with MAPINFO. Here I assume that first hub level lump is actually named "hub01" instead of "map01" or whatever.
Spoiler:

Re: Hub Homeworld

Posted: Thu Mar 23, 2017 1:31 pm
by ReX
Also read this brief tutorial on creating hubs.

Re: Hub Homeworld

Posted: Thu Aug 10, 2017 9:51 pm
by Hidden Hands
Thank you everyone, but I think I need some more help. I'm really having trouble getting this to work. Let me show you my MAPINFO.

Code: Select all

map MAP01 "The Little Top"
levelnum 1
titlepatch CWILV00
next MAP02
secretnext MAP02
sky1 SKY1 0
cluster 1
par 30
Noinfighting
music D_RUNNIN

map MAP02 "Devil's Fairground"
levelnum 2
titlepatch CWILV01
next MAP03
secretnext MAP03
sky1 SKY2 0
cluster 2
par 90
Noinfighting
music D_STALKS

map MAP03 "The Nursery"
levelnum 3
titlepatch CWILV02
next MAP04
secretnext MAP04
sky1 SKY3 0
cluster 3
par 120
Noinfighting
music D_COUNTD

map MAP04 "Icecream Lane"
levelnum 4
titlepatch CWILV03
next MAP05
secretnext MAP05
sky1 SKY2 0
cluster 4
par 120
Noinfighting
Lightning
music D_BETWEE
Right I need these four levels to have portals that lead to them in a HUB homeworld. But whenever I make a hub (MAP00) it doesn't know what it is and either corrupts the game or just does nothing. What needs to change in my code so this will run smoothly please?

Thanks in advance.

Re: Hub Homeworld

Posted: Thu Aug 10, 2017 10:12 pm
by Kappes Buur
Just a note that, if you design a hub system, you move between maps if they have the same cluster number.

Rex, he linked to his tutorial, is very good at making hub systems.
Check out his phobos-g and paranoid.
I'm sure that some of what he has done will apply to your pwad.

Re: Hub Homeworld

Posted: Fri Aug 11, 2017 10:41 am
by Hidden Hands
Ok I read the article a few times but I think I'm getting lost somewhere along the way. So do I need to edit my levels to have an exit portal to the hub world or am I misunderstanding it? If I add this hub world (which I have titled MAP00) will it damage my other levels? I already have four levels in order in the wad, and I am adding the hub late... Hoping this isn't the case.

I've made a working hub to some extent - MAP00 allows me go through a portal (using the linedef teleport to MAP number) but then how do I get back to the hub? And also I want it to remember my progress in each level for when I choose to return to it. Do I have to edit maps 1,2,3 and 4 in order to give them an exit portal back to the HUB?

When I enter a portal from MAP00 hub, it's fine - it takes me to the correct level the portal goes to. But getting back is proving a pain. When I reach the exit, it just takes me to the next level rather than back to the hub world. I read the tutorial that it has something to do with player start arguments, but I can't quite grasp it for some reason. What am I doing wrong?

Rex please help I'm probably screwing up something really simple here.

Re: Hub Homeworld

Posted: Fri Aug 11, 2017 12:01 pm
by Hidden Hands
Is it because the HUB world is called MAP00? I really hope not.

Re: Hub Homeworld

Posted: Fri Aug 11, 2017 12:19 pm
by phantombeta
Ummm... Your copy of ZDoom is ancient.
You REALLY should get the latest GZDoom. Here's a link to the download page.

Also, you need to use Teleport_NewMap instead of Exit_Normal. Not sure if that's what's causing the crash, but it could be.
Anyway, I'd say it's a good idea to post your map. It'd be much easier to see if you're doing something wrong if you do.

Re: Hub Homeworld

Posted: Mon Aug 14, 2017 5:51 pm
by ReX
Hidden Hands wrote:.....but then how do I get back to the hub? And also I want it to remember my progress in each level for when I choose to return to it. Do I have to edit maps 1,2,3 and 4 in order to give them an exit portal back to the HUB?
To get back to the hub you will need to use Teleport_NewMap (just like phantombeta said) on each map from which you are trying to return to the hub.
Yes, ZDooM will remember your progress once you set up the hub system correctly.
Yes, you'll need to edit Maps 1-4 to include Teleport_NewMap. If you wish, you can set up your "entry portal" on each map to also be the "exit portal" that returns you to the hub.
When I enter a portal from MAP00 hub, it's fine - it takes me to the correct level the portal goes to. But getting back is proving a pain. When I reach the exit, it just takes me to the next level rather than back to the hub world. I read the tutorial that it has something to do with player start arguments, but I can't quite grasp it for some reason. What am I doing wrong?
1. Remember to use Teleport_NewMap from the hub to each other map, and to use it on each other map to return to the hub. (Also see Step 4, below.)
2. When you jump from your hub to a given map, give the first argument of the player start in each map the value 0. (For now, I'll assume you are not teleporting from one map to another. In other words, you can only go from the hub to a given map and back.)
3. The starting point in your hub will have a player start with 0 as the first argument. Then, if you have 4 portals, each bringing you back to the hub from your 4 maps, you'll have 4 additional player starts. Only, this time, the arguments will be 1-4 (to simplify, use a value that corresponds to the appropriate map number, although this is not essential).
4. In each map, put the appropriate player start argument in the Teleport_NewMap special.

Re: Hub Homeworld

Posted: Thu Aug 17, 2017 6:23 am
by Hidden Hands
ReX wrote:
Hidden Hands wrote:.....but then how do I get back to the hub? And also I want it to remember my progress in each level for when I choose to return to it. Do I have to edit maps 1,2,3 and 4 in order to give them an exit portal back to the HUB?
To get back to the hub you will need to use Teleport_NewMap (just like phantombeta said) on each map from which you are trying to return to the hub.
Yes, ZDooM will remember your progress once you set up the hub system correctly.
Yes, you'll need to edit Maps 1-4 to include Teleport_NewMap. If you wish, you can set up your "entry portal" on each map to also be the "exit portal" that returns you to the hub.
When I enter a portal from MAP00 hub, it's fine - it takes me to the correct level the portal goes to. But getting back is proving a pain. When I reach the exit, it just takes me to the next level rather than back to the hub world. I read the tutorial that it has something to do with player start arguments, but I can't quite grasp it for some reason. What am I doing wrong?
1. Remember to use Teleport_NewMap from the hub to each other map, and to use it on each other map to return to the hub. (Also see Step 4, below.)
2. When you jump from your hub to a given map, give the first argument of the player start in each map the value 0. (For now, I'll assume you are not teleporting from one map to another. In other words, you can only go from the hub to a given map and back.)
3. The starting point in your hub will have a player start with 0 as the first argument. Then, if you have 4 portals, each bringing you back to the hub from your 4 maps, you'll have 4 additional player starts. Only, this time, the arguments will be 1-4 (to simplify, use a value that corresponds to the appropriate map number, although this is not essential).
4. In each map, put the appropriate player start argument in the Teleport_NewMap special.
Is Teleport_NewMap different to Teleport to Map? Because I can't find the Teleport_NewMap version and when I use Teleport to Map, the linedef doesn't do anything. For example - the home hub portals work fine with Teleport to Map. But when I arrive at the exit of the map I just teleported too, it doesn't work. I have a linedef in the first non-hub level that uses Teleport to Map with the player start argument and everything but when I walk over it nothing happens. Like its completely dead.

Re: Hub Homeworld

Posted: Thu Aug 17, 2017 7:14 am
by Graf Zahl
The only difference between Exit_Normal and Teleport_NewMap is where the destination map number is taken from. If all maps have only one exit you may just use Exit_Normal and declare ther destination in MAPINFO. Teleport_NewMap is necessary if you have more than two exits to different maps and the regular and secret exit do not suffice.

The most important thing about hubs is the cluster number. Two maps are only in the same hub if their cluster number is identical, otherwise all hub history will be cleared when the new map starts.

Re: Hub Homeworld

Posted: Wed Aug 23, 2017 5:25 pm
by Hidden Hands
Can I please just ask where Teleport_NewMap actually is? I think the majority of my issue here is finding that exact title in the Doom Builder. Is it even in the Doom Builder? I am currently upgraded to the latest GZDOOM ... any help please greatly appreciated.

Re: Hub Homeworld

Posted: Wed Aug 23, 2017 11:14 pm
by Kappes Buur
Teleport_NewMap is found in any DB variety editor under Teleport.
It is called Teleport to Map
Spoiler:

Re: Hub Homeworld

Posted: Fri Aug 25, 2017 8:13 pm
by Hidden Hands
Ughhhhh another problem.... From the hub (MAP00), I enter MAP01 through the correct portal. I complete MAP01 and exit through the portal that is SUPPOSED to take me back to the hub... but instead, I get this error... "Cannot load LEVEL01"

WHAT!?

Why is something so simple proving so damn difficult for me? I'd like to think I'm not completely useless with hubs.

I've included a screenshot of my EXIT PORTAL in MAP01 that's causing this error, and hoping someone can tell me where I'm going wrong. I need it to take me back to my hub homeworld.

Re: Hub Homeworld

Posted: Sat Aug 26, 2017 2:19 am
by Nevander
That actually looks like some kind of bug. Somehow G/ZDoom is getting confused and thinks MAP00 is NRFTL's LEVEL01. Try doing this instead from an ACS script instead of a direct line action:

Code: Select all

ChangeLevel("MAP00", 0, 0, -1);