Well, I think it is time for me to put up a tutorial, and seeing that there are none on 'almost' infinite worlds, I have decided that I would make one.

IMPORTANT: READ THIS SECOND (after the introduction):

- This code may not be perfect, as I am not typing this into Eclipse and compiling it. If anyone points out an error, I will fix it as soon as possible.- Also, this code may not be the best practice. It works, but it may not work well.- There will be some parts missing, as I have not completely worked out how to do some of these things, but if anyone could give me help, I would be very thankful.

Now, for the tutorial

Firstly, you will need a Utility class:

Vector2Long (or course, you may use another implementation as long as it has all the required functions!)

(if you happen to not want the biggest world possible, just change everything into an Integer)

Since it's a WIP, then I can't judge what the rest of the tutorial might be. Using longs for coordinates is a little disappointing. It might be interesting to have BigInteger, Strings, byte arrays, or something else could be interesting. Though, realistically, you probably won't visit 16 * 2 ^ 63 tiles in one sitting. Linked list style structures are interesting, too. You could use a graph instead of a square grid then. Square grids might not need them (unless you had teleportation or something, then it would help a lot), but it would make it easier to "forget" chunks to save memory since it would automatically handle reachability tests and garbage collect the chunks.

The Article & tutorials board is not a place for WIPs. As mentioned in the board listing, this sub-forum is moderated more intensely than others. That you have other things to do is, fine, but until then this topic is moved to Misc.

Hi, appreciate more people! Σ ♥ = ¾Learn how to award medals... and work your way up the social rankings!

Yes this was the idea... but you would need to have a root-zone (in my case I name them "chunks" (like minecraft)), and what should you do if that one gets unloaded? Which zone will be the next? and how do you want to save it?

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org