I'm working on writing an RPG/Adventure game-play mod for GZDoom. One thing I've been working is a "Look" feature where the user can spawn a 3d cursor into the world and it will describe what it is pointed at. I'm designing it modular and portable so it can be used in another mods as well. This probably isn't too useful in most doom mods which are more focused on run-and-gun and less on examining the environment. But would be great for an RPG, adventure, puzzle, exploration, horror, etc, or any mod where you want the player to stop and look around and even give them hints about things they see.
To use it, load the pk3 like you would any other. It only requires gzdoom.pk3 resources, so it should be iwad independent. Bind a key to +Look either at the console or through the usual options menu. I use the key "Q". In game, hold this key to spawn a 3d cursor, then move/look around until it lands on what you want to look at, then release the key. The description will be printed to the console. I've included descriptions for all Doom 1,2, and Plutonia things. Tell me if I got something wrong or something that could be better.
How it works
There is a main describer that does a simple look up for a description of the item under the cursor in the language file. There are also describer add-ons to give additional details. If someone wants to use this in their mod and has custom information to present that is more complex than can be handled in the lookup, they only need to write that logic in a describer add-on and the rest is automatic. The describer also runs everything through a language handler which keeps track of the object's grammatic gender and number so that it picks the correct pronouns and adjectives and articles and whatnot. This isn't too important in English where most words are gender-indiscriminate, but if you're including translations in your mod, this will be helpful to keep the language correct.
What this is useful for:
- Modding, obviously. Just include it in your mod and it's good to go. If you have custom graphics or actors, see the language files for examples of how to add descriptions for your mod.
- Debugging - Trying to figure out why your actor isn't doing what you want it to, and wish you had an easy way to inspect it's variables in-game? Easy - just write a describer add-on to print those values you're interested in and now you've got a useful inspection tool. I use this in combination with Nash's RadiusDebug mod (and my mod of that which color-codes the 3d frame depending on the actor) and it's super useful to see where the actor is and what it is doing.
- Playing - I use this even on plain doom levels. Two biggest things I use it for: looking at floors to see if they're damaging - it saves me the trouble of save-check-load, and looking at switches to see if they're a level exit. I hate unmarked level exits, now they're less of a surprise.
- Cheating - I tried to make this not give out too much information, but any additional information you give the player that the level author didn't know about could potentially spoil the game. One thing I did was that if the cursor hits a line marked as 1-sided on the map, I consider this a secret and give less information about it than usual. Another thing is that the cursor passes through mid-textures, so it can be used to detect fake walls.
Try it out:
Works on all Doom maps, also includes a testing map with a variety of doors and floors and other things to look at. Load Test_MwrLook and have a look around.
And I have to give credit to Player701 on this forum who answered lots of questions and even took the time to provide detailed examples. Without that help I wouldn't have got this code anywhere near where it is now.
- Spawning a cursor on a 2-sided linedef attached to either a floor moving up or down or a ceiling moving down causes the cursor to jitter for the first few frames. I have no idea what's causing this or how to fix it.
- I have no logic to determine if the sight check should go through a mid-texture or stop at it. For now it always goes through.
- When looking at geometry moving towards you (floor coming up, ceiling coming down, poly-object approaching) the cursor gets spawned behind the geometry. I think my cursor spawns before the geometry is adjusted, but I don't know how to fix that.
- The language handler tracks the grammatical gender and number for the object in a sentence like "You see a cacodemon." but not for the subject. This is fine for English and the vast majority of languages out there, but for languages that conjugate in agreement with the subject, this would be a problem for translating. But I'll worry about that if and when it ever comes up.