Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUDs ➜ General ➜ born-again techie looking to MUD

born-again techie looking to MUD

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Pip   (2 posts)  Bio
Date Fri 19 Sep 2008 09:21 PM (UTC)
Message
Yeah, another “I wanna build a MUD” thread, or not.

I'm not looking for an easy hookup to crank out a MUD by next week. I plan to start by actually learning programming. Well, relearning, as I used to do a little programming in C about 10 years ago. I've done virtually nothing with computers since, but I'm sure it's like riding a bike...you never forget how to fall off, right? :P

I have a variety of motives for wanting to develop a MUD, but with a 6000 character limit for posts, I can't list them all here.

There are a few things that I want to be able to do that I haven't seen in any other MUDs. I'm not sure if these things aren't possible, designers just haven't done them, or I just haven't seen it. I'm trying to conceptualize these elements not as a “it would r0x0rs to have laser beams coming out of my eyes”, but whether it is possible to get a computer to do these things considering the limitations of a programming language and the MUD as a construct. Obviously, I'm not looking for an explanation of how to do these things right now. I merely want to know if (down the line) they're reasonably possible and/or if how I'm thinking about these things is how I should be thinking about them.

Space within space

One thing I want to do is kind of a “rooms within rooms” effect. It will be a cyberpunk setting in a not-so-distant future city surrounded by a wasteland. So, if we split the region into “sectors”, each one of those sectors is a chunk of wasteland. One of these sectors would be the city itself. The city is further divided into (city) blocks. On these city blocks are structures (buildings), which will contain multiple rooms. So, there's kind of a fractal spatial effect (at least within the city). If you're in a room in a building, you're also on a city block, in a sector on the map. But one can be on a block without being in a “room”, or in a sector without being within a city.

I'm sure this is a cumbersome endeavor, but there are certain system elements that will rely on this distinction (movement/travel, communication, etc.). For example, PCs will have a communication device that will let them communicate while working a job, but the range will be limited.

Time after time

That probably won't make sense, but you gotta love a Cindi Lauper reference. Anyway, I have an idea as to how I want to handle the passage of time, but it may not be doable.

First, there's overland travel. Within interior structures, I don't mind PCs being able to zip from room to room. It's a matter of seconds and not important. For exterior travel, it's a different situation. Essentially, I want there to be a “lag”, so to speak, when traveling between city blocks or wasteland sectors. Nothing too long, but enough where it can matter on certain jobs where time is an issue. Where I see the potential complication is in where the PC “exists” during a transitional moment, and most importantly what s/he can do during a transition (and how that might affect the transition). So, a PC could take out an item or drop something without interrupting the transition, but if s/he decides to get into a fight, that would/should cancel the move.

And this brings us to fighting. I've thought about how I'd want to handle combat. When a fight starts, all combatants will be entered into a queue based on their initiative. Actions they take will have a simulated time value which will determine when they can act again. In short, time mechanics will be a little Final Fantasy-ish. In a sense, PCs in combat will be in two “places” at once...the actual (virtual) geographic location and within this constructed combat space. But this brings me to my next topic.

Being in two places at once

It isn't just with combat that PCs will have to be in two places at once. The VR/hacking element will function similarly. A PC hacker will be in such-and-such room in such-and-such building (in a virtual physical sense), but will also be on the net (in a virtual sensory sense). Even though a PC will be in a room with exits to other rooms, a PC on the net is essentially rooted to that spot. Not only that, but s/he will be too engrossed in the virtual environment to be able to interact in his/her physical environment. So, when I think about a MUD, I see objects and I see spaces. One object, one space, no problem. With these situations it's like there is one object in multiple spaces with varying capacities. It sounds like the kind of thing that would give a computer an aneurysm. I might have had one just thinking about it. :)

The room is moving

I'm still trying to conceptualize how I would handle vehicles (esp. with multiple passengers). The only thing I can think of is to treat them like “rooms” that can move. Keep in mind that vehicles would also be affected by transitions like PCs traveling on foot. However, maneuvering a car is going to be different than “maneuvering” one's body.

The way I'm thinking about how I would go about these things could be totally off the mark. I just want to know at this point if what I'm conceptualizing is beyond what a MUD can do.

Anyway, I'm assuming that the first step is to relearn C, though maybe I should be learning C++ instead? Also, I read some guides on the web, and some of them suggest learning Java (which I really know nothing about) rather than C or C++. Other guides I've read suggest spending time as a builder on other MUDs to help you develop your chops. I know I'm nowhere near that point, but if I can figure out how to get that far, that probably means I'm doing something right, no?

So, can anyone point me in the right direction? Thanks.
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Fri 19 Sep 2008 10:00 PM (UTC)
Message
Not a lot of time now, so I'll be a little brief...

