Woo my MUD has its first NPC
Attached is a screenshot of the code that makes her, which is really rough and verbose because well, its the first one!
But, she can send messages to players in the same room as her, and move herself room to room.
@emacsomancer like there's so much fluidity! the mass quality defined here... actually only ever exists in one other place, kind of, where there's a check for things with that quality when you "look"
Other than that, it's just... just add it and use it! It's kinda like... emacs in that way? loosely extensible, yo ucould add a emacsomancer-score quality to any given thing and work with it however you wanted.
(And you can define proper checks like to make sure the score is only ever an int.)
(I am kinda proud of this engine as a whole I'll be honest. for a hobbyist hack effort, it's cool!)
@emacsomancer *nod* I look to early MUD history and say, if those folk who sometimes came into being MUD developers just because they were expert players and had no programming experience, could make some of those cool systems, using a weird C derivative, then folk can probably do at least as well with a LISP.
I don't really care about people who are already programmers they can use one of the many other MUD engines :D
@emacsomancer I will say, I've probably written like 20 different versions of "make the world map" code, but like, without ever really needing to think or work too hard about it and I think that more shows how un-locked-into-one-way things are.
@emacsomancer (if you or anyone else is curious this is the current way that it's done: the objects are prebuilt with "area-id" qualities that are each unique, and then sorted into a hash-table where each key is that id and each value is the corresponding thing.
Then exits are added, using those IDs to find things.
It wouldn't scale well for a world of thousands of rooms, but this isn't that sort of MUD!
@emacsomancer i don't know about any of that, but it only looks them up in the hash table to set the exits up, once they're set it points directly to the thing that is the room you'd move into
@emacsomancer The main issue with scale I see is actually just the human error of it being hard to manually map the exits of several thousand rooms without errors.
Luckily this way of map-building errors on build, /not/ when a person tries to use an exit that is broken.
I'm planning on handwriting this universe of my own library and stuff but for the game-MUD I'm planning I've actually had a change of heart towrad generated worlds, because I think that's the only way I can get the sort of ecological complexity that I crave.
@emacsomancer It is! And it's in active development and getting more sophisticated - it's a LOT more sophisticatedthan it looks at glance, in terms of building cultures and stuff.
But at the end of the day it's a mapping app and I'd love to have something similar that makes a living world you can then step into.
@emacsomancer Right? At the moment it's all fairly simple but I'd love to see like, it plugged into some of the conlang generators out there so that your cultures could like, develop languags over time/dispersal, and other shit like that.
@emacsomancer You'd think so but if there's any sort of mechanic interplay between like the world's climate simulation and the plants that grow in an area, making a village grow apple sfor cider because you think that'd look cool can just, fail.
@emacsomancer I think that's so much a cultural thing and so little a code thing.
that said, I don't understand how to document Racket procedures so documetning my own API hasn't happened yet. But yea, everything is pretty clearly labeled, and I feel like even procedures like add-string-to-quality-of-things-with-quality-in-quality-of-thing! are pretty sensible once you understand the underlying concepts about things and qualities.
(Cool engine thing: call (add-string-to-quality-of-things-with-quality-in-quality-of-thing! 'output-buffer 'output-buffer 'contents room) and it actually looks, first in the room itself and then the universe the room exists in, if there is one, for an (add-string-to-output-buffer-of-things-with-output-buffer-in-contents-of-thing!) procedure and uses it, instead.
At least, I think it's cool - this sort of "let thigns and universes hold their own procedures" is letting me do cool chains of hooks, basically, i think they're called, and I've never seen that in a MUD before. espeically not where it's so easy to add your own hooks.
@emacsomancer Thanks! So far I'm really inconsistent in applying it, but honestly the "swap out the world quality for arguments then try and use that procedure" is... gosh it's so convenient.
Cause I can then just write (set-thing-mass! t m) (unless (integer? m) (raise-argument-error...) (set-thing-quality! t 'mass m #:skip #t))
'set-thing-mass! set-thing-mass emsverse)
And bam now whenever anything created into the emsverse tries to (set-thing-quality! moose 'mass 200), it checks that 200 is an int.
No further writing of procedures about mass needed!
(This is the pinnacle of what like 18 years of restarting a MUD engine from scratch, but only to work on it for a month or so every 2-3 years, gets you. lol.)
@emacsomancer right - exactly.
(+ 2 2) is intelligible, once you learn to read it
(+ 2 (+ 1 1)) makes sense then too
(+ 2 x) makes sense too - and the above implies that x doesn't HAVE to be a number.
These little implications kind of led me to the idea "well if I can swap out that second two for a procedure or variable, then I can make code that does the swapping, too!
@emacsomancer I feel like LISP helps me accept I don't need a complete mental representation, I just need to maintain my bearing along my current flow of inputs leading to output!
@emacsomancer This brings me to a question I had with Emacs:
Do you know of any folding modes that let you fold "every s-exp ABOVE this one"
A lot let you fold everything more nested (I've been using yafolding and appreciate it's simple "how indented are you folding)
but sometimes I wanna close everything that leads up to a statement and justlook at that.
This mastodon instance is dedicated to the survival of indigenous languages, plant knowledge, art, and culture outside white supremacist-controlled networks Facebook and Twitter.
Decolonize food. Decolonize medicine. Decolonize housing. Decolonize from corrupt white supremacist networks. Decolonize the US from its oligarchal form of government! European statues, place names, words, languages, and accounting systems DO NOT BELONG on Turtle Island, and are killing the whole planet. "Traditional Ecological Knowledge" (TEK) is the only thing that can help humans as colonial systems continue to sink deeper into broken, inequitable, and faulty systems that value money over Earth's many forms of life. #LivingWalls, not border walls. . Understand more... .