3D Block game (complete)
-
I made a 3d game where you can place and jump on blocks. It's got an inventory system, 3rd person camera and basic collision response.
IDs (updated)(LIVE):
Final project : DEZ73M5ZEBArtcraft S plus pro ultra max : SBU73MNDHB ( download this one)Artcraft (readable code) : 6QL63MNDHB (no ui, minimal)Fuzecraft: DEZ73M5ZEB (very first attempt, pretty bad and overcomplicated)
Can you guys give feedback on the camera, controls and the inventory.
-
the camera is great. the inventory could use a few things like separating the hot-bar items from the rest of the inventory and being able to navigate the inventory with the joysticks but other then that it looks great. very impressive
-
This post is deleted! -
version 0.1
i added a user interface now :
This took longer than making the gameplay content lol.New ID : DEZ73M5ZEB
-
Picked up fuze again and I remade everything.
ID : DEZ73M5ZEB
6QL63MNDHBGot rid of all the unnecessary bits of code, leaving only the main important features. Now the code is roughly only 350 lines and actually readable lol.
I used raycasting to find the closest "air" block that intersects the line of sight of the player; which makes placing and removing blocks less clunky. I added a saving system but that doubles the amount of code so I removed it as I want to keep everything as simple as possible.
Feel free to copy or experiment with this
probably wont be on fuze for a while :((what a lie lol)possible future improvements:
could add collision mechanics by checking if blocks around are filled. if true and if round_vector(player_pos + deltaTime()*player_vel) == pos of block that is filled =>then adjust position.improve raycasting function (could use only 1 for loop instead of 3 separate ones idk) (use less variables???)
* add chunk system maybe????? (group positions that are close together) (that way dont have to loop through every single placed block only a specific region)(one 3d array representing world)add ui- add music and sound effects
save system : "%" + str(len(str(block_positions))) + "%" + str(block_positions)--> save to file(save 3d array as string of characters)load system : read between "%" to get length of list --> turn back into position info ---> place blocks downadd textures by using terrain object like last time.(too much effort not doing, use coloured blocks instead)
-
collisions in action:
-
I had a go of this, it was pretty nice.
-
This post is deleted! -
Wow! Awesome work :D
-
saving and loading :
-
Now I made it so save data contains texture data. We can choose from 7 different textures or colours.
One downside of this is that it takes up 3 times more space. This means currently I can only save and load 1 25x25x25 world.
I tried increasing the world size to something like 32 but it keeps giving me a stack overflow error. I think this is because I store the world in memory as 3d 32x32x32 array. Maybe I should store it as a 1d array of length 32^3?
The stack overflow error came from inside the for loop I used to convert the 3d array into a saveable format. It said I called too many functions or something.
Also I think I may have a go at using run length emcoding to further shrink the size of the save data.
How I saved the world:
3d world array, elements are integers 0 to 7 --->
Flatten into 1d array, element are ints --->
Convert integers to bits and store them into an array -->
Group six bits together, bit shift left by 1 and then add 1-->
Convert the 7 bits to an integer. use this integer to get a character. --->
Append all characters together into a string--->
Save this string to file.(Loading is the reverse of this)
Looking at the steps now, i think because each stage has a for loop, this may have contributed to the stack overflow error. I don't know how to fix it though.I should probably stop working on this for now. I have exams next week ðŸ˜. I'll try picking it up after exams tho.
in the future i want to create a game where you can use, combine and place coloured blocks. Each block has their own unique power up. Health, speed, jump, ice, break, explosion, wind block, portal, gravity, colour mixing block. Idk if I'll be able to do all that but it's good to keep a note of. Also I could just save each level like I did here.nah -
Saving and loading with a block palette of size 7:
-
@monkeee You are so legit. This is brilliant - I'm sure the kids at our workshops would absolutely adore playing with it - I'll show them this amongus clip because I'm sure they'd get a kick out of it :D
-
Wow, that's epic @monkeee! Amazeballs!
-Alien
-
@dave thanks :) .i haven't uploaded the project yet though, I'll try do so after exams are over next month
-
This is really impressive! I'm excited to see where it goes!
-
@monkeee Here is probably the final program:
ID : DEZ73M5ZEBSBU73MNDHB.(LIVE) -
I realise now I could make it more like Minecraft:
Random Terrain --> use perlin noise/ hash stuffye doableTextures --> use fuze's own terrain objects like https://fuzearena.com/catalogs/view/4917use provided models instead. frame rate takes a huge hitChunk system --> use rle to compress size of matricies saved to file.No compression so far but i am able to save and load multiple worlds. also chunk system sounds like effort. my code feels so fragile, i dont want to change anything lol.
main problem is frame rate takes a hit when loads of cubes drawn on screen. sadge
-
-
Very impressive stuff! Could make a nice little 3D shooter out of it with randomized levels...
Are you using the terrain functions for the custom texture?