Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Trouble understanding Voxels / Voxel Volumes in LUA

Greetings,

I am new to the Codea Forums and was sent here from the Love2D Forums. The group there suggested I come here after my project exceeded the scope and limits of Love2D even with the 3D add on modules.

A bit of info on Project.
This project is being coded in LUA with OpenGL on a Windows PC. I do not have access to a machine running ISO or any other apple product.
I do have a laptop running Linux. This is being programmed at this time with play intended to be on a desktop or laptop running Window, MacOS, or Linux with the option, later on, to export it over to tablets and phones.

The game is intended to be a 3D recreation of the Classic Break Out game. The one boxed with Windows 95 with the paddle at the bottom of the screen and the wall of bricks at the top that you destroyed with a ball.

In my version, I want the "Bricks" to be a voxel volume entity that-
1: Can be added to or deleted from based on what powerups the player collects (good or bad). This is in addition to the bricks being destroyed by the ball in normal gameplay.
2: Move from the physical collision forces of the ball within the defined area at the end of the playfield. This would be both directional and rotational.
3: Same as two but from collision forces from multiple voxel volumes hitting one another in the defined area. Higher levels are intended to have more than one "brick box" moving around.

Where I run into problems is in understanding how to make the voxels and the volumes that go with them. I have a few examples of voxels and volumes but they are in C# and JavaScript. I can not for some reason wrap my head around the proper translations of the other languages to Lua. When I started asking on the Love2D forums as to how to do this I was pushed in Codea's direction and told that Craft was what I needed.

Two things of additional note-
1: I have mocked up the game in 2D before deciding to move to 3D with it. So have some understanding of the mechanics in Vector 2 and using tables in place of voxel volumes. This was done in Box2D physics in Love2D's (for lack of better term) wonky version of LUA.

2: I have looked through the post here before joining up and have taken note of the following posts-
1: JayBob on his Voxel editor https://codea.io/talk/discussion/6555/voxel-editor
2: Coder on his 3D Block Engine https://codea.io/talk/discussion/4873/3d-block-engine
3: SkyTheCoder on his 3D Modeler https://codea.io/talk/discussion/3025/3d-modeler-codeler-code-generator-easily-create-3d-models

These have given me insight on Voxels and texture mapping them in LUA but little on making volumes that are editable or how to make them an entity. Though JayBob's Voxel Editor touches on it as an array and not a volume so maybe that is an alternative.

I thank you all for your time and any replies sent my way.
Telk

Comments

  • SimeonSimeon Admin Mod
    Posts: 4,990

    @Telknor so Codea Craft is essentially a voxel engine — it's a bit like if MineCraft had an API. So you can define a volume in terms of voxels, and then configure individual voxels within that volume and render them efficiently (e.g., stream an entire world)

    This is probably higher level than what you would have access to outside of Codea.

    But while a standard Breakout game could use voxels, it could just as easily use simple 3D models which are controlled via a 2D physics engine (or even basic custom physics). Unless your ball is actually moving in 3D and not on a 2D plane, in which case you could use a 3D physics engine.

    I'm imagining that you want to build something like the 2D version of the game, but replacing every sprite instance with a 3D model of a brick. Is that what you're describing?

  • Posts: 4

    @Simeon I'm not needing or wanting a world builder or procedural terrain in voxels. I've stayed away from many of the engines and code that deal with that first and voxel characters or entities last or as an afterthought. The main example threw at me so many times is AlwaysGeeky's Vox game. https://github.com/AlwaysGeeky/Vox Which is in C++ and OpenGL. It has well laid out code in a manner that is easy for me to understand even though I don't work with C++. There are only two parts of Vox I have interest in. Voxel entities and the exploding of said entities when they die. Now in the case of Vox. The game takes MagicaVoxel models and runs the parts of them as objects until death then at death turns them back to voxel volumes for a brief second before said volume falls apart in gravity. Another game that does this is Cube World (the falling apart bit) I don't know what it's coded in.

    As to what I am trying to do in my current project please take this horrible 3D mockup done in MagicaVoxel.
    In this mockup, the purple and green walls are the bounds of the play area in which the ball moves. The area defined by the green sections contains the brick boxes. There are two 6x6x6 boxes in this example. The paddle and ball can be seen here too. The paddle would move with mouse or finger depending on which version of the game is being played. It would move in all directions while fixed to the near end of the play area.

    I hope in some small way this helps clear up what my end goal is. I am using this project as a learning experience for a future project that currently is in the pen and paper phase of development. IE: lots of ideas jotted on paper with crude sketches.

    Again I thank you for your time and feedback.

    mockup.png 49.9K
  • Posts: 4

    I also tried to pull off the same effect used by Windmill Games in their game Arr-World https://windmillgames.itch.io/arr-world The boats in the game appear to be 3D voxel entities but nothing in the game is a 3D model. The sprites are layered and each layer is loaded in the z-buffer on top of each other with pixels of each layer stretched out to look like voxels. Was only able to get one direction of rotation on the brick boxes and it was horrible on memory usage.

  • SimeonSimeon Admin Mod
    Posts: 4,990
    @Telknor it seems as if you might be overthinking this? This seems like you could just use cubes and walls and not worry about Voxels. Have you tried Unity?
  • edited February 28 Posts: 4

    @Simeon Yes, I have used Unity for other projects. I have many different add-ons for Unity that deal with voxels or convert them to prefabs. I even have one that converts MagicaVoxel models to prefabs. It's almost 3:30 in the morning for me right now. I'm going to sleep on this and spend a few hours trying an idea out. I've spent the last few hours going through some old projects and found one I did with dice rolling on a virtual tabletop game board. I might be able to pull off the bricks with reuse of some of that code.

Sign In or Register to comment.