Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   Learning Programing (http://www.topmudsites.com/forums/showthread.php?t=7023)

js_wilson 04-19-2013 01:04 PM

Learning Programing
 
This is a question for all you MUD coding veterans out there.

I am not a coder by any stretch of the imagination. I have made some minor edits to some things other people have done, but mostly I just google whatever I am trying to do, and cut and paste, trial and error, until I can accomplish whatever I am trying to do. I have learned allot about being a builder over these last few months by tinkering with MUDs on my local machine, and going through the lessons over at tbaMUD, but I would like to step up my game at some point and start doing some coding.

I have heard it stated numerous times that working on a MUD is not a good place to start learning to code, and that one should have already learned to code before attempting to ply one's skills on a MUD. I have started some tutorials online, such as "Learn Python the Hard Way". I also have bought quite a few beginner programing books that I have been browsing. I have done all the "guess the number" type stuff that those newbie guides all seem to start you out with.

My question is, what should my next step be If my goal is to become a good enough coder to run my own MUD? I am not planning on building a MUD codebase from scratch at this point, but I would at least like to be knowledgeable enough to add features to an existing codebase.

plamzi 04-19-2013 04:28 PM

Re: Learning Programing
 
The lesson here is, don't treat advice like a prescription. I learned to code while working on a MUD, others have, too. Maybe whoever told you that meant that you shouldn't try to run your own MUD while learning basics. That's probably a good idea. The smaller you start, the less steep the mountain will look.

Most people apprentice themselves in their home MUD, if there's someone willing to let them learn on the job, and maybe even teach them a few things. It's always a good idea to pick a game you're really excited about, since chances are you're not going to get paid for your work.

Good luck, and remember not to take my advice as a prescription.

js_wilson 05-04-2013 12:34 AM

Re: Learning Programing
 
After reading your post I decided to take a second look at making my MUD completely from scratch. While I am still not totally convinced that this is the best option for me, I am now considering it. I would probably do something in python if I am starting from scratch and working on my own, so I have been spending most of my spare time reading and doing exercises from python tutorials.

ArchPrime 05-04-2013 09:44 AM

Re: Learning Programing
 
js_wilson:

Python is a great choice (it's what I use. ;-) ) Although, there are some big enough differences between Python 2.x and 3.x that you may want to start with 3 and stick to that one. Whatever the case, Miniboa is a great starting place, as it implements the server basics for you. From what I remember, Miniboa targets Python 2.x, however there is a 3.x port out there somewhere. Last I checked, the 3.x port had some bugs in it.

If you want to stick strictly to what the python library provides, I'd suggest building out using asyncore - it's nifty and old, but it gets the job done. Down the road, I'd also suggest checking out Tornado and Twisted.

camlorn 05-04-2013 12:30 PM

Re: Learning Programing
 
Beware, for Python is slow. You probably want to stick to Pypy, not cpython. I've played one mud implemented in python, and, well, it showed (that, or the people behind it really, really need to consider some of their design philosophies, and how everything shouldn't take half a second to execute). Moral of the story is you want Pypy--it's what everyone outside the mudding community is using these days. At the moment, it's 2.7, but support for 3 is coming, and...well, 3 isn't going to really matter for another 5 years or so. It's an example of why, after a point, you shouldn't make breaking changes to the language.
If you're looking for newbie friendly languages, Python is fine. If you want to start stretching the bounds of what muds can do...well, no, at least not in my opinion. I'm not going to throw you at C++, but you might want to look around a bit for things that are faster. I doubt you're ready to go implement an event queue for example (which takes the place of the main game loop, with huge gains in efficiency).

Ide 05-04-2013 01:30 PM

Re: Learning Programing
 
Python with the standard interpreter is completely adequate for the first mud you'll build.

ArchPrime 05-04-2013 01:47 PM

Re: Learning Programing
 
Is it safe to assume that you were connected to the mud across the network, and not running it locally on your box? If so, are there, perchance, *other* reasons why you experienced slowness?

While Pypy is an interesting project, it still doesn't change js_wilson's learning of python as a language.

Orrin 05-04-2013 07:46 PM

Re: Learning Programing
 
Nakedmud would be a good compromise between starting from scratch and modifying an existing codebase. It has a lot of basic systems like rooms, NPCs, objects, inventory etc. but no actual game content. The core is C but you can code your entire game in Python. Don't let Camlorn put you off; "Python is slow" is so vague as to be meaningless.

camlorn 05-04-2013 09:18 PM

Re: Learning Programing
 
let me be more specific. Cpython is slow. Pypy is still slow, but less so. If you want to use it to learn programming, OK, but do be aware of it. You can make up for the slowness if needed by writing more clever code, but you might run up against bottlenecks in the main game loop. Cpython is a purely interpreted environment with dynamic typing, which probably means nothing to you at this point. There's a large quantity of overhead both in terms of memory and CPU.
I'm assuming that this will be the only mud. I don't think that "good enough for the first mud" is a good philosophy. Let's make a mud and then just let it die so we can make a better one?
I was accessing the mud over a network. It had a lot of artificially imposed limits that scream we have performance problems let's add a delay instead of fixing it to me, and everything was sluggish. I accessed it from a completely sufficient network connection, and it was reasonably active--the issue was certainly not my network, as I played for a while and wasn't having any other problems on other muds or on the internet at all.
My point here is twofold. First and foremost, Python will let you write programs, but in a realtime-sensitive environment it will not be as forgiving of suboptimal algorithms and design philosophies--given that you're learning programming, you're not going to know the fastest and most efficient way to do things, and that's OK, but Python might become the limiter. Secondly, if you want to have, for example, room descriptions that call into Python code all the time, i.e. to change depending on time of day, or to change based on the direction you're coming from, or if you want to do a lot of pathfinding all over the place, or any number of other things that demand a lot of resources, you'll run into Python's limits again. Pypy will alleviate this, but I truly don't think it will do so completely. You write an area that has room descs that ask python for the time of day all over the place and change "to the left" to "to the right" if the player comes from the other way, a player leaves brief off and speedwalks through 30 rooms written that way, your custom description parser thing kicks in for each of those interpreting your special codes for that and making the python calls, and the mud is going to hiccup, I can almost guarantee it.
The good news in all this is this: learning one programming language, at least if said programming language is object oriented, is going to teach you most of the other ones in existence. It's not like english--each new language will bring one or two new concepts, and some new syntax, and that's about it. For the most part, anyway. I just don't think that a mud, someone who is trying to learn programming, and python will mix well. I don't think that a mud and python will mix well anyway, at least not for a hack and slash mud, and would require a lot of convincing to change my mind.

Ide 05-04-2013 09:29 PM

Re: Learning Programing
 
We're not talking about a philosophy, we're talking about using a mud project in Python to learn programming, which is a sensible and achievable goal.

camlorn, you've picked up the habit of talking a lot about things that don't bear on the topic at hand. It's not a good habit.

camlorn 05-05-2013 01:00 AM

Re: Learning Programing
 
Respectfully, I disagree entirely. There's no point in making a mud unless the intent is that someone, somewhere, plays it. If the OP is able to be motivated by writing a mud that will be used as a learning project and then abandoned, then great, my point is invalid, and the OP is a much better person than me in at least one way. I don't know about you, but that seems like a lot of effort for no gain except learning something. I'm sure it could be arranged such that there is a valid reason to end the mud after a point, but I have yet to see anyone saying that that is the actual intent.
I simply warned that, depending on goals, the technology may not be up to this project. it is up to the OP to decide if this is the case, but the point is worth making. If someone says write a mud, I don't think 10 week project. I think 10 weeks until alpha, minimum, followed by at least a year until complete stability, and a number of years beyond that providing updates and new content for a hopefully large playerbase. And yes, i expect people to disagree with this.

js_wilson 05-05-2013 10:49 AM

Re: Learning Programing
 
As I was reading about different programing languages, and deciding which one to start with, performance issues where something I did take into consideration. I ultimately decided to go with python more for ease of learning, and less time spent writing the code, rather than performance. Also, I understand that java, another interpreted language, runs even slower than python, and yet I haven't noticed any performance issues with the java based mud I have been a builder and player on up until now. Granted, this isn't being hosted on some shared plan with 30m ram, but a fairly inexpensive VPS with something like half a gig burst, and the java mud runs just fine, so I felt I could safely use python. Also, for the advanced features you were talking about, even if my codebase is made with python, I still have the abillity to call those functions in C in order to optimize performance. So all things considered, that was why I went with python.

ArchPrime 05-05-2013 11:18 AM

Re: Learning Programing
 
js_wilson, you've made a great choice, don't second guess yourself (hopefully you're not). Camlorn is just spreading offtopic, unfounded FUD with no basis in reality. If you need further evidence that your choice is valid, take a look at Eve Online -- a massive online game supporting hundreds of thousands of users on a *single* instance.

Designing and developing a MUD is no small feat. You will definitely learn a LOT. If you haven't done so already, I really suggest downloading Miniboa and getting the example, bare bones server up and running.

Ide 05-05-2013 11:43 AM

Re: Learning Programing
 
Good, because not only do people disagree with that, .

camlorn 05-05-2013 11:44 AM

Re: Learning Programing
 
Eve online is using a specific modified version of python optimized for their use case, and the whole game isn't written in it. Also, they're using multiple servers:
And according to that article, apparently having problems. An Instance, in the MMO world, is a nebulous term; my instance can be across 1 server or 100 servers, and if I have enough money to throw at it, I could write it in any programming language by buying more computing power.
Java is now faster than python and can approach the speed of c/c++, provided that you don't do specific things. Pypy can do likewise in benchmarks, but benchmarks are the only place I've seen that personally for Pypy. Python will take at least twice as much ram as Java.
I only stated that Python may not be up to the task and that if one is using Python for such a project one probably wants to use Pypy. If you feel comfortable with Python and it meets your goals, great, just consider what you're going to do first. You can call into C, and that is one way of avoiding the problems, sometimes.
Also, Python uses a ton of memory, and since I apparently need to cite sources before people will believe that I might even have a point at all, this article, though sightly old, lays out the Python memory model and why it's so bad:

To implement Diku in python is fine. To implement certain dynamic features in python will give you trouble: aforementioned dynamic descriptions, possibly room-specific commands (this one depends on how you do it), your own custom mobprog system. I would say that half a Gig of ram is possibly too little for Python-based muds. If the productivity is worth it to you, then great and it's your choice, but someone does need to at least point out that python might be a problem depending on what you want to build and how many players you have.

js_wilson 05-05-2013 12:29 PM

Re: Learning Programing
 
Thanks for pointing out miniboa to me ArchPrime. Now I at least have something to look at to see how sockets work in python.

ArchPrime 05-05-2013 12:33 PM

Re: Learning Programing
 
Camlorn,

Those links are pretty old. The EVE link is from 2008 -- and EVE is still around, and is single instance/shard/game world/whatever you want to technically call it. You know what I mean by that so stop trying to muddy it up. It doesn't matter what language CCP chose to implement EVE, they would still need to run their game over a multitude of servers in order to meet their goals.

Your link to the memory article hardly states "python is a memory hog". While it does provide some nifty bits of information, there is hardly anything in there that should dissuade the use of python for js_wilson's purposes.

I get that you're attempting to point out that "python may be a problem/slow/memory hog", but that's really not giving js_wilson much insight on what to do next. Quite frankly, I'll be very happy when js_wilson comes back here and writes something about how his dynamic descriptions are too slow and he needs help fixing that -- because that will mean he's gotten quite far on his project and has enough users on his game to actually start hitting performance boundaries.

Orrin 05-05-2013 04:25 PM

Re: Learning Programing
 
How can you "almost guarantee" it? I can guarantee it's nonsense because I've actually written a MUD with all those features using Python and it performed just fine, but what makes you so certain of your position?


All times are GMT -4. The time now is 02:58 AM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022