Developers

Everything posted by VoxycDev

I'm no expert here, but 4 weights probably looks good enough in most cases so that became the standard (anything more and you'd probably run out of registers on the GPU with a complex model). I'm about to tackle the same exact issue and my plan is as follows: create something very simple, like a 2D skeletal animation with only 2 or 3 bones (maybe just a piece of grass swaying in the wind), then gradually expand that to full functionality, by making it 3D, adding more bones and loading models, etc. I'm also looking for a tutorial that explain this simply, how to start small, and then gradually build up.

I finally found a way to light voxel buildings with per-vertex lighting that looks decent. They key is to have a RGB values for each voxel, and set them in the following way:
Start from an empty point somewhere in the room
Expand on all three axes as far as you can until you hit a voxel on each axis, save min/max values
Fill a rectangle box bound by min/max values on the three axes with desired RGB values
This works relatively well if each corner of each voxel/quad takes the color of the voxel value to the left/lower/rear of it (on x, y and z correspondingly). Then when you go from a somewhat radical RGB value (1.0, 1.0, 1.4 in this case) to default 1.0, 1.0, 1.0 in the next voxel, you get a nice gradient due to interpolation in the shader. If bet it will look even nicer if I try to make a gradient in the RGB voxel values from top to bottom, as if the light comes from the lamps on the ceiling. Gotta try that next.

I got lucky. This wasn't supposed to work so quickly. The vertex lights are functioning. Completely random and crazy and wrong, but functioning. I hear that Unreal gave up on vertex light mapping years ago. Probably for a good reason. Texture memory is cheap now. No time to integrate lightmapper and vertex lights already worked in my engine years ago. Re-adding them for version 3.
How to store RGB in a char? When light hits a color, their values multiply. When light hits light, their values add. Unsigned char holds values from 0 to 255. The final value will be a float in the shader, but with what range? (-1.0, 1.0)? No, because you often want to multiply by more than 1.0. The highest I ever multiplied a light by is 3.0. So from 0 to 255, maybe range can be to 0.00 to 4.00? As in 64 = 1.0, 128 = 2.0, 196 = 3.0, 256 = 4.0? I wonder what is the most efficient way to store light values in chars so they can be multiplied as floats in the shader. What is the highest value, in practice, that a color value could be multiplied by?

Voxyc is an open-source free voxel-focused game engine with Lua scripting that allows game development on mobile. The editor for Android is now available. The Windows and Mac OS builds of the editor will be released when ready. The codebase is cross-platform C++ and can run on Android, iOS, Windows, Mac OS, OpenVR and GearVR (others in development).
Editor for Android in Play Store Source on GitHub
Games created with Voxyc:
Fateless - First person shoooter Evertank - Tank battle action game UFO Shooter - Scrolling shooter

Use GLFW library in Visual Studio to set up an OpenGL window (it also reads keyboard and controller input). Then, figure out how to draw a simple quad with OpenGL. Use lodepng library to load a texture and put it on the quad. Now you have the basics of what you need to make a 2D game, graphics-wise. For sound, use sndfile library to load files into audio buffers and OpenAL to play them back.
To draw sprites efficiently and improve frame rate, make a texture atlas, draw all the sprites to it via a frame buffer, then on each frame, draw them all at once with one draw call. Draw multiple quads at once, but in the shader, pick the transformation matrix (position of sprite in your case) and texture coordinates (for the correct sprite) based on the quad's index (send quad index as a vertex attribute). Send the transformation matrices in a new VBO on every frame.

The level is split up into chunks of geometry based on visibility (what room / area you can see from where). This was done with BSP trees traditionally, but I think now there are more advanced algorithms (Bethesda games use Umbra visibility solution library). I don't know about Vulkan or DirectX, but in OpenGL it helps to minimize number of draw calls, so chunks have to be big enough to only have a few of them in any given frame.

I develop on both tablet and computer to maximize productivity. If I didn't have the ability to develop on a tablet, none of my games would be out yet. The reason I was able to do what I did was because I found a way to cram development into very odd idle time slots. I'm not going to argue with you about benefits of developing on a tablet. Point is, this is what I do. Now it would be great if I could take the levels, assets and game logic that I create on the tablet and put them into Unity or Unreal, to get skeletal animation, fancy lighting effects and better collision detection.
Maybe I am the only person in the world who likes to develop on mobile. Fine! I don't care if nobody follows me. What I do care about is how to make what I do useful to other people so we can collaborate. I'm starting to think that I need to build some kind of bridge between Voxyc and other engines, so that code, assets and logic can be transferred back and forth as needed.

