Forum

Future Tutorial Ideas ...

Discuss programming topics for the various GPL'd game engine sources.

Moderator: InsideQC Admins

Postby mh » Thu Dec 04, 2008 4:47 pm

Getting rid of the double-switch can involve quite a bit of work - either deferring all video startup (and anything else that relies on it) until after the configs are loaded (and you better make sure you have your cvars registered outside of the relevant _Init functions) or loading the configs twice. Either way it's messy. :(
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Baker » Thu Dec 04, 2008 5:47 pm

mh wrote:Getting rid of the double-switch can involve quite a bit of work - either deferring all video startup (and anything else that relies on it) until after the configs are loaded (and you better make sure you have your cvars registered outside of the relevant _Init functions) or loading the configs twice. Either way it's messy. :(


Certain cvars don't fit well within the config.cfg system of doing things. I'm sure this has been discussed before, I think there is a thread where you had discussed the idea of storing certain ones elsewhere.

The ones that are entirely inappropriate for config.cfg way of doing things are:

1. brightness/gamma/contrast
2. video setup
3. anything to do with the mouse input
4. memory and gl rendering cvars that aren't gamedir preferences (gl_fullbright would be an example)
5. Stuff like AVI capture cvars

This is because there is no purpose of every gamedir having their own set of those cvars in a config.cfg. The above type of settings would almost exclusively be something you'd want every single time.

Adding to list of good tutorial ideas:

Saved command history (I believe this feature first appeared in SonsQuake, but I know this only from the JoeQuake readme.txt or maybe the source).

But furthermore, I like how ezQuake improved on the command history; JoeQuake's cmdhist.dat is not "human readable" whereas the one in ezQuake is a text file.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby mh » Thu Dec 04, 2008 8:49 pm

Baker wrote:Certain cvars don't fit well within the config.cfg system of doing things. I'm sure this has been discussed before, I think there is a thread where you had discussed the idea of storing certain ones elsewhere.

The ones that are entirely inappropriate for config.cfg way of doing things are:

1. brightness/gamma/contrast
2. video setup
3. anything to do with the mouse input
4. memory and gl rendering cvars that aren't gamedir preferences (gl_fullbright would be an example)
5. Stuff like AVI capture cvars

This is because there is no purpose of every gamedir having their own set of those cvars in a config.cfg. The above type of settings would almost exclusively be something you'd want every single time.

I remember that idea!

Unfortunately, I've learned that any kind of changed behaviour like that is a breaking change so far as mods are concerned. It's unlikely, but you never really know when a mod is going to use one of those cvars in an unexpected manner. I mean stuff like "my mod only works on GLQuake, I need a spare cvar to stuff a setting into, so - hey! - I'll use vid_mode". Party like it's 1996.

Not that any mod author here would do that, but here is far from a high percentage of mod authors. And the reaction will be "your engine sucks, my mod blows up on it". (Do I sound like Raymond Chen yet?)

Of course, any cvars you introduce yourself are fair game.
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby mh » Fri Dec 05, 2008 3:50 pm

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I thought about this and decided to do the following: http://mhquake.blogspot.com/2008/12/tho ... y-and.html
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby metlslime » Sat Dec 06, 2008 12:16 am

mh wrote:Getting rid of the double-switch can involve quite a bit of work - either deferring all video startup (and anything else that relies on it) until after the configs are loaded (and you better make sure you have your cvars registered outside of the relevant _Init functions) or loading the configs twice. Either way it's messy. :(


Loading configs twice is probably the way to go -- inelegant, but not really that messy.

Another approach is to add a PostInit callback for all modules, so that Init creates the cvars, but PostInit would act on them after the configs have been read, for example VID_PostInit would actually create a window.

Hmm, I guess a third approach would be to create cvars as they are encountered in config files, even though they are unrecognized. When later they are initialized, the pre-existing config value could be preserved.

