What's So Hard About Ruby?
-
I was trying to code in Ruby and I couldn't figure out how to obtain an attribute from something, and eventually gave up.
In soft code what I wanted to do was:
get(<room>/<attribute>).
I couldn't, for the life of me, figure out how to do it with ruby. I ... think my main problem was a lack of centralized documentation, but it was a year ago now and I can't remember for sure.
-
@cobalt That gets to what I was saying about how to learn the entire package, not just the language. Getting an attribute out of a room has very little to do with ruby itself, because the core language knows nothing about MUSH rooms or Database attributes. You'd have a similar challenge with coding in any modern full-stack application, regardless of language.
For the record, it's usually just
enactor.room.some_attr
orRoom.named("Bob's Cantina").some_attr
. You do also have to define attributes ahead of time - you can't just wing it with set(). So yeah, there are some moving parts and there's a learning curve.Ares has an extensive set of tutorials starting from 'hello world' and building up to adding a new field to the web portal. And of course you can always ask on the forums or discord. or page me on the test game or PM me here or send a carrier pigeon... I mean really, there's a lot of avenues for helping people to figure things out.
-
@faraday I found coding for MU* was an invaluable experience. It didn't shape my career, since I was already programming since I first got my Amstrad 6128, but it expanded my horizons really fast simply by giving me an incentive to mess around with MySQL when it was relatively new, work with version control and generally as part of a larger team, exposed me to APIs, data conversion, basic systems administration, shell scripts, network and socket code in general...
I would heartily recommend it to anyone who's looking to get into programming or is curious about a different professional path. It's not just internet points. What you can pick up from coding 'rooms' can easily translate into a potentially lucrative professional turn down the road, as long as one doesn't get complacent. Being ambitious with the toys you create on a text editor is a top-notch time investment.
Edit: Understanding other people's code. Expanding other people's code. Fixing other people's code!
-
@faraday said in What's So Hard About Ruby?:
Ares has an extensive set of tutorials starting from 'hello world' and building up to adding a new field to the web portal. And of course you can always ask on the forums or discord. or page me on the test game or PM me here or send a carrier pigeon... I mean really, there's a lot of avenues for helping people to figure things out.
Credit where credit is due. I have coded for MERC/DIKU and I've done some php but I am by no means a coder -- and I have been able to write a simple plugin or two for Ares based on those tutorials.
-
@arkandel said in What's So Hard About Ruby?:
I found coding for MU* was an invaluable experience. .. I would heartily recommend it to anyone who's looking to get into programming or is curious about a different professional path.
20-30 years ago I would absolutely agree. Now? MUSHcode is so far divorced from modern programming paradigms and languages that any concepts you learn from it don't translate very well.
That said, people learn best when they're passionate about the thing they're trying to learn; doubly so if there's a tangible, useful project that can come out of it. So for you if that's old-school MUSHcode, go for it. Far be it from me to stand in the way of anyone's passion project.
But if you're trying to learn it as a generic stepping stone to get into programming, there are better ways to do that IMHO.
-
I found Ruby to be a very newbie friendly language. When I first wanted to learn enough to code a plugin for Ares I took a vacation from work and spent most of my days for an entire week just reading, watching tutorials, and playing around with code. By the end of it I had a working RPG plugin for Ares(Song of Ice and Fire RPG by FFG).
Since then I've coded some more advanced systems and even learned how to create a web based character sheet. The hardest part, for me, is the web integration.
-
@faraday said in What's So Hard About Ruby?:
@cobalt That gets to what I was saying about how to learn the entire package, not just the language. Getting an attribute out of a room has very little to do with ruby itself, because the core language knows nothing about MUSH rooms or Database attributes. You'd have a similar challenge with coding in any modern full-stack application, regardless of language.
I'm someone who started from a base knowledge of 'can tweak some formatting stuff in PennMUSH and coded a couple of basic commands in MOO a few decades ago' who has now coded a fair number of Ares plug-ins, including a really, really large one that integrates magic with Ares' FS3 system.
From my perspective, what Faraday says here is true - but when I started, I didn't get enough about how modern code languages worked to even recognize the difference between 'the language' and the Ares framework (for lack of a better word). All I knew was that I didn't really understand where things were stored, how to get to them, how everything fit together, and how to make stuff GO.
It's actually really easy to find great documentation on almost everything in Ruby. Want to manipulate a string? Play around with an array? Do some math? Tons of examples!
Ares is well-documented, too, but the entire CONCEPT that I needed to learn Ares and not just Ruby was one that it took me awhile to wrap my head around. I think sometimes that's where some of the hurdle comes for folks (like me) who have very little coding experience. They GET how all the pieces of a MUSH fit together - but Ares fits them together somewhat differently, and you have to learn that structure, too.
One of my very first questions to Faraday was 'how do I make a command execute other commands?' (something I'd done in MUSH) and she told me 'that's generally a bad idea, use the helper functions instead'.
I don't know that I ever admitted that I had no idea what helper functions WERE, let alone how to use them. Now that I do, I understand why they're a better choice, but that mental leap took me awhile - as did figuring out where those functions lived and how to access them (pro tip: getting a real code editing program and learning a few shortcuts makes this much, much, MUCH easier).
I do think the Ares tutorials are very good (and getting better all the time, as I know Faraday makes adjustments as people find things that confuse them), but there's a bit of a mental shift that I think can be difficult if you're expecting Ares (I'd guess Evennia too, but I've never tried it, so I can't be sure) to function like a MUSH-but-with-different-syntax under the hood. It is-- but it also isn't.
Overall, I found Ares-and-ruby MUCH easier to pick up then PennMUSH. In particular, I find it much easier to learn how to do Big Stuff than I ever did in Penn. I doubt I'd ever have managed this sprawling, integrated, complicated magic system on Penn, because it's clunky and hard to read and there's no version control for when I really screw up and no easy-to-read config files. The leap from 'I can change the formatting on WHO' to 'I can code a new system' was much, much easier.
Also I can't say enough for the Ares discord community at large, who've helped me more than once on problems small and large and been really, really patient with questions of all sorts.
-
@faraday said in What's So Hard About Ruby?:
@arkandel said in What's So Hard About Ruby?:
I found coding for MU* was an invaluable experience. .. I would heartily recommend it to anyone who's looking to get into programming or is curious about a different professional path.
20-30 years ago I would absolutely agree. Now? MUSHcode is so far divorced from modern programming paradigms and languages that any concepts you learn from it don't translate very well.
That said, people learn best when they're passionate about the thing they're trying to learn; doubly so if there's a tangible, useful project that can come out of it. So for you if that's old-school MUSHcode, go for it. Far be it from me to stand in the way of anyone's passion project.
But if you're trying to learn it as a generic stepping stone to get into programming, there are better ways to do that IMHO.
I agree, of course, but with two caveats.
Part of being a successful developer involves more than the programming language or platform itself. Working with others, documenting your work, architecting something you plan to create so that it's modular and expandable for example are still valuable.
But the most important part, I think, is something you touched on; being passionate about a project. That's the kind of madness that leads us to set stretch goals - aiming to get something so ambitious done we don't currently know how to do, or perhaps even whether it's doable with the tools at our disposal. I wonder if at some point Ares might have started out that way?
There may be an aspiring programmer out there right now with some crazy-ass idea about a MU*-like game trying things out to see what works,
evenespecially if it means starting from scratch. And it's exactly the kind of work that leads to professional success down the line, too. -
@faraday said in What's So Hard About Ruby?:
20-30 years ago I would absolutely agree. Now? MUSHcode is so far divorced from modern programming paradigms and languages that any concepts you learn from it don't translate very well.
I ran into this from the opposite direction. I came into MUSHing with some QuickBASIC and Turbo Pascal experience, neither of which helped me learn MUSHcode. In fact, the experience led me to learn C so I could hard code the things I wanted and avoid MUSHcode almost entirely.
That was back in 1998. Since then, I've gotten a lot more comfortable with MUSHcode and can do pretty much anything I need to do in it provided I am sufficiently motivated to do so. I still much prefer a 'real' programming language though.
-
MushCode: Teaching people modern programming paradigms via the 'have you seen the alternative?' method.
-
@derp said in What's So Hard About Ruby?:
MushCode: Teaching people modern programming paradigms via the 'have you seen the alternative?' method.
"Nothing you'll see can possibly be worse than this shite"
-
Slightly off topic but related in a roundabout way.
What I find weird about this whole situation is that we've had MU*s that featured "real" programming languages (which were easily comparable in capabilities to, say, Python or Ruby, but without all of the mainstream support) for as long as we've had MUDs themselves and yet these have largely been ignored in favor of MUSH. What changed to suddenly make ditching MUSH in favor of Ares (or Evennia), a good idea?
-
@rnmissionrun said in What's So Hard About Ruby?:
Slightly off topic but related in a roundabout way.
What's I find weird about this whole situation is that we've had MU*s that featured "real" programming languages (which were easily comparable in capabilities to, say, Python or Ruby, but without all of the mainstream support) for as long as we've had MUDs themselves and yet these have largely been ignored in favor of MUSH. What changed to suddenly make ditching MUSH in favor of Ares (or Evennia), a good idea?
The ubiquity of computers and computer code. Once upon a time it was a nerd hobby for rich kids, or whatever. Now we all have computers in our pocket that could pilot an Apollo to the moon without making Youtube skip.
The internet, in particular, was a big source of this. MySpace was probably the first time that regular, everyday people learned about the guts and workings of web pages, HTML, CSS, etc. How to embed things. The basics of computer science.
Now you can't really get away from how integral computers and computer code is to practically everything, in every profession.
So instead of learning a million arcane languages, each designed for a specific task, it's a much more efficient use of time to learn one or two primary programming languages that are used for a multitude of tasks. It's just a really basic calculus of visibility and general utility.
-
@rnmissionrun said in What's So Hard About Ruby?:
What changed to suddenly make ditching MUSH in favor of Ares (or Evennia), a good idea?
Whatever success Ares has actually has zip to do with the programming language. It could have been Ruby, Python, or even been written entirely in MUSHcode. It doesn't matter.
Ares appeals to people because of its usability and web portal. It's not ditching MUSH; it's extending it. And it's not designed for coders; it's designed so you don't need a coder.
Now, as a coder designing a complex chargen system or whatever, I'd much rather work in a more modern language with all the conveniences of a full development environment, rather than trying to do 17-level nested parens and brackets stuffed onto a single line on my live game. But that is a wholly tertiary concern for why Ares is what it is.
-
Yes. I will forever love Ares bc it made it so non coder me could even entertain the idea of being able to get a game together despite that. Even though I am so code impaired that I had to get some help with coding, that is only because if adaptation. If I didn't want to do that I would not have needed help beyond asking others where to find things now and then.
And its nice to not need to be wiki savvy too. I
I didn't know the language that it uses, and didn't pick it for that.
-
Tangent - I didn't pick Ruby for Ares because I had some kind of love for the language. I barely knew it at the time.
The first Ares prototype was in C++, then I dabbled in C# with a Lua scripting thing for the plugins, then I tried Python seriously for a bit. Ruby was the one where the language itself supported the idea of a live-reload and easy overrides/extensions of core code via the plugins.
So I don't think there's anything magical about Ruby, but it's a nice language.
-
I don't know why ruby is so hard, but I am pretty sure diamond is harder.
-
@rnmissionrun said in What's So Hard About Ruby?:
Slightly off topic but related in a roundabout way.
What I find weird about this whole situation is that we've had MU*s that featured "real" programming languages (which were easily comparable in capabilities to, say, Python or Ruby, but without all of the mainstream support) for as long as we've had MUDs themselves and yet these have largely been ignored in favor of MUSH. What changed to suddenly make ditching MUSH in favor of Ares (or Evennia), a good idea?
It's not about Python or Ruby specifically. The reason that MUSH has been surviving for so long is that it's pretty much feature complete for roleplaying purposes out of the box, most games only need a dice roller and character generation, both of which they usually copy from some previous game in the same genre.
To replace MUSH, you would either need something easier to set up then MUSH or something as easy with better features. What both Ares and Evennia has done is integrate the web into the game, this is something you can do with MUSH (You can connect your web portal to the same database as the MUSH) but it's nightmarish to work with. This effectively brings MU* into the 21st century.
To do this, you would want a solid web framework. Python has Django which is super popular but it could as easily been developed in C# that has .net. Ares meanwhile uses Emberjs. All of this could in theory have been done long ago but the modern frameworks make it much easier, especially for someone just coding in their spare time.
@faraday said in What's So Hard About Ruby?:
@arkandel said in What's So Hard About Ruby?:
I found coding for MU* was an invaluable experience. .. I would heartily recommend it to anyone who's looking to get into programming or is curious about a different professional path.
20-30 years ago I would absolutely agree. Now? MUSHcode is so far divorced from modern programming paradigms and languages that any concepts you learn from it don't translate very well.
MUSHcode serves as a fairly good introduction to Lisp. Dialects of Lisp and languages similar to Lisp are still used by systems that need concurrency like telecom and financial backends.
That said, MUSHcode is a very painful way to learn to code. I would suggest starting with almost any other project if you want to enjoy the process of coding. It's a bit like writing a book on stone tablets, you can do it but there's easier ways.
-
@groth said in What's So Hard About Ruby?:
MUSHcode serves as a fairly good introduction to Lisp. Dialects of Lisp and languages similar to Lisp are still used by systems that need concurrency like telecom and financial backends.
That's true, but Lisp languages are such an infinitesimally small percentage of real-world programming that it's kind of like learning some weird dialect language that's only spoken in a far-flung corner of the world. Sure, if you live there or have a specific application for it, it's useful. But in general? Not so much.
Lisp-based languages have different design patterns. Lots of recursion and nested function calls umpteen layers deep. MUSHCode in particular lacks many features of most modern languages - classes, named variables, clear function definitions (to @Tat's point about understanding helper functions) or even comments and whitespace (unless you use a custom offline parser). And the way people generally code in MUSHCode is very different - no source control, editing live on game, putting in your code all smushed together onto a single line. These are things that would be considered unacceptable in almost any other programming venue.
I'm not saying Lisp (or MUSHCode for that matter) is a bad language. They have their niche uses.
But come on... this is ONE function from the FS3 combat system in MUSHCode. Even with liberal FUN_ helpers, t's insane. It's just not a good way to learn how to program. And I say that as someone who has literally taught programming.
&FUN_ACTION_ATTACK FS3Combat Instance Parent=localize([setq(0,u(fun_combatstat,%0,ammo))][setq(1,switch(grab(%2,burst,,),,1,min(%q0,3)))][setq(2,u(fun_weaponstat,%0,recoil))][setq(3,u(fun_range_mod,%0,after(grab(%2,range=,,),=)))][switch(0,t(u(fun_combatstat,%0,weapon)),u(fun_combat_msg,[prettify(lcstr(%0))] tries to attack but has no weapon!),t(u(fun_combatstat,%0,target)),u(fun_combat_msg,[prettify(lcstr(%0))] tries to attack but has no target!),not(u(fun_out_of_ammo,%0)),u(fun_combat_msg,[prettify(lcstr(%0))] tries to attack but is [ansi(hr,out of ammo)]!),[switch(%q1,>1,u(fun_combat_msg,[prettify(lcstr(%0))] fires a [ansi(hm,%q1 round burst)]!))][iter(lnum(1,%q1),[u(fun_do_attack,%0,switch(u(fun_is_in_vehicle,%1),1,u(fun_combatstat,%1,vehicle),%1),unprettify(after(grab(%2,called=,,),=)),add(%q3,-[mul(sub(#@,1),%q2)]),0)])][u(fun_suppress,%1,switch(u(fun_weaponstat,%0,wpntype),melee,0,1))][u(fun_subtract_ammo,%0,%q1)][switch(u(fun_out_of_ammo,%0),1,u(fun_combat_msg,ansi(hm,[prettify(lcstr(%0))]'s weapon clicks empty.)))])])
-
@faraday That made a small part of me die inside.