Game changing - queries

Discuss programming topics for the various GPL'd game engine sources.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

mh wrote:Anyway, the question I was asking there was how to tell the engine to load the correct gfx.wad during a run-time game change event
I get it now ;)

How do you know to use hipnotic if it isn't specified and if the mod isn't supplying a gfx.wad ...

I missed the implications of that scenario.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

Not a problem; I can see how the way I originally put it may not have been so clear. :)
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

Baker wrote:How do you know to use hipnotic if it isn't specified and if the mod isn't supplying a gfx.wad ...
Lets put that another way.

How can you use a hipnotic 'format' gfx.wad if one is not provided?


Quake2 has an interesting feature to select the map after the current one. If you type map blah.cin+phooey it'll go into demo mode, play blah.cin, and when a client is done, it'll change map to phooey.

So, why not do the same with gamedir in quake?
gamedir [rogue+][hipnotic+]<mymod>
where square bracketed items are optional and angle bracketed items are mandatory.
This coupled with the hud selection based on gfx.wad gives all the required versatility (with a single command) and provides a mechanism for custom mods to depend upon other custom mods (presumably custom adaptations of the larger TCs).

Or you could get the mod authors to add a 'deps.txt' file listing the dependancies of the mod in the gamedir. Whatever works really.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Post by mh »

I think of those two, multiple args to the gamedir command is the way to go. Using a "deps.txt" is a nice and clean idea, but it can't really be retro-fitted to existing mods.

What I really like about the multiple args method is that it can be combined with the cvar-based method, giving the player the choice of which to use.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Game changing - queries

Post by Baker »

This is an oldy, actually surprisingly old.

The "right" way to do this --- barring some better "right way" is ...

game whatever -hipnotic // FitzQuake uses "game" as the command in-engine.
gamedir whatever -hipnotic // Every other gamedir switching engine (id Software's Quakeworld, DarkPlaces, JoeQuake, etc.)

Extra params like "-hipnotic" or "-rogue" or with user made mods like "-quoth" or "-nehahra", the change can only successfully go into effect during a gamedir change since the HUD images have to be reloaded.

[p.s. It looks like DirectQ and other MH engines might already support this precise method, which isn't surprising since this is the "right" way to do it. I finally got sick of having to restart Quake to indicate the special gamedir extra of -rogue, -hipnotic or -quoth ... or -nehahra).]

Yeah, this thread is older than dirt but I didn't want to start a new one.
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Game changing - queries

Post by mh »

Funny to see this one brought up; I've since gone back and completely removed the old cvar system for this as - while it sounded really neat in theory - in practice it was just a colossal pain.

The biggest downside to it was remembering to have to switch one of the cvars back to 0 for when you want to change games again but not have the mod included. Nothing like a bit of field-testing to bring out the glitches.

This is something that it seems not too many people are aware of, but you can actually do this:

Code: Select all

Cmd_AddCommand ("game", Com_ChangeGame_f);
Cmd_AddCommand ("gamedir", Com_ChangeGame_f);
Everything works and no matter which one of them the player expects to be able to use things just work (and there are valid arguments for "game" as (1) it's what Quake II uses so there's precedent in the official evolution of the Quake engine, and (2) it's what Fitz uses so there's precedent in what the SP mapping community prefer). As a bonus you get to be on both sides of a potential religious war!

Also, the following makes sense:

Code: Select all

for (i = 1; i < Cmd_Argc (); i++) COM_AddGameDirectory (va ("%s/%s", basedir, Cmd_Argv (i)));
One other thing I currently do is pre-scan the args for rogue/hipnotic/etc, then load them before anything else, then when loading the rest of the games skip over rogue/hipnotic. That ensures that they're consistent with id Quake in the search paths, although there may be reasons to load them in player-specified order that haven't occurred to me. Otherwise everything is taken in in the order that the player specifies.

-game on the command-line is tricksier and I haven't implemented much around that beyond the basic id Quake functionality.

Yes, while parsing the games specified by the "game" or "gamedir" command, snoop for hipnotic/rogue/etc and set the qbooleans appropriately, then junk the sbar pics and reload them.

The other last thing is that as Quoth requires the hipnotic HUD it makes sense to just set "hipnotic = true" if you detect that Quoth is being loaded. Ultimately this has the same effect as the former required advice to use "-hipnotic -game quoth".
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Game changing - queries

Post by Spike »

imho better to detect the hud elements to display based upon the images stored within the wad, then just add multiple arguments to the game/gamedir command to load multiple gamedirs as needed. its just less specific.
this is basically what I was saying back in 2009. :P
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Game changing - queries

Post by mh »

A mod could require -hipnotic but provide it's own gfx.wad - Quoth does this. So you'd need to open and parse each gfx.wad in each gamedir as you load it in order to get that working (it doesn't seem enough to just parse the mod's gfx.wad as they may omit some icons for weapons or powerups they don't use but still require the same HUD layout). Alternatively another mod could rip some images from hipnotic's gfx.wad and put them in it's own - I don't know of anything that does this, but I've long since learned that there is little limit to what Those Wacky Modders will get up to. When in doubt I tend to err on the side of doing what id Quake did - at least if it breaks you can always point at it and say "well it breaks with id Quake too".
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Game changing - queries

Post by Spike »

quake only ever loaded one gfx.wad. it doesn't make sense to scan each one in turn as missing replacements in there would be broken even in vanilla. just go by the names of the lumps in there.
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Re: Game changing - queries

Post by mh »

The bit that I'm not quite understanding is this:

The engine knows what games to load based on the contents of gfx.wad, OK?
But the engine can't know which gfx.wad is the correct one to use until after the games are loaded.

Take a hypothetical -hipnotic case. Game loading goes through Com_AddGameDirectory for ID1 by default, which I'm assuming is always done anyway, even in this setup.
Then, the way I'm reading it, you have a snoop in gfx.wad to figure out what other games to load.
But the gfx.wad you'll be snooping in is the ID1 version, as hipnotic hasn't been loaded yet, so hipnotic won't be loaded at all.

There's obviously some other info here that I'm missing, or my understanding is slightly arseways.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Game changing - queries

Post by Spike »

you'd still need to specify both, just as 'gamedir quoth hipnotic' instead of any special case -hipnotic stuff. then you can make all sorts of derivative mods using the same mechanism.
as baker said, but without the special cases.
Post Reply