1. You can develop on the train
2. You can develop at a bar / coffee shop
3. You can develop in the bathroom
4. You can develop offline
5. You can have a random idea in an unusual place and be inspired by your surroundings and incorporate them into your project
6. You can take pictures on your tablet and turn them into textures quickly
7. You lose weight and improve your health by not being stuck at a desktop terminal
8. Your posture is not constricted by chronic laptop use
9. No 9 to 5. Little-to-no overtime
10. Set your own hours / schedule

I'm considering using my existing custom C++/Lua engine for development, but rolling out final builds to Unreal or Unity. I develop mostly on an Android tablet and the U engines can't do that, but I'd like to keep my development workflow. I simply do not have the time to fix the shadow map and develop lighting for my own engine, so I think I might just export all my levels as OBJ's and somehow transpile all my Lua to whatever language the popular engines accept. Also, since Unreal is C++, can I just write an adapter for my Lua code and keep using it as is?

I really like this direction of thinking. How about a randomized humanoid character generation tool/library? Something like MakeHuman, but as a library that you can integrate into your game that auto-generates randomized monsters or humans based on certain parameters. This way, each monster or character will have a randomized height, skeletal structure, all slightly different faces. It looks like Autodesk either already has one or is working on one, I'm guessing it probably exports DAE asset files like MakeHuman. It really would be nice not to have to deal with character assets at all, just have a library that generates the necessary meshes on the fly when the level loads.

Because probably like a lot of other people, I saw John Carmack's Wolfenstein 3D, Doom and Quake source code and said to myself "I want to do this too. Just like that." Also, I like developing on mobile and neither Unreal nor Unity editors run on mobile, at this time, as far as I know. Also, I like to have my own style in how the controller responds, how the game physically feels, etc. Also, I like how my games load fast (no loading unnecessary subsystems) when made with C++. Also, hopefully, pretty soon we'll have so much MIT-licensed open source code that we won't need Unity or Unreal and we'll just make everything from open-source faster than closed-source companies because there are simply more of us (more open source programmers out there than programmers in any particular game/engine development company), which seems to be the direction these days.
In my engine, i have a Lua function called setsun. I call it like this:
setsun(10, 10, 10, -45, -45, 0, 50)
The parameters are:
setsun (x position of light, y position of light, z position of light, pitch of light, yaw of light, roll of light, size of lit area)
I've been playing with these numbers for a day or two now. It seems that changing x, y, z too far away from 0 just gets less and area covered by light. Any size of lit area larger than 130, and light also disappears. Maybe I'm going to try to play with some simple blocks on different scales instead, simplify the scene, to see where the problem might be.

There is clearly something wrong with the images below. The shadows are not supposed to be this far away from the surfaces they are cast from. Can I correct this with bias or should I fix the scale? The shadows used to look real, but all this floating point multiplication must have got in the way. Two years ago it looked perfect. What happened with this shadowmap?
https://github.com/dimitrilozovoy/Voxyc/blob/master/engine/ShadowMap.cpp
https://github.com/dimitrilozovoy/Voxyc/blob/master/engine/ShapeRenderer.cpp

I would have an array of computer objects named "computer1" to "computer32" and reuse them for whatever monsters are necessary by changing their properties. If hitpts are over 0, the object is alive. Ones that are not needed currently have visible set to false. The array is re-created for every different level (with needed length), but stays consistent during a particular level. I find that not re-creating or deleting objects during game play helps with debugging and helps avoid memory leaks in C++. In Java, maybe there would also be a small benefit of GC not being invoked unnecessarily (less jitter).

As far as I know, the general rules for threading are: you can change primitives (char, int, float) from any thread at any time because those operations take one processor cycle. For complex types (string, object, etc) you have to set up flags. I use heightmaps and need efficient voxel world refresh / rebuild threading for all OS's. Maybe you're interested in similar thing? Not sure. Sorry if I'm mistaken.

I'm a graphics engineer with 3 years experience. My background is Android and OpenGL. I'm also very interested in learning Vulkan. I developed an engine (Voxyc) but so far it's OpenGL-only. I need Vulkan integration and have Android (linux-based OS) experience. I have Ubuntu installed. What is the fastest/easiest way to get a C++ Vulkan simple triangle project set up on Linux? Willing to try this.

