Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
auth_update crash
Dec 23, 2017, 10:15 pm
By Remcon
check_tumble
Dec 18, 2017, 7:21 pm
By Remcon
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, Google, Yandex

Members: 0
Guests: 2
Stats
Files
Topics
Posts
Members
Newest Member
478
3,708
19,242
612
Jacki72H
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » General » General Discussions » Space/Universe design.
Forum Rules | Mark all | Recent Posts

Space/Universe design.
< Newer Topic :: Older Topic > The name says it all... :)

Pages:<< prev 1 next >>
Post is unread #1 Jul 28, 2008, 10:27 pm
Go to the top of the page
Go to the bottom of the page

Nephlen
Fledgling
GroupMembers
Posts5
JoinedJul 28, 2008

I've begun a new project using Tyche's RocketMud (Ruby SocketMud) and I'm trying to come up with a good design for a moderately complex "universe". I'm hoping for something a bit more accurate and user friendly than the typical SWR since space travel and combat is going to be a MAJOR part of the game second only to the simulated economy. I'm not looking for someone to tell me how to program It but I just can't get my head around how to start on this part of the project. Ideas anyone?
       
Post is unread #2 Jul 29, 2008, 9:21 am
Go to the top of the page
Go to the bottom of the page

tphegley
Magician
GroupMembers
Posts176
JoinedMay 21, 2006

Get a notebook, right out some ideas that you want, what type of systems/races/planets etc. Draw a concept map. Design everything by hand and then see what you like and refine it.
       
Post is unread #3 Jul 29, 2008, 9:30 am
Go to the top of the page
Go to the bottom of the page

Nephlen
Fledgling
GroupMembers
Posts5
JoinedJul 28, 2008

Ah I've come up with quite a bit of that information already. I'm more concerned about how to tackle this from a programming aspect. Right now the world itself is blowing up into a huge 3d array of ruby objects that will probably end up needing 50 gigs of memory to run! =)
       
Post is unread #4 Jul 29, 2008, 10:00 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

It is all but impossible to discuss the programming aspect without knowing exactly what the system is supposed to do or look like. :wink:

For starters it sounds like you have a data representation problem. You probably don't want to explicitly represent the entire space, for the reason you mentioned. Instead of having rooms in which there are people, you should consider having people that are associated with positions. Then, your storage requirement becomes that of the people you have, instead of all these empty rooms, the vast majority of which will be empty the vast majority of time.

Of course, some things become more complicated when the "primary key" is the person rather than the room; for example searching for people nearby means looking at all people and not the nearby locations. To address this, you can have things like divide-and-conquer indexing over coordinates of the world, where you represent space (as in physical space, not stellar space) as a chunk that is cut into successively smaller "interesting" pieces. If the left half of the world is empty and the right half has stuff in it, then your top-level division is to cut the world in half and have an empty pointer for the entire left half of the world.

Many first-person shooters implement techniques like this to partition space and quickly determine what is visible in order to cut down on rendering requirements. You might want to look into data structures like quadtrees or their extensions to 3d space (binary space partitioning or octrees) -- note that the BSP for example is famous for being a solution used in id Software's early games, and used to great advantage in many of their FPSs.

These are all very high-level concerns. Again, it is extremely difficult to discuss precise issues without knowing what the requirements are.
       
Post is unread #5 Jul 29, 2008, 10:12 am
Go to the top of the page
Go to the bottom of the page

Nephlen
Fledgling
GroupMembers
Posts5
JoinedJul 28, 2008

Thank you DavidHaley for the well informed post! I will try to explain the end result that I'm looking for. I've decided to represent "space" as a two dimensional area to simplify combat and travel. My hope is that the player will be presented with a simple map of their current area in space (similar to a wilderness map) and be able to see whatever might be nearby. Movement itself will be handled by inputting the coordinates for the desired location or by simply moving in the desired direction. The amount of data contained in the universe and galaxies themselves will be minimal. The real idea behind the game is a space-themed economy simulation but I needed to add a "fun" aspect to it as well, which is why I decided to require combat and trade to actually be performed by the players. I'm not sure what else I should mention but I can provide answers to any questions as I have most of the system worked out already. I'm currently looking into quadtrees to see how I could implement them into the game.
       
