This site requires JavaScript, please enable it in your browser!
Greenfoot back

Comments for Adventure

Return to Adventure

A new version of this scenario was uploaded on Thu Jun 28 20:04:08 UTC 2012 Changed world size to fit nicely on the Gallery.
A new version of this scenario was uploaded on Fri Jun 29 00:23:21 UTC 2012 Bugfixes and sprint added
A new version of this scenario was uploaded on Fri Jun 29 02:05:08 UTC 2012 Inventory available but not useable, world is now unbound left and right.
CockyCocky

2012/8/13

ich blicks net
SpilliSpilli

2012/8/13

If you're still interested in this project I can teach you a few techniques on how to manage vast voxel worlds and still get a high FPS.
CockyCocky

2012/8/20

ich bin interessiert Spilli
DonaldDuckDonaldDuck

2012/8/20

I would imagine storing the entire world as an integer array and only adding the on-screen objects from the array would certainly do it. This was a rather rushed project however, but if you have a different solution, I am certainly interested to hear it, Spilli :) Cocky is interested too if you care to translate your solution to German (lol)
SpilliSpilli

2012/8/20

Well for a start I would not store the whole world in memory. On start up make it build the world and save it in region based files. I'd then make it load only the region's within X distance. If an active region is no longer within view distance, it's destroyed and removed from active memory. If you don't understand me, just say and I'll make a quick prototype.
DonaldDuckDonaldDuck

2012/8/20

I understand but how does one remove a file from active memory?
SpilliSpilli

2012/8/20

You don't remove a file from memory, the world files are saved to disk. You read the files and initialize the region into memory.
DonaldDuckDonaldDuck

2012/8/21

Ah. See I tried storing the entire world in one gigantic randomly-generated text file but this caused problems for java to read the entire document. I've been kinda off Greenfoot for awhile though, I might hop back on just to try your suggestion out. Too bad Greenfoot doesn't allow security permissions to read/write to text documents; that will make my job a tiny bit harder... Thanks for your input Spilli :)
SpilliSpilli

2012/8/21

Don't use a text document, and don't bulk it up. I'd make is so each region (chunk of the world) use it's own file. This mean's you only have to load what you require. Plus I wouldn't use a text document, I'd recommend saving in a raw format which will save tons of space. To identify regions you could give them identification numbers which would vary upon their location within the 2D space for example: int regionId = (y / Region.SIZE) + ((x / Region.SIZE) << 8); I'd also recommend keeping the region size to the power of two. Best of luck. :)