3 ms·
Oh thanks for the link, that looks pretty cool. For some reason it reminds me of _why's mini dungeon in ruby: http://poignantguide.net/dwemthy/ http://poignant
by dhotson 18y ago
Oh thanks for the link, that looks pretty cool.
For some reason it reminds me of _why's mini dungeon in ruby:
http://poignantguide.net/dwemthy/ http://poignantguide.net/dwemthy/
I used to love writing my own adventure games in QBasic. I found that using stuff like GOTO's was actually a pretty good metaphor for moving between rooms.
Now that I think about, an Object Oriented language would make a lot of sense.. these adventure games are basically made up of objects that you interact with.
- silentbicycle 18y agoI don't know what languages you know, but it seems like one could put together something surprisingly quickly in Python. You could go the OO route, or just use dictionaries, e.g. stairwell = { descr:"You're in a stairwell. There are footsteps echoing from above.", exits=[('up', rooftop), ('down', basement, locked=True)], items=[scrap_of_paper] } This is not actually very different from the approach taken in the Lisp link.
- dhotson 18y agoAh yep, dictionaries are pretty similar to objects in this sense. Mostly just a matter of notation. I often use dictionaries as a poor man's object. It could be kind of cool to have proper objects with methods to interact with them. You could use code reflection to figure out what verbs are supported.
- silentbicycle 18y agoNot objects, structs though. The syntax for (and ability to mix types in) Python dictionaries make them really convenient for this sort of thing. Of course, you can have references to functions in dictionaries and use them for dispatch. I think that's how the OO system is implemented, anyway. I'm only slightly acquainted with Lua, but it looks like it gets a lot of expressiveness out of having a similarly useful dictionary-like type. I think it calls them 'tables'.
- dhotson 18y agoOh cool, I think that's similar to how JavaScript 'objects' work. I've heard that it's not that difficult to do object oriented stuff in plain C using nothing but structs and function pointers. I can imagine the syntax would be a pain in the ass and ugly as hell though. :P I'll have to take a closer look at Lua.. have you used it much before?
- silentbicycle 18y agoNope. I read about it and played with its interpreter some, but its niche isn't really very relevant to me. It seems designed for when you want something flexible and Python-like to embed in a C program, but you need something minimalistic because memory is really tight. It looks like a pretty well-designed language, though. It's small and clean enough that one could probably memorize the entire language.