Post is unread #6 Jul 29, 2008, 10:49 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

Given what you said, it does sound like you will need to be very careful with spatial representation; obviously any solution that requires more than a gigabyte of memory isn't really going to work. So yes, I would look into quadtrees and see how you can use them. Working in 2d rather than 3d makes your task simpler, which is always nice. :smile: But since you want to quickly look up things that are next to you, you need some kind of index into space: looping over all other ships is not a very realistic solution.
       
Post is unread #7 Jul 29, 2008, 11:30 am
Go to the top of the page
Go to the bottom of the page

Nephlen
Fledgling
GroupMembers
Posts5
JoinedJul 28, 2008

I've done a lot of work with 2d graphical tile engines and I guess I could look at this in a similar way. While the world itself can be as large as I want I only have to "draw" the "tiles" and objects that are within the range of the character. I've never tried to do that with a text based system but I would imagine it can't be any more difficult. That would certainly help keep a large portion of the universe out of my much needed memory. But that would make it difficult for the universe itself to be persistent wouldn't it? How could I have AI flying ships and handling their own trade all around the universe without having everything in memory?
       
Post is unread #8 Jul 29, 2008, 11:44 am
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

That's a good question. The answer depends on just how many AI ships you have floating around. If there aren't that many, then you can treat them the same as players. But if most of the space is actually occupied, be it by players or by AI, you can't really do what we were talking about because it means representing most everything, bringing us back to square one.

What you can think about then is whether or not you actually need the AI ships to be "physical" objects in your game. Their behavior will be fairly predictable, so instead of representing the actual ships, represent their effects. That is, do not represent a cargo ship taking off of planet X and going to planet Y, with Z units of cargo, flying through space until eventually unloading, etc. Instead, just note at time t_0 that planet X loses Z units of cargo, and that at time t_0 + transit_time, planet Y should gain Z units of cargo. You can account for things like piracy by encoding a probability p of the cargo failing to arrive and instead being transferred to some pirate base.

Basically, instead of representing the entire universe as physical objects that actually run around and do actual things, represent the desired effects. There is an extremely important rule to remember in simulation: if the player can't see it, it's not worth having. All the players care about is that commerce happens. They don't care that a ship (that they can't see) is actually moving. Just tell them that it is. :smile:

Now, the tricky part is what to do when a player enters a zone where they will see AI ships. Then, and only then, should you instantiate these AI entities. This is also fairly easy to do: if you know that X cargo ships take route Y per day, then you can estimate the probability of encountering one at any point in time. (A Poisson distribution is probably what you want, but a uniform distribution would be an ok approximation.) Then, when a player enters the zone, randomly generate the zone's population based on your set of probabilities.

To summarize, it is extremely important to remember that you don't need to represent actual things that people will never see. Represent only the effects that matter, not their mechanisms, which (from the player's perspective) are of no importance at all.
       
Post is unread #9 Jul 29, 2008, 1:25 pm
Go to the top of the page
Go to the bottom of the page

Nephlen
Fledgling
GroupMembers
Posts5
JoinedJul 28, 2008

Ahhh I hadn't thought of that! That is exactly what I will do. I might end up having to do most of this in C and extending it with ruby otherwise it's really going to bog down. Thanks!
       
Post is unread #10 Jul 29, 2008, 1:47 pm
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

I would start with Ruby (because it's probably a lot easier to work with) and then see how slow it ends up being. It might be just fine. If you do have performance problems, you can always identify them and move those portions of the code to C. Premature optimization and all that. :wink:
       
Pages:<< prev 1 next >>