Giter Site home page Giter Site logo

boyquotes / godot-3d-voxel-demo-c-sharp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sami-badawi/godot-3d-voxel-demo-c-sharp

0.0 0.0 0.0 1.29 MB

Port Godot template 3D Voxel Demo to use C# insted of GD script

License: MIT License

C# 55.53% GDScript 44.47%

godot-3d-voxel-demo-c-sharp's Introduction

Voxel Game

This demo is a minimal first-person voxel game, inspired by others such as Minecraft.

Language: GDScript

Renderer: GLES 3

Check out this demo on the asset library: https://godotengine.org/asset-library/asset/676

Work In Progress C# Port

Started work on porting the original 3D Voxel Demo from GD script to C#. Porting a dynamic language to a static is a little messy.

All GD script classes are fully ported to C# and are wired up to be used.

There are bugs and the voxel boxes are not showing up when game is running.

Last Playing Commit

If you check out this commit:

git checkout 87c6921defaf9a10b00e474e6999f259cac16f54

You will see the game looking like the original but part of games is controlled by new C# classes and part by original GD script classes.

Goal for Port

Trying to keep the code as close to the GD script version as possible. This is meant to be a starter project for a dynamic procedural generated 3D world. Maybe this could be accepted as an official Godot asset / template.

Pull requests are welcome.

How does it work?

Each chunk is a StaticBody with each block having its own CollisionShape for collisions. The meshes are created using SurfaceTool which allows specifying vertices, triangles, and UV coordinates for constructing a mesh.

The chunks and chunk data are stored in Dictionary objects. New chunks have their meshes drawn in separate Threads, but generating the collisions is done in the main thread, since Godot does not support changing physics objects in a separate thread. There are two terrain types, random blocks and flat grass. A more complex terrain generator is out-of-scope for this demo project.

The player can place and break blocks using the RayCast node attached to the camera. It uses the collision information to figure out the block position and change the block data. You can switch the active block using the brackets or with the middle mouse button.

There is a settings menu for render distance and toggling the fog. Settings are stored inside of an AutoLoad singleton called "Settings". This class will automatically save settings, and load them when the game opens, by using the File class.

Sticking to GDScript and the built-in Godot tools, as this demo does, is quite limiting. If you are making your own voxel game, you should probably use Zylann's voxel module instead: https://github.com/Zylann/godot_voxel

Screenshots

Screenshot

Screenshot

Licenses

Textures are from Minetest. Copyright © 2010-2018 Minetest contributors, CC BY-SA 3.0 Unported (Attribution-ShareAlike) http://creativecommons.org/licenses/by-sa/3.0/

Font is "TinyUnicode" by DuffsDevice. Copyright © DuffsDevice, CC-BY (Attribution) http://www.pentacom.jp/pentacom/bitfontmaker2/gallery/?id=468

godot-3d-voxel-demo-c-sharp's People

Contributors

sami-badawi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.