The Engine
The engine for this project, tentatively, will be Voxyc. Links to the Android editor app, Github source and existing games are on the Voxyc project page. The editor and the games it produces also run on Windows and iOS (the Visual Studio and Xcode projects are in the /platform folder of the repo). I'm open to other alternatives, but ability to edit on mobile is essential for me. Another way would be writing a mobile editor and a voxel plugin for Godot, or merging Voxyc and Godot.
All buildings will be made out of voxel blocks. This allows for easy level creation. I've already blocked out the basic outline of the landscape, the house ruins and the little hamlet (the roofs should be triangular prisms, I know; they will be). You can find main.sc scene with them in the attached project (Voxyc can open this file). As @JoeJpointed out, this will also allow for the swine creatures to break into the house by taking away blocks, which sounds awesome.
The characters will be animated models. I used MakeHuman to create some of them already. The first four .dae files are included in the attached project. They are not animated yet. The engine does not yet have skeletal animation, so we may resort to .obj frame animation, like in Fateless. But I'm working on skeletal animation.
List of characters: Camper (player for chapter 1), Old Man (player), Tonnison, Sister, Dog, The Swine Man, My Love Full text of the novel
How To Edit And Run The Game Build
On Android:
Install Voxyc. Download the attached project file. Unzip the folder HouseOnTheBorderland into /Android/data/com.voxyc.voxyc/files
To run the game, in Voxyc, click on File->Clear and run script->Picker and select loadch1.lua in the HouseOnTheBorderland folder.
To open the main scene in the editor to edit, in Voxyc, click on File->Load Scene->Picker and select main.sc in the HouseOnTheBorderland folder.
On Windows:
Clone Voxyc source from the Voxyc github repo. In Visual Studio, open /platform/windows/Voxyc/Voxyc.sln. You can run the game with the following command line parameters:
-m luaprogram -a <path to extracted HouseOnTheBorderland dir>
-m means module and luaprogram is the module that runs lua scripts.
-a sets the main project dir. The Windows port will then automatically launch load.lua there on startup (rename loadch1.lua to load.lua).
You can edit the scene by pressing Tab->Load Scene
Breakdown of Voxyc C++ features
Here is a brief overview of important files for the C++ codebase
app/main.cpp - Entry point for desktop
app/VoxycApp.cpp - The engine core app file that runs different modules (game, editor, etc) and has the highest-level load/tick/draw functions
app/LuaProgram.cpp - The module that runs a Lua program; the game is essentially a set of Lua scripts (load.lua, tick.lua, etc)
editor/Editor.cpp - The editor; essentially one big loop with everything; needs splitting up/refactoring
engine/Engine2.cpp - The engine core; main interface into the engine; any client that uses the engine calls this class
engine/ShapeRenderer.cpp - Renders geometric shapes, terrain
engine/ModelRenderer.cpp - Renders models
engine/SpriteRenderer.cpp - Fast sprite/particle system renderer; only works on Android at the moment
engine/Voxels.cpp - The voxel memory storage and converting voxels to mesh are here
engine/TextureAtlas.cpp - Essential for the fast sprite renderer and the batcher; only works on Android
engine/Batcher.cpp - Batcher; combines voxel meshes into one big mesh to reduce draw calls; only works on Android
engine/Billboarder.cpp - Billboarder; pre-draws models as sprites for far-away rendering; does not work yet (but would be nice!)
engine/ShadowMap.cpp - Shadow map for real-time shadows; used to work on Windows and Mac OS, but currently probably broken. Essential for horror, though.
Feel free to ask any questions. I figured that you guys would appreciate me finally getting specific and technical instead of whining about Unity. I really hope so and I'm trying to avoid downvotes. In case, if I'm doing something wrong, please let me know as I'm new here.
HouseOnTheBorderland.zip

Horror genre is one of the most profitable genres of games. The horror novel "The House on the Borderland" is public domain and is a perfect for a first person shooter game adaptation. In the novel, an old man moves into a cursed old mansion, explores the area around it, and finds that it is infested by half-pig-half-men who violently attack him and his dog. He fights back with a double-barrel shotgun. Throughout the following days, he secures and guards the house against an invasion of the pigmen. When he finally gets rid of them, he decides to descend into the underground river nearby and explore where the creatures came from. He eventually comes back up and experiences supernatural events that lead to insight into the universe. Full text is here.
I started work on this game, but this is a big project for one person and I'm looking for people to collaborate with. I'm using C++ and Lua and all custom-made open-source tools (Voxyc). I've already made one first person shooter game (Fateless) and therefore have the necessary experience to develop this. The first chapter can be free and we can charge for subsequent chapters in a freemium model. We can discuss revenue share. Please contact me if you are interested in collaborating.
Details on the project and an existing current game build are here
The tiny hamlet of Kraighten
The ruins of the house, as found by Tonnison and Berreggno