Jump to content
  • Advertisement

Adding and Destroying Voxels

thecheeselover

887 views

Today, I finally finished the following features :

  1. Add new solid voxels at the selected position
  2. Destroy voxels at the selected position
  3. Generate chunks on the fly
  4. Remove chunks on the fly

 

Here is a video demonstrating those features :

 

 




0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Advertisement
  • Blog Entries

  • Similar Content

    • By Servant of the Lord
      I have a texture I'm reading from like this:
      vec4 diffuseFrag = texture2D(DiffuseMap, fDiffuseCoord); Sometimes, for special effects, I'd actually like to do something this:
      vec4 uvFrag = texture2D(UVMap, fUVCoord); vec4 diffuseFrag = texture2D(DiffuseMap, uvFrag.rg); ...basically, I'm using a texture's Red and Green color channels to store the frag coordinates I want to read from DiffuseMap.
      My probably is, both the UV map and the Diffuse map are spritesheets with multiple images in them. This means, I'm actually wanting uvFrag.rg's (0-1) texcoord to be multiplied against the *subportion* of the texture that all four vertices of my fDiffuseCoord are referring to.
      Something like: 
      vec4 uvFrag = texture2D(UVMap, fUVCoord).rg; vec4 upperLeftOfSubrect = ...; vec4 bottomRightOfSubrect = ...; vec4 subrectSize = (bottomRightOfSubrect - upperLeftOfSubrect); uvFrag = upperLeftOfSubrect + (uvFrag * range); vec4 diffuseFrag = texture2D(DiffuseMap, uvFrag.rg);  
      Where my mind is going blank is, how can I get upperLeftOfSubrect / bottomRightOfSubrect, without bloating my vertex struct further with additional attributes?
      It mentally trips me up that I'll have to copy upperLeftOfSubrect / bottomRightOfSubrect into all four of my vertices... and triply annoys me because I'm already passing them in as fDiffuseCoord (just spread between different vertices).
      Is there a simple solution to this that I'm missing?
    • By sevenfold1
      I'm looking for a open source PBR rendering engine that I can use.  Basic requirements are Windows (C/C++) and free to use type license.

      The first two hits I get on Google are:

      Filament
      https://github.com/google/filament/

      LuxCoreRender
      https://luxcorerender.org/

      Does anybody have any experience using any of these, or do you recommend something else that's better?
      Thanks.
       
    • By jb-dev
      This is a picture of a regular room. 
      Each rooms has a chance to have props with a certain layout.
      If a rock is spawn the player can try to break it by exploding it. These can spawn common collectibles like money and such...
      There are many different type of layout possible, including a totally random one.
      The generator simply picks a shape, an anchor position and the type of prop to be generated.
      The process itself is simply a 2D boolean array. We simply draw on that array like we would in a bitmap using traditional image manipulation algorithms.
      Once the array is set, then we simply add a given prop for each true cell of the array 
      We then finally remove every props that are either outside its room or obstructing an entry/exit point.
      Right now, only two types of props can be generated, although the algorithm itself is kinda flexible.
    • By babyjesus
      Hello!
      I'm currently developing a top-down RPG styled game with an Entity Component System architecture and, as the game grows in features, so does my game entities, that is, item models, enemy prototypes, etc. Those definitions are currently in JSON files but at the end of the day I still have long factory classes that read from those files and populate the entities with their respective components and properties in the most naive way.
      Reading through a presentation about Techniques and Strategies for Data-driven design in Game Development (slides 80–93) (warning: big pdf file) there is this "prototyping approach" where you can build up each game entity from multiple prototypes. I find this really interesting, however, the presentation doesn't mention any implementation details and I'm totally in the dark. I don't know how powerful should this system be. By the way, I'm using Java and LibGDX's engine. My first idea is making a robust prototype-instancing factory where, given a JSON file, it will be able to return an entity populated with its corresponding components. For example:
       
      Enemies.json
      { "skeleton" : { "id" : 0, "components" : { "HealthComponent" : { "totalHealth" : 100 }, "TextureComponent" : { "pathToTexture" : "assets/skeleton.png" } } } }  
      If I wanted to instantiate a Skeleton entity, I would read it's prototype, iterate over it's components and somehow I would instantiate them correctly.
      With this approach I have the following issues:
      It will most likely involve using Java Reflection to instance entities from a JSON file. This is a topic that I know little about and will probably end up in dark magic code. Some instances properties can't be prototyped and will have to be passed as parameters to the factory. For example, when creating an enemy entity, an (x, y) position will have to be provided. Suddenly creating instances is not so straight forward. How powerful should this system be? Should it have this "recursive" behavior where you can extend a prototype with an other and so on? This sounds a little bit like dependency injection. Am I reinventing the wheel? Is there anything done already I can make us of? Even though it's still in it's infancy, here is a short demo (under one minute) of my game.

      Thank you!
    • By Josheir
      This is a follow up to a previous post.  MrHallows had asked me to post the project, so I am going to with a new fresh thread so that I can get the most needed help. 
      I have put the class in the main .cpp to simplify for your debugging purposes.  My error is :  
      C1189 #error: OpenGL header already included, remove this include, glad already provides it  
      I tried adding : #define GLFW_INCLUDE_NONE, and tried adding this as a preprocessor definitions too. I also tried to change the #ifdef - #endif, except I just couldn't get it working. The code repository URL is :
      https://github.com/Joshei/GolfProjectRepo/tree/combine_sources/GOLFPROJ
       
      The branch is : combine_sources
      The Commit ID is: a4eaf31
      The files involved are : shader_class.cpp,  glad.h, glew.h
      glad1.cpp was also in my project, I removed it to try to solve this problem.
       
       
      Here is the description of the problem at hand:
      Except for glcolor3f and glRasterPos2i(10,10); the code works without glew.h.  When glew is added there is only a runtime error (that is shown above.) 
       
      I could really use some exact help.  You know like, "remove the include for gl.h on lines 50, 65, and 80.  Then delete the code at line 80 that states..."
       
      I hope that this is not to much to ask for, I really want to win at OpenGL.  If I can't get help I could use a much larger file to display the test values or maybe it's possible to write to an open file and view the written data as it's outputted.
       
      Thanks in advance,
      Josheir
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!