# Design Question.

• 09-27-2010, 04:21 AM
Design Question.
Ah! My first query! :)

Alright guys and gals. Let's get into the thick of it right away. But first, a little explanation. (It'll be short I promise).

I'm doing a game.
It has space ships.
At the moment it's not defined if the universe will be finite or not but I tend toward infinite.
There will be a story.
Might even have multi-player but that's undefined yet.
I will use jMonkey.

Now. I'm juggling with different possibilities to define how the finite/infinite universe will be handled.

Possibility #1:
ArrayLists of multidimensional arrays. These could be 20x20x20.

The player could exist in a smaller array that would be updated with a positioning system via a position-getting scheme from the "existing universe".

Supposing the player exist in a 3x3x3 array: As the player moves toward the edge of the universe, the game formats 3 (size of player's array) new blocks contiguous to his relative position and facing. If the player is moving really fast, the system could extrapolate more "blocks".

I'm thinking of using an array for the player because the world around him would have to be drawn and it's inside those boundaries that it would be. I certainly don't think it would be a good idea to draw the whole "universe". Thus why I think a 3x3x3 array would be a good idea.

Since space is a pretty empty place (relatively-speaking), even though if those arrays are big, they wouldn't hold much data.

Possibility #2:
Very similar to #1, but with a twist.

I'm also thinking to use "sub-arrays" in the above 20x20x20. Each would define the area's local space. Those could ALSO be segregated into arrays to local systems. Finally, the ship would be in a very small array that would be used as the origin to update the world.

In short you would have something similar to this:
http://www.minecrafthelp.info/SC/design.png

I'm very partial to #2.

Also, at this point I'm wondering if the "local area" should move with the player or if I should use the player's own array to update things.

The way I'm seeing it is that what will be drawn on the screen won't be static. Things that are getting out of range will be culled (and unloaded), so I'm wondering if I should add another array (that will be dynamically updated) with its center on the player or project what is visible from the player's position directly on the screen.

For now that's what I'm considering. I am uncertain how Java's memory manipulation could help or hinder. So, that's why I'm asking. What would be, in your opinion, the best way? Or you might have some insight/suggestion, so don't hesitate to throw these my way.

And, if it's not constructive criticism... well... :)

Thanks all!