News for hackers. Stuff that matters.
Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by stevekemp on Monday April 26, 2021 @02:40PM (#26946290)
I recently started playing with a Z80-based single-board computer, as I noted in a previous submission:

https://news.ycombinator.com/item?id=26843660

Of course I immediately started working through some of the classic text-based adventure games (zork, hitchhiker's guide, etc), and that made me think I should write a game of my own.

This is very basic, with only four locations, and maybe 1/4 of the code is related to easter-eggs. Parenting means that Paw Patrol is a big deal, so there are some good references.

Anyway I had fun writing it.

Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by nickt on Monday April 26, 2021 @05:18PM (#26948283)
Thanks Steve, that's a great little project. Thanks for clear comments in the code too!
Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by tyingq on Tuesday April 27, 2021 @12:05AM (#26951890)
>This is very basic, with only four locations

I see 5 :)

Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by stevekemp on Tuesday April 27, 2021 @05:14AM (#26953693)
Five implemented, but four visible to the player!
Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by jcadam on Monday April 26, 2021 @03:10PM (#26946670)
My one experience programming for a Z80 based SBC was an industrial controller we used as the onboard computer for a high altitude balloon. A mix of C and asm. Wrote the code on a PC connected to the board through the RS-232 port.

Was one of my favorite projects - had to interface with a packet radio and a GPS receiver, along with various sensor attached to the controller's analog ports.

Now back to Java... :(

Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by unixhero on Tuesday April 27, 2021 @01:32AM (#26952390)
There are plenty of jobs where you don't have to touch Java.
Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by jcadam on Friday April 30, 2021 @07:28AM (#26992069)
Java pays too damn well.
Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by krychu on Tuesday April 27, 2021 @03:56AM (#26953242)
> The implementation is mostly concerned with creating the correct series of data-structures, which are essentially arrays of objects. Because if we can make the game table-based we simplify the coding that needs to be done - we don't need to write per-object handlers anywhere, we can just add pointers to tables/structures.

Interesting model, could you share how this worked out for you? Good and bad?

Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by stevekemp on Tuesday April 27, 2021 @05:02AM (#26953643)
It worked out really well, saving me from writing a lot of fiddly code.

For example imagine you wrote an "EXAMINE" command, and you wanted to allow all objects to be examined. The horrid way to do it would be something like this:

     if target == "desk"
       print( "The desk is ..\n" );
     if target == "book"
       print( "The book is ..\n" );
With a table-based approach you just define your struct (in C) or item-table (in assembly) and your code now looks like this:

       item = find_item_by_name( object );
       print( item.description );
Sure you have to write the lookup function to find the object, but it means you don't have to duplicate the logic for every action (get, drop, examine, use, etc).

Using tables for items, and locations, basically saved me a lot of custom code, cut down on repetition.

Re:Show HN: Text adventure for CP/M – Lighthouse of Doom by Zilcho on Saturday May 01, 2021 @04:35PM (#27009582)
The most interesting text adventure I saw years ago (with online connection", was a person who had written a fairly good frame of a text adventure, and was also sitting at the keyboard choosing which macro to hit or typing things in. It took me awhile to catch on, because it was mostly automated.