How to program a text adventure in C (2016)
home.hccnet.nl
How to program a text adventure in C (2016)
1–10 of 36 posts
Re: How to program a text adventure in C (2016)
#2The code generation looks interesting. I'll have to take another look later; can it not be done with the preprocessor?
Re: How to program a text adventure in C (2016)
#3Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
Re: How to program a text adventure in C (2016)
#4Ask HN: what's a good JS (browser focused) text adventure engine? I see me making a text adventure (adding one mini chapter) each day as a good lockdown project. Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
Re: How to program a text adventure in C (2016)
#5Ask HN: what's a good JS (browser focused) text adventure engine? I see me making a text adventure (adding one mini chapter) each day as a good lockdown project. Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
The classic engine is Inform, and a quick look in the manual says it can publish to a playable webpage: http://inform7.com/
I would throw Ink (from Inkle, creators of 80 Days, Steve Jackson's Sorcery!, and Heaven's Vault) in the ring for the choice-driven variant of IF. It also publishes a playable webpage. I made a sort of unconventional portfolio-like page with it here: https://maxsond.github.io/
Re: How to program a text adventure in C (2016)
#6Re: How to program a text adventure in C (2016)
#7Ask HN: what's a good JS (browser focused) text adventure engine? I see me making a text adventure (adding one mini chapter) each day as a good lockdown project. Note: I might call it "Everything is better in quarantine." The goal would be to (not) go mad.
Re: How to program a text adventure in C (2016)
#8Re: How to program a text adventure in C (2016)
#9 OBJECT *obj;
par->tag = src;
par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject;
forEachObject(obj)
...
The initialization of the obj variable received an obliviate spell.Also function parseAndExecute (). The way he deal with invalid input is, epic:
static const COMMAND commands[] =
{
{executeQuit , "quit"},
{executeLookAround, "look"},
...
}
for (cmd = commands; !matchCommand(input, cmd->pattern); cmd++);
return (*cmd->function)();Re: How to program a text adventure in C (2016)
#10This programmer, Mr. Ruud Helderman, is like Cool McCool, "Danger is my business!". For example, the parser, function matchParam: OBJECT *obj; par->tag = src; par->distance = *src == '\0' ? distNoObjectSpecified : distUnknownObject; forEachObject(obj) ... The initialization of the obj variable received an obliviate spell. Also function parseAndExecute (). The way he deal with invalid input is, epic: static const COMM…
The array iteration code is also solid. Seems like a pretty good programmer, judging from the code you cite here at least.
While I personally like to put a few assertions just to find my typos quicker, adding additional fluff here is mostly detrimental. The kind of bugs that can happen with this sort of "dangerous" code are the ones that you basically just typos that you catch on the first run. I.e. it's not like there are any rarely occurring edge cases that are unhandled, since the code is extremely straightforward. The "complexity" is very low.