Top Mud Sites Forum Return to TopMudSites.com
Go Back   Top Mud Sites Forum > Mud Development and Administration > MUD Coding
Click here to Register

Reply
 
Thread Tools
Old 08-14-2014, 04:51 PM   #1
koteko
New Member
 
Join Date: Mar 2012
Posts: 20
koteko is on a distinguished road
Roomless world

And here, poor fool, I stand once more - no wiser than I was before. Or maybe a bit more?

So, after two years I'm still developing my MUD in the very limited free time I got (was nice being a university student..), for fun and learning mostly

Now I have a nice, spatially consistent set of worlds (four coordinates, essentially). Doors and walls can be added by players, and they disappear as "objects" and essentially become flags into the Room structure.

The more I think about it, though, the more I want to experiment with a roomless world - especially after re-reading KaVir replies to my previous posts. My usual problem is that I get stuck in abstract design and elucubrations - so I thought I stop by again and see what you people think about it, as last time it was very productive for me.

Anyway, let's go on with the rambling. Excluding for now thoughts about terrains, if the world is a grid of 2D-points my first problem is defining a unit and relative sizes.

Suppose a player occupy a single point of the grid, but that's not totally exclusive to him.

We are technically creating a very small kind of Room, say 1 squared meter, that is still somewhat a link with the old system. The difference would be that the "say" command, for example, act on surrounding "rooms" too (about 5 squared meters around the player, maybe?). I could define a limit of a couple of players in the same "PointRoom" and quite a few objects, and modify the "look" command to list objects and players/mobs from surrounding rooms too. The farther the "point", the lesser the details (for example, at 4 or 5 points of distance I'd only see players and mobs, not objects on the ground.

This is one way I can think about this, and sounds decent to me. Wouldn't be too difficult a modification, would make communication much better than normal Rooms (players could use whispers to be heard on the same PointRoom, "low voice" to be heard on the surrounding 8 PointRooms too, and so on. No more huge scrolling when 6 or 7 players play together at a feast).

It would mean iterating over quite a few "rooms" though every time somebody does a "look" or a "say". And most importantly, what about bigger creatures? I'd need to make them fit alone in the PointRoom at most, but a dragon should technically occupy a much bigger area. To have a dragon occupy 5x5 PointRooms would make group combats very cool in my opinion (warriors could go all around, two in each adiacent PointRoom, and blocking him from escaping until he frees a direction).

However, how to do that? Either I use an abstraction, a SquaredRoom class say, that represents a square of PointRooms (maybe it just contains them in an array, so that objects don't have to be moved around too much when the dragon moves, but simply the PointRooms are "released" from the SquaredRoom).
Or, I could put the same "Dragon" object in all 25 PointRooms it occupies, filling their space so that no players can enter them apart that at the "borders". Than I'd have to do more calculations only for the dragon itself if he's a player (every time he does a "look", he sees all objects of all 25 PointRooms he's onto, plus the surrounding ones. Also, when he moves in a direction I have to move it as a "block").

This seems doable to me, but I'm not totally happy about it. Another option would be to go the "3D way". Storing objects and living beings in a real grid, with their (simplified) shape, say rectangular or squared. Keeping it simple, I could define a "base bounding box" for each Entity that determines how much space it occupies on the grid.

Here the "Point" would be small, say 1 millimeter of accuracy. Different objects would occupy different areas, could be put one over the other etc. To do this, I'd essentially need a GIS, ie R-Tree enabled database to do range queries on the grid world and placed entities, so as to quickly find when a player hits a wall and cannot move in a direction for example, or even just all the surrounding Entities of of a player when he does "look".

This second way seems to me more "brave" but dangerously close to a 3D engine - that makes me guess if at that point I wouldn't be better off start tinkering with a MMO and be done with it. Ah, if only I had the money to pay a couple of Artists..

Apart from jokes, any thoughts?
koteko is offline   Reply With Quote
Old 08-15-2014, 07:50 PM   #2
koteko
New Member
 
Join Date: Mar 2012
Posts: 20
koteko is on a distinguished road
Re: Roomless world

I'm currently giving a better thought to the "second option", that is a proper coordinate system where objects have shapes, without using temporary rooms to store lists of entities.

For a MUD, I wouldn't really need the Z coordinate, or objects one over another. Every object/player/mob would have two points associated, top-left and bottom-right, determining their bounding box on ground (the "base"). Two entities could "sit" in the same area for simplicity.

By storing all entities and the map itself in a R-Tree or similar structure (in a DB in my case), I should easily be able to do range queries such as: "Given this bounding box (an area around the player), find all objects/players/mobs whose bounding box overlaps it".

At that point, getting back in a reasonably fast time a result set of entities, I should be able to process them appropriately.

I'm curious if this is the system KaVir uses for Godwars 2
koteko is offline   Reply With Quote
Old 08-18-2014, 05:19 AM   #3
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
Re: Roomless world

My approach is even simpler. Creatures, Objects, Dungeons, Portals, etc, are all types of Thing. Each Thing can contain other Things, and each Thing also stores its own X/Y position (which is a relative position). The original design included the use of abstract containers for grouping Things together based on proximity, but I never bothered implementing it - I tend to avoid premature optimisation, and while searching the entire container isn't exactly efficient, it's still an insignificant fraction of the processing effort.

One other difference is that your Things are rectangles, while mine are circles - you store two points, while I store one point and a radius. I do use rectangles for areas though (e.g., the "black forest" might be defined as all forest terrain between 50/50 and 500/500).
KaVir is offline   Reply With Quote
Old 08-18-2014, 11:01 AM   #4
koteko
New Member
 
Join Date: Mar 2012
Posts: 20
koteko is on a distinguished road
Re: Roomless world

So an area is a container? Seems a bit big to iterate over at any look of a player. What about the wilderness? Can you expand a bit? Thanks
koteko is offline   Reply With Quote
Old 08-19-2014, 07:07 AM   #5
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
Re: Roomless world

No, areas aren't containers, Things are containers. An area just stores data about a section of the world (mostly cosmetic, although it does also define monster spawns). The mud looks up the area data as you move around, and uses it to flesh-out the descriptions, generate messages, and populate the area with appropriate monsters.

If it wasn't defined as an area, "the Black Forest" would just be called "a forest", it would have only a generic description, and no monsters would spawn in it.
KaVir is offline   Reply With Quote
Old 08-23-2014, 07:35 PM   #6
Lanthum
Member
 
Lanthum's Avatar
 
Join Date: Oct 2002
Location: Suburbs of Chicago
Posts: 138
Lanthum is on a distinguished road
Send a message via MSN to Lanthum
Re: Roomless world

(I'm not trying to hijack the thread - but it seems these questions pertain to the OP's questions and thoughts)

KaVir,

Do you use the "z" axis (or height) in your game? If so, how much/far do you use it? Do you allow Things to block the view of other Things? And if you do, how do you determine if 'B' is blocked from 'A's sight by 'Y'? Which point do you use in your calc as the eyes of the Thing? What else do you use the "z" axis for? Flight or hovering? Do different race types have different height, reach, and step lengths?

One difficulty I've had conceptualizing while using height in a coordinate-based system is how can you have inclinded roads/paths? How do you determine if a player can travel north, if the next point is supposed to be 1 "level" higher in elevation that the one before it?

Also, do you allow multple Things to occupy the same point in space? If so, do you limit it in any way?

These are a bunch of ideas my brain keeps coming back to when I think of coordinate based systems.


Thanks
Lanthum is offline   Reply With Quote
Old 08-25-2014, 04:20 AM   #7
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
Re: Roomless world

I don't use a Z coordinate (although I originally planned to have one, and even partially implemented it). There are two types of flight, one is close to the ground (although it's still fast, and ignores terrain penalties for movement) and the other describes you flying up into the sky (effectively teleporting to another X/Y position) and then swooping back down at your destination. Underground locations are simply Things described as "caves" or "stairs leading down" which you can enter.

Things don't block line of sight, although terrain can. Terrain also has elevation, which determines whether you can see it from your current location (described in more detail here).

And yes, multiple Things can occupy the same point in space. Otherwise you get into all sorts of issues with people blocking each other's movement, and I didn't feel it was necessary to go to that much detail to achieve my design goals. I'm not trying to create a 3D graphical game, after all, I just wanted to avoid artificial room boundries for the purposes of combat, movement and communication.
KaVir is offline   Reply With Quote
Old 08-25-2014, 11:12 AM   #8
koteko
New Member
 
Join Date: Mar 2012
Posts: 20
koteko is on a distinguished road
Re: Roomless world

It's a surprisingly effective design, yet simple. I like it more and more I have to say. Thanks for your patience in explaining it KaVir.

I'm still curious on how you search for neighbouring Things on the map as opposed to containers. What is your "scale", that is how many cells of the map do you have to iterate over when a player does a "Look" or when an NPC AI kicks off?

Did you find a naive implementation (eg, keep the map in a global array and when a player does a "look", just iterate in the surrounding cells) to be good enough, or did you use something a bit more sofisticated?
koteko is offline   Reply With Quote
Old 08-27-2014, 06:35 AM   #9
KaVir
Legend
 
KaVir's Avatar
 
Join Date: Apr 2002
Name: Richard
Home MUD: God Wars II
Posts: 2,052
KaVir will become famous soon enoughKaVir will become famous soon enough
Re: Roomless world

Quote:
Originally Posted by koteko View Post
I'm still curious on how you search for neighbouring Things on the map as opposed to containers. What is your "scale", that is how many cells of the map do you have to iterate over when a player does a "Look" or when an NPC AI kicks off?
Every Thing is a container, and I search everything in the same container - so everything in the same World, or Dungeon, or Place, etc, as you (e.g., if you're inside another PC, it would search everything else inside them). Because monsters spawn on the fly and are silently destroyed when nobody is nearby, the number of Things in any particular location is kept pretty small. As I mentioned earlier, the original design included abstract containers for grouping Things together based on proximity, but I never needed to implement it, as the processing effort is already insignificant compared to other parts of the MUD. I don't optimise until I've identified an actual problem.
KaVir is offline   Reply With Quote
Reply


Thread Tools


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT -4. The time now is 11:56 AM.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Style based on a design by Essilor
Copyright Top Mud Sites.com 2014