Game Programming Snippets

Wednesday, September 27, 2017

Well just a small update to report. I was able to get block placement working it works quiet well. It is obvious that there needs to be a small type of delay between each block being placed. Because they are placed really really fast.

The rebuilding of the vertex and texture buffers is also very quick which I am extremely happily surprised by the rebuilding happens in only a couple hundred milliseconds. Its enough for perhaps a slight jitter if done too much to fast but I will not be creating vertex and texture buffers to do animated effects. So for my purposes it does not appear that I will need to do any background jobs for rebuilding and swapping the rendering.

Although that is something that I would like to experiment with cause I'm a sucker for making things run as-fast-a-possible.

Now on to jumping and some world collisions stuff...and may be some moss growing :-D I'm excited (you should be scared)

Friday, September 15, 2017

Building a game is tough work. There are so many things that need to be put in-place. Each time I work on a game project, I always get a little closer to having something more closely resembling a game. So I feel like I'm on the right track. Got a good idea for something I want to play. I've been building many of the pieces of this game throughout the years.

So the way the project started most of the code was like in a single class and as that approached a point of tough to manage I split it up, modularizing it and picking some of the best design I could. Only time will tell if that pays off or not.

I also spent some time cleaning up a ton of clutter left around from various points of experimentation and rework. As well as demo and other types of codes that had been used to debug the opengl learning I was redoing over the years. It's been a literal on and off with OpenGL and OpenGLES. I used to do a lot of DirectX work many years ago did some XNA stuff for a little while too back when I was using Windows. These days are pretty much spent with Linux and not really any thought of turning back.

So, I added sounds and light levels to the combined block texture. I separated out the PlayerController class, built up a World class that is handling all the blocks. Currently working on a Parcel (i.e. chunk, partition) system to allow for a larger number of sections of the world to be generated on the fly. Things are working out well so far. Their building up nicely, got a couple of bugs to fix as is normal. Currently focusing on some movement code, adding gravity and stuff with simple collisions, jumping etc.

Oh I also added ray picking and removing of blocks. It happens instantaneously and since there isn't an inventory or item system yet, there are no tool requirements. I will have to blog about the picking at some point. It works quiet well and is exceptional at using all the GPU memory available since I have not added code to clean up old vertex and texture buffers that are left behind. Just add that to the list of things I need to do.

This time around I am trying to work off of a list of items, a todo list/backlog. I just keep it in a simple document and X off things when their finished no dates or targets yet but maybe I'll add something like that. I mean I would probably just want a number of days since it's been modified with the goal being to keep that number low. I think I'll add a simple one item inventory with a tool requirement for breaking blocks.

Some current screenshots with a few missing blocks, the sides are not really well defined because another backlog item is being able to change the light level for each side. The textures need a lot of work their just placeholders for now until it becomes a playable game and then they will need to change.