This is also one of the ways to address the problem of people who use two engines, where each engine drops the other engine's unique cvars, losing settings between sessions. (Though another, possibly better way to fix it is for each engine to save their own enginename.cfg which gets read before quake.rc)
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby Baker » Mon Dec 08, 2008 11:58 pm

frag.machine wrote:A tutorial showing how to implement a reliable way in GLQuake to change screen resolution and modes on the fly. I tried copying this from some engines but it was erratic to say the least (and usually just crashed when running in older GL cards and/or with buggy drivers).


Done.

I included the changed source files as well, as the tutorial is a little cumbersome with the quantity of changes in gl_vidnt.c

viewtopic.php?t=1293
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby frag.machine » Tue Dec 09, 2008 10:29 pm

Baker wrote:
frag.machine wrote:A tutorial showing how to implement a reliable way in GLQuake to change screen resolution and modes on the fly. I tried copying this from some engines but it was erratic to say the least (and usually just crashed when running in older GL cards and/or with buggy drivers).


Done.

I included the changed source files as well, as the tutorial is a little cumbersome with the quantity of changes in gl_vidnt.c

viewtopic.php?t=1293


Heh, thanks... I just downloaded and taking a first look on it.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby Baker » Sun Dec 14, 2008 8:24 am

A tutorial I know I wish existed is one that does the DarkPlaces method of substituting missing models with a generic "this model is missing" "model" on startup instead of crashing and burning.

Speeds up testing QuakeC when something isn't right and all you care about is the QuakeC, not whether or not some model is there.

As I imagine this is probably not hard to do, I might investigate and write it up in the next week or so.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby r00k » Tue Dec 16, 2008 2:31 am

maybe just substitute the portion that would call "missing model" with a generic precache of the NULL model?

Code: Select all
      if (cl.model_precache[i] == NULL)
      {
         cl.model_precache[i] = Mod_ForName ("progs/NULL.mdl", false);
      }
   


maybe?
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby Baker » Tue Dec 16, 2008 3:46 am

r00k wrote:maybe just substitute the portion that would call "missing model" with a generic precache of the NULL model?

Code: Select all
      if (cl.model_precache[i] == NULL)
      {
         cl.model_precache[i] = Mod_ForName ("progs/NULL.mdl", false);
      }
   


maybe?


Almost. But the above is depending on external file!

Adding a feature to an engine to be able to run QuakeC when the model is missing shouldn't depend on a model that could be missing :D

i.e. What if it can't find null.mdl?
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby MeTcHsteekle » Tue Dec 16, 2008 3:52 am

hmm, i think acquiring a null.mdl wouldn't be a problem because a lot of mods seem to have them, and you can always make your own with almost no effort, unless you want a cuowal null model....
bah
MeTcHsteekle
 
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Postby Baker » Tue Dec 16, 2008 5:05 am

It looks like the basics of what DarkPlaces is going is adding a "loaded" field to model structure and setting it to true if the model was successfully loaded.

If it isn't loaded it prints a warning on load first and later come rendering time, it doesn't draw the model and uses an alternate effect to just render an object where the missing model should be.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby metlslime » Tue Dec 16, 2008 6:27 am

what if null.mdl can't be found?

Oh wait, that's easy to fix, just create a null_null.mdl
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby Spirit » Tue Dec 16, 2008 10:05 am

Why not "embed" a simple model in the engine itself? I guess that is how Darkplaces does the colourful diamond.
Improve Quaddicted, send me a pull request: https://github.com/SpiritQuaddicted/Quaddicted-reviews
Spirit
 
Posts: 1031
Joined: Sat Nov 20, 2004 9:00 pm

Postby Baker » Tue Dec 16, 2008 10:46 am

Spirit wrote:Why not "embed" a simple model in the engine itself? I guess that is how Darkplaces does the colourful diamond.


Yeah, that might be what I end up doing.
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

PreviousNext

Return to Engine Programming

Who is online

Users browsing this forum: No registered users and 1 guest