This is a Unity3D project that refactors AlexStv's Voxel Tutorial.
Things I've changed:
- Standarized code style.
- Move everything inside the
Voxels
namespace. - Removed terrain generators. No caves, no trees.
- Removed noise-related code.
- Blocks are represented as
int
s instead ofBlock
subclasses. - "Infinite size" map editor out of the box, start with a single block and build huge worlds.
-
World
serialization uses gzip compression. - Modified
tiles.png
with two new tiles:sand
anderror
. - Refactored some magic numbers to
Assets/MapEditor/MapConstants.cs
.
Blocks are static so just an id reference to some container that holds each block details should suffice for most cases.
This has the benefit of making serialization super easy and space efficient.
LMB
adds the current block to wherever you click, if possible. Default: Stone.Tab
switches between Add and Replace modes. Default: Add.1
switches current block toCobblestone
2
switches current block toStone
3
switches current block toDirt
4
switches current block toGrass
5
switches current block toSand
9
switches current block toError
0
switches current block toAir
X
toggle burst mode forLMB
(Input.GetKey
vsInput.GetKeyDown
)B
backup world whatever is configured inMapConstants.SaveFiles
. Default:<root>/maps
.RMD
+WASD
to move around the sceneRMD
+E
to move upwardsRMD
+Q
to move downwardsEscape
pauses Unity Editor if in Play Mode
- Add adds a block next to the clicked block.
- Replace replaces the clicked block.
I'm following the same licensing as AlexStv's original tutorial which can be found here.
Basically you are free to use this project however you like.
The only asset that's not allowed for commercial usage is the Assets/MapEditor/tiles.png
.
It's very easy to replace with one made by yourself.