WorldSaver
A library to make it easier for bots to save world data
|
Features:
Bugs:
To be added soon:
Notes:
- A saveable world format
- Can save and load from json files
- Can be initialised directly from the serialised world messages
- Can get / set areas of the world (and therefore load / save them)
Bugs:
- None atm, if you find one, please let me know
To be added soon:
- Other json (or other) formats, optimised for simplicity, and space efficiency
- Automatic zipping of exported and unzipping of imported world files
Notes:
- WorldSaver is currently in alpha, so many features are unfinished
- I have now tested most of the features, so should work as intended, but there may still be bugs
- This requires PlayerIOClient to be referenced

worldsaver_0_7_0.zip | |
File Size: | 10 kb |
File Type: | zip |
Add-ons:
ConnectedWorld:
This is an alpha library which extends the features of WorldSaver to allow you to more easily use the World format to store the blocks placed in the world
To use this (this may change):
1. Reference PlayerIOClient, WorldSaver, and ConnectedWorld
2. Put this code at the top of your class (you may not need static):
static World world;
static int botID;
3. Put this code into your OnMessage switch:
case "init":
botID = m.GetInt(5);
world = new CWorld(con, botID, m, m.GetInt(18), m.GetInt(19));
break;
case "reset":
world.Dispose();
world = new CWorld(con, botID, m, world.Width, world.Height);
break;
case "b":
((CWorld)world).BlockPlaced(m, 0);
break;
case "br":
((CWorld)world).BlockPlaced(m, 4);
break;
case "bc":
case "bs":
case "lb":
case "pt":
case "ts":
case "wp":
((CWorld)world).BlockPlaced(m);
break;
You should then be able to use the World as you would a normal World (apart from you dont need locks any more to make it thread safe), and everything will be updated when changes are made (EE, and the World)
Note: Im going to make a better tutorial soon
This is an alpha library which extends the features of WorldSaver to allow you to more easily use the World format to store the blocks placed in the world
To use this (this may change):
1. Reference PlayerIOClient, WorldSaver, and ConnectedWorld
2. Put this code at the top of your class (you may not need static):
static World world;
static int botID;
3. Put this code into your OnMessage switch:
case "init":
botID = m.GetInt(5);
world = new CWorld(con, botID, m, m.GetInt(18), m.GetInt(19));
break;
case "reset":
world.Dispose();
world = new CWorld(con, botID, m, world.Width, world.Height);
break;
case "b":
((CWorld)world).BlockPlaced(m, 0);
break;
case "br":
((CWorld)world).BlockPlaced(m, 4);
break;
case "bc":
case "bs":
case "lb":
case "pt":
case "ts":
case "wp":
((CWorld)world).BlockPlaced(m);
break;
You should then be able to use the World as you would a normal World (apart from you dont need locks any more to make it thread safe), and everything will be updated when changes are made (EE, and the World)
Note: Im going to make a better tutorial soon

connectedworld_0_1_18.zip | |
File Size: | 4 kb |
File Type: | zip |
WorldArea:
This is an alpha library which extends the features of WorldSaver to allow you to section your world, and then use each part as you would if it was its own world.
How it works:
1. Reference PlayerIOClient, WorldSaver, and WorldArea
2. If you want to use a section of the world for something, put World section = new AWorld(world, x, y, width, height); (replacing each with the area wanted)
3. You can now use 'section' as you would a normal World, apart from instead of changing itself, it changes its parent World.
4. This also works with ConnectedWorlds, so you could create a minigame in a certain part of the world, and not need to worry about an offset.
This is an alpha library which extends the features of WorldSaver to allow you to section your world, and then use each part as you would if it was its own world.
How it works:
1. Reference PlayerIOClient, WorldSaver, and WorldArea
2. If you want to use a section of the world for something, put World section = new AWorld(world, x, y, width, height); (replacing each with the area wanted)
3. You can now use 'section' as you would a normal World, apart from instead of changing itself, it changes its parent World.
4. This also works with ConnectedWorlds, so you could create a minigame in a certain part of the world, and not need to worry about an offset.

worldarea_0_1_4.zip | |
File Size: | 2 kb |
File Type: | zip |