.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...

Post tutorial Report content RSS feed Custom Hub for PK source update

Tutorial for painkeep source update custom hub feature.

Posted by on - Intermediate Mapping/Technical

Turn any map into a painkeep hub.

How does it work?

First you will need to install the painkeep source update into your quake painkeep folder(s). Instructions for this are included in the download.
Second you will have to decide if you want to do this by the easy method or the harder method. The easy method requires an advanced engine like darkplaces that allows map entities to be over-rode with a {mapfilename}.ent file. The hard method requires editing the bsp with quark, or editing the source map and recompiling it.

Detailed instructions are provided here for the easy method, but the underlying operation is the same for any methods.

Run quake and load the painkeep update - commonly done by running 'quake -game painkeep' from the quake folder in a terminal. Users of different operating systems may need a different method.

You will need a key bound to impulse 35. This is the select impulse for the PK turret so you may already have it bound - the impulse will still select turrets if you have any. In the mods config this impulse has been aliased to pk_custhub and bound to ";" for convenience.

Cvar "saved1" must be 482 or 483. When set to 483 it adds extra comments to the .ent source so you know what to change. Remember to reset saved1 to "" when you are done. If you don't any time you use impulse 35 to select turrets a custom_hub entry will be put in the console.

Next load the desired map by any method - commonly bring up the console by hitting ESC key at the menu or hitting the ` key and then enter map {mapname}. For example, I used 'map dm4'.

You will have to enable PK mode "Always" on this map if it is not a painkeep map. This is done by accessing the admin mode. Visit the admin tutorial for activating admin mode - the update ships with admin turned off for server security. Commonly you bind a key to the defined admin impulse, hit this key and then enter the password. From the main menu enter a value of 60 until "Painkeep mode = Always" is displayed below the menu. Hit the admin impulse to exit the menu. You will only have to do this once for multiple maps because it saves this value. Once you are done making hubs you can return this setting to "Painkeep mode = Map" if you mix painkeep and regular maps and don't use dynamic painkeep items.

Now go through the map and select a likely hub portal location. Hit the key tied to impulse 35.
You will see this appear in the console:
"classname" "hub_control"
"target" "votes"
"wait" "180"
"map" "start"
"origin" "0 0 -10000"
// hub model
// delay = 0, ball with lightning
// = 1, capped column
// = 2, obelisk with base
// = 3, pyramid with base
// = 4, cube with base
// hub skin
// wait = 0, dark stone cap / base
// = 1, green stone cap / base
// = 2, red stone cap / base
// = 3, red cap / base
// = 4, blue cap / base
// = 5, yellow cap / base
// = 6, purple cap / base
// = 7, black cap / base
// = 8, red stone cap / base, yellow teleport
// = 9, red cap / base, yellow teleport
// = 10, yellow cap / base, red teleport
// = 11, black cap / base, red teleport
"classname" "hub_custom"
"targetname" "votes"
"map" "start"
"message" "Start (hub)"
"delay" "0"
"wait" "0"
"style" "1"
"origin" "'1439.0 926.5 -276.0'"

Every time you hit the impulse 35 key another hub_custom entry will be added for that location. It is possible to place hubs on platforms, lifts and trains. You must know the starting position of the model for that device, however. When you hit the 35 key, the model may not be in that position and may need tweaked - you will find that this is not trivial. If possible you may want to try and add another entry as a reference, but you must keep track of it so that it can be removed later.

This console data must either be: cut and pasted to the {mapname}.ent file, or edited into the map with quark or pasted into the map source for compilation.

The following MUST be done to every entry:
hub_control - painkeep needs this to run the hub.
"map" "start" - "start" MUST be changed to your mapname so the server can reload the hub.
Whatever value you put here will reload as the hub. If it isnt the hub, when that map ends the server may go to the start map (painkeeps hub) or you might get stuck in a 2 map loop.

If you want to both play on the map and use it as a hub, you will have to copy it and change the name.
For example, with dm4: copy dm4.bsp to dm4_hub.bsp and move dm4.ent to dm4_hub.ent. You dont want to leave dm4.ent around if you are using dm4 as one of your hub votes - it will still load the custom hub! Now use 'map dm4_hub' on the server console to start the custom hub.

hub_custom - one entry for each portal.
"map" "start" - "start" MUST be changed to the new map name to vote for. Other wise all votes will be for the start map.
"message" "Start map (hub)" - change this message to the one for the map selected so people know what they are voting for.
"delay" "0" - this number selects the hub models as detailed above.
"wait" "0" - this number selects the hub skin as detailed above
"style" "1" - if you make this 0 the portal will not be lit up.
"origin" "'1439.0 926.5 -276.0'" - you MUST remove the 2 ' ' inside the " " or the portal will not appear in the correct place. I can not find any easy method to remove these because vectors print with vtos.

At a minimum the hub_control must have the name of the hub map (dm4_hub in the example) and the hub_custom portals must have a map name change, description change and the origin vector needs the ' ' removed.

Once you are done selecting hub spots, save the console output and exit the game. On linux the console output will be available in the terminal you ran the game from. On other operation systems or if you run the game from a shortcut in linux, you may need to take steps to save or redirect the console output. Darkplaces has a log_file cvar to log the console output. Consult your game engine docs on how to preserve console output if its not available in a terminal.

Next cut and paste the console output to the {mapname}.ent file or save it for editing. You will have to make the changes as detailed above or every portal will point to the start map and your hub will not reload. After these changes you may have to remove bogus lines that are not shown between { } braces. Things like this must be removed:
You got the nails
You got the cells
Any extra text in a .ent file will cause map load to fail. If this happens check to make sure you didn't mangle the maps existing entities and then check your additions for bogus text.

Now you can run the game again, and load your new hub map. Go around and check each portal to see if it displays the proper message. You also should make sure no portals are close to deathmatch spawns or teleport exits - this can cause bogus voting. You should take every teleport and die enough times to see entry from every spawn point. If any of these puts you into a portal you should move it.

The easiest way to load a custom hub manually is with "map {custom hub filename}". If you want to run the hub every time you start a server add the command to the end of admin.cfg. Once the server is up you can reload custom hubs from the new map menu - login to admin and from the main admin menu select:
22: map control
If you are on the original map menu: "Painkeep map Menu: " select:
60: new maps
Now you should see an option to reload the last custom hub:
42: custom hub
If you have not loaded a custom hub, this option will reload the main hub, start.bsp.

The next step is testing the hub with live players.

Good luck. If you have any problems send me a message through moddb. I may not respond quickly depending on work.


Post comment Comments
numbersix Author

Rather than all these complex instructions, I have had a second thought...
The server admin provides (in a {mapname}_server.cfg file) a list of maps for the custom hub and a flag of some type.

The QC code will then randomly place portals around the intended hub map.
You will have a new hub experience every time the map loads. Yep, this is a feature.

Reply Good karma+1 vote
Post a comment

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Open to all members
Send Message
Join group
Group watch
Start tracking
Related Mods
Related Games
Quake First Person Shooter
Related Engines
DarkPlaces engine
DarkPlaces engine GPL
Related Groups
Dark Places engine team
Dark Places engine team Developer with 15 members
qc Hardware & Tech with 31 members