There are remarkably few things that a MUD cannot do, and almost all of them have to do with what kind of information you can display to players, and how they manipulate that information. Pretty much everything you described is quite feasible, actually. You might have to think outside the room, err, box, though: if you try to force notions of "room" onto things that move, that contain other areas, etc., you might end up confusing yourself. Think of it as it is: a sector contains sub-sectors that contain cities that contain rooms etc.

Quote:
Other guides I've read suggest spending time as a builder on other MUDs to help you develop your chops.

This is good advice insofar as having no experience administering a MUD makes it very difficult to know what a MUD should do. :-) But it's important to realize it's a learning experience, and not get bogged down in one MUD's way of looking at things, especially if you're trying to break new ground.

Once you get familiar with how a MUD works on the "outside", you can look inside and see how that codebase works. That will let you map code to effect. Again, though, it's important to not take the code you see as gospel: if you get stuck in one mindset it'll be that much more difficult to do new things.

Quote:
Anyway, I'm assuming that the first step is to relearn C, though maybe I should be learning C++ instead? Also, I read some guides on the web, and some of them suggest learning Java (which I really know nothing about) rather than C or C++.

I'd recommend C++ over C for various reasons (e.g. the container frameworks). I'd also recommend Java over C++ for newbies since you won't have to deal (as much) with memory management. You will have a harder time finding a host for Java code since most people aren't equipped to support it.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Pip   (2 posts)  Bio
Date Reply #2 on Sat 20 Sep 2008 03:49 AM (UTC)
Message
Quote:
I'd also recommend Java over C++ for newbies since you won't have to deal (as much) with memory management. You will have a harder time finding a host for Java code since most people aren't equipped to support it.


I'm not sure I know what you mean by memory management. It never came up with the bit of C coding that I did (most of the programs were relatively small and simple).

Also, isn't Java a standard plug in with most browsers? I could be thinking of this wrong, but I assumed that Java MUDs are the ones you can play in your browser off the game's website. Am I way off?
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #3 on Sat 20 Sep 2008 04:34 AM (UTC)
Message
In C/C++ you need to allocate memory and then deallocate it yourself. If you've seen 'malloc' and 'free', then you've seen memory management. But, depending on how much you did, it's possible you never played around with pointers and so wouldn't have seen this.

Java being a plugin is not very helpful for this. The server needs to run separately from the client, and the web browser is for the client. You could write a MUD client in Java, but that says nothing about what language the MUD itself is written in.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Nick Gammon   Australia  (23,166 posts)  Bio   Forum Administrator
Date Reply #4 on Sat 20 Sep 2008 11:54 PM (UTC)
Message
Check out this part of the forum:

http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=116

There are some interesting posts there (including by me *cough*) about things to consider before starting writing a new codebase.

Quote:

I'm not sure I know what you mean by memory management.


In simple programs, you don't need to worry about it. However for something like a MUD, you have indefinite quanties of things (eg. 1 to 1000 players, 100 to 10,000 rooms, 500 to 50,000 mobs, 1000 to 100,000 objects). It would be inefficient and a waste of memory to simply allocate room for (say) 100,000 objects, when you might actually only have 10. Or for 100 players, if the most that connect is 20. Or if you allocate room (in an array) for 100 players, you are stuck when player 101 connects.

Thus, you normally dynamically allocate memory, from a pool maintained by the operating system. In C you might use "malloc" and "free", in C++ you might use "new" and "delete".

I would strongly recommend C++ over C these days, as this gives you access to - amongst other things - the Standard Template Library (STL) which is a library of containers and ways of managing them.

A whole section of this forum is devoted to describing the STL:

http://www.gammon.com.au/forum/bbshowpost.php?bbtopic_id=111

Using the STL would greatly simplify memory management, because you can declare things like vectors, lists or maps of things (eg. a thing might be a player). Maps are good if you want keyed access - for example a map might give you a room, keyed to a room number or room name.

The whole thing is non-trivial because you have the issue of when to de-allocate something. For example, if you create a new player item when a player connects, when is it destroyed? If you destroy it the moment the player disconnects, then that could break other code, because the player might be in the middle of a battle, and now they are battling a non-existent thing. However if you don't destroy it then, when do you destroy it? These are issues to ponder.

As for your ideas, they all sound good. Virtually anything can be achieved if you are prepared to put enough time into it. One problem you probably have to solve, is how to represent things to the player. For example, if you want to backstab a player, how do you (the player) know you are behind something, when you are just looking at a textual description of the room? If you want ranged combat, how do you know if you are in range or not?

It would probably help to download SmaugFUSS source and browse through it, to see how they solved the general problems of memory management, and other stuff. However Smaug is basically C, not C++, so things could be done in a more modern way if you were starting from scratch.




- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


17,790 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.