Apoidea: Hex Wars
Hex Wars (name may change later) is an attempt to make a family friendly FPS/RTS online game. The idea is to have a game that plays something like a strategy board game with the players taking the role of the pieces.
11 December, 2020
Why the break
Hello everyone who may be interested, which I'm guessing at this point is very few if any. I stopped writing this blog several years ago because my professors were worried that if I posted my algorithms and or thoughts on game development that I wouldn't be able to get published in a journal(which is important for graduate students for some reason). Since my masters project would essentially need to be such a paper I stopped writing my blog. Well, I dropped out of school years ago, and I find myself unemployed once again. So in the hopes that this will be useful to others I am going to go back over all of my posts and add my thoughts on how things changed after I have learned a great deal more about this. So let the necroposting commence.
08 October, 2013
Collisions with triblocks
So I've run into another problem using triblock style voxels. First a little background into how voxel engines work. In games like minecraft it seems like there are millions of blocks that are all separate and independent, but the reality is that if each block had to be individually drawn it would slow the system down considerably. To avoid these millions of draw calls the blocks are instead organized into chunks. A chunk may be an area of say 16x16x16 blocks that will take into consideration whether the blocks are filled or not and then draws a mesh to represent all of the filled blocks that are next to empty blocks. When the player interacts with the world and places or removes blocks then the chunk( or chunks in the case of being right on the edge) is redrawn. Because the whole thing is a mesh together, the collision of the ray from the player's point of view (represented as the sight in the middle of your screen, usually a cross or box) has to determine which box in the chunk is being selected for change, and it accomplishes that in most systems by going halfway into a block and calculating where it is. Because cubes line up with orthogonal directions fro x, y, and z in a 3d system then they use those directions to identify the block they are in and do the necessary change. No matter where the collision occurs on the chunk the test will always find the resulting blocks.
My problem is that using equilateral triangles for one of the planes creates a system where sides will be facing directions other than the orthogonal directions of x, y, and z. To complicate things further if I were to do the same test by going in a half block distance into the block or out from the block using the direction(or negative direction) of the normal vector and the collision occurs near one of the edges I will identify the wrong block for deletion/addition into the mesh. This is kind of a big problem. One possible solution would be to have each mesh store a triangle list, with each triangle pointing to the block it belongs to and the block it is facing. The problem with this approach is that even more will have to be stored in memory during run time, and voxel games are already huge memory hogs. Another issue is that to cut down on the amount of drawing that has to be done if several faces are in the same plane often the triangles are enlarged to cover just the edges of what is showing.
My problem is that using equilateral triangles for one of the planes creates a system where sides will be facing directions other than the orthogonal directions of x, y, and z. To complicate things further if I were to do the same test by going in a half block distance into the block or out from the block using the direction(or negative direction) of the normal vector and the collision occurs near one of the edges I will identify the wrong block for deletion/addition into the mesh. This is kind of a big problem. One possible solution would be to have each mesh store a triangle list, with each triangle pointing to the block it belongs to and the block it is facing. The problem with this approach is that even more will have to be stored in memory during run time, and voxel games are already huge memory hogs. Another issue is that to cut down on the amount of drawing that has to be done if several faces are in the same plane often the triangles are enlarged to cover just the edges of what is showing.
So what this means is I won't be able to do the large areas I was hoping for back when I first had this grand idea. Unless of course I figure out how to overcome these obstacles. Anyway if you are interested in a better explanation please visit https://sites.google.com/site/letsmakeavoxelengine/. It had a pretty good explanation of what goes into a voxel engine.
13 August, 2013
The clutter of virtual stuff
So I have been playing Hexxit with my wife and kids and I'm noticing something. For those of you who aren't familiar with Hexxit it is part of a mod package for Minecraft which comes with the Technic launcher. Anyway back to my point, I have a tendency towards hoarding inside of video games, especially MMOs. I realized that I have been spending hours creating chests and organizing the vast amount of stuff inside of the game. I have noticed that I have this tendency in other games I play as well, games like Firefall and Aion. In Firefall the inventory is an endless black hole that I can throw whatever into, which is nice in that I don't have to worry about space but very confusing when looking for something in particular. In Aion I was forever running out of space for the myriad of items to be found, and finding where I put something could be very annoying as I would have to switch characters and do item juggling just to get the items in the right place. Even with the difficulties that arise I still find myself justifying keeping every little thing since it may be useful eventually, right?
It is clear that people like stuff, even virtual stuff. According to this New York Times article, virtual goods are worth billions of dollars, and this was back in 2010. That is a lot of money for items that aren't really there. So the question I have is how many items should there be in a game that I create? In the case of a Minecraft like game there needs to be both a 2D sprite of the object to go into the player's inventory, and usually a 3D representation of the object. A player inventory implies a multi-level database, as you have the inventory that the player is holding at the moment and more long term storage at the base. I'm going to learn a bit more about databases this coming semester, and I'm hoping to puzzle out a little of how I'm going to organize this project. But one thing is clear at least to me, more is not necessarily better. I think that keeping things to a minimum in the number of things department would be a good thing. I'll have to think more on this later though as I still need to get the basic mechanics of the world figured out first.
It is clear that people like stuff, even virtual stuff. According to this New York Times article, virtual goods are worth billions of dollars, and this was back in 2010. That is a lot of money for items that aren't really there. So the question I have is how many items should there be in a game that I create? In the case of a Minecraft like game there needs to be both a 2D sprite of the object to go into the player's inventory, and usually a 3D representation of the object. A player inventory implies a multi-level database, as you have the inventory that the player is holding at the moment and more long term storage at the base. I'm going to learn a bit more about databases this coming semester, and I'm hoping to puzzle out a little of how I'm going to organize this project. But one thing is clear at least to me, more is not necessarily better. I think that keeping things to a minimum in the number of things department would be a good thing. I'll have to think more on this later though as I still need to get the basic mechanics of the world figured out first.
17 June, 2013
Doing things wrong
So I've been enjoying a break from school ( I figure I should do that while I still have the chance) and in between I have been looking at tutorials for how to do a minecraft-like in Unity3D. The particular video series I followed is by one Craig Perko and can be found at .
So what I have learned from this video is that I was going about creating my scene the wrong way. I was creating a new mesh for every face that needed to get displayed, rather than making the faces all fit together into a larger mesh. This would explain why it was performing so badly at my website http://apoidgames.web44.net/wedge.html, I had hundreds of very expensive meshes all trying to fit together. Unfortunately building all of the faces into a single mesh is not quite so easy when using equilateral triangles for one of the planes. Also unfortunately I am taking a class called computational geometry over the summer which will again take much of my time, so I will have to put this project on hold for now(again). Anyway thanks Craig Perko for explaining how minecraft works a little more clearly.
So what I have learned from this video is that I was going about creating my scene the wrong way. I was creating a new mesh for every face that needed to get displayed, rather than making the faces all fit together into a larger mesh. This would explain why it was performing so badly at my website http://apoidgames.web44.net/wedge.html, I had hundreds of very expensive meshes all trying to fit together. Unfortunately building all of the faces into a single mesh is not quite so easy when using equilateral triangles for one of the planes. Also unfortunately I am taking a class called computational geometry over the summer which will again take much of my time, so I will have to put this project on hold for now(again). Anyway thanks Craig Perko for explaining how minecraft works a little more clearly.
23 April, 2013
The Algorithm for triangles and hexagons
So I thought that it might be a good time to share the algorithm I devised in order to create triangles and hexagons in a standard 3-space. I'll share just the one for a triangle since the hexagon is just 6 triangles put together.
In order to do it you will need some variables that are important. This will be written in pseudo code and should be easily adapted to whatever language you wish to translate it to.
In order to do it you will need some variables that are important.
// This variable is the height of an equilateral triangle
float depth = Math.sqrt(3)/2;
//Then we need some counters for the loops
float count = 0;
float countstart = 0;
float countstop = 50; // This can be for however large you wish to draw
// This first one is built in 2 space
for( int y = 0, y < 50, y++) //Note that the target number of loops is the same size as countstop
{
count = countstart;
while( count < countstop) // This is where the X element is drawn
{
Draw an equilateral triangle the uses the following vertices;
Vertex1 ( x = count, y= y * depth);
Vertex2 (x = count + 1, y= y * depth );
Vertex3 (x =count + 0.5, y = (y + 1) * depth );
count = count + 1;
}
countstart = countstart + 0.5;
countstop = countstop - 0.5;
}
The one for creating triblocks in 3 dimensions is fairly similar
//These variable are used once again
float count = 0;
float countstart = 0;
float countstop = 50; // This can be for however large you wish to draw
//There are only slight variations to build blocks in 3-space
// This second one is built in 3 space
for (int z = 0, z < 50 , z++)
{
for( int y = 0, y < 20, y++) //Note that the target number of loops is the same size as countstop
{
count = countstart;
while( count < countstop) // This is where the X element is drawn
{
if( z=0)
{
Only draw a zpos triblock
}
else
{
Draw a zpos triblock
Draw a zneg triblock
}
count = count + 1;
}
}
countstart = countstart + 0.5;
countstop = countstop - 0.5;
}
Please note that the y loop can have as many iteration as you wish since the triangle is in the z and x portions. Again to create a hexagon one would need 6 of these triangle formations.
In order to do it you will need some variables that are important. This will be written in pseudo code and should be easily adapted to whatever language you wish to translate it to.
In order to do it you will need some variables that are important.
// This variable is the height of an equilateral triangle
float depth = Math.sqrt(3)/2;
//Then we need some counters for the loops
float count = 0;
float countstart = 0;
float countstop = 50; // This can be for however large you wish to draw
// This first one is built in 2 space
for( int y = 0, y < 50, y++) //Note that the target number of loops is the same size as countstop
{
count = countstart;
while( count < countstop) // This is where the X element is drawn
{
Draw an equilateral triangle the uses the following vertices;
Vertex1 ( x = count, y= y * depth);
Vertex2 (x = count + 1, y= y * depth );
Vertex3 (x =count + 0.5, y = (y + 1) * depth );
count = count + 1;
}
countstart = countstart + 0.5;
countstop = countstop - 0.5;
}
The one for creating triblocks in 3 dimensions is fairly similar
//These variable are used once again
float count = 0;
float countstart = 0;
float countstop = 50; // This can be for however large you wish to draw
//There are only slight variations to build blocks in 3-space
// This second one is built in 3 space
for (int z = 0, z < 50 , z++)
{
for( int y = 0, y < 20, y++) //Note that the target number of loops is the same size as countstop
{
count = countstart;
while( count < countstop) // This is where the X element is drawn
{
if( z=0)
{
Only draw a zpos triblock
}
else
{
Draw a zpos triblock
Draw a zneg triblock
}
count = count + 1;
}
}
countstart = countstart + 0.5;
countstop = countstop - 0.5;
}
Please note that the y loop can have as many iteration as you wish since the triangle is in the z and x portions. Again to create a hexagon one would need 6 of these triangle formations.
Labels:
algorithm,
apoidgames,
Brift,
game,
game design,
gamedev,
Hexwars,
triangles
28 March, 2013
Early Wedge in Html5
Ok after a long time I finally have a playable demo I can share with everyone via the web. Just go to
http://apoidgames.web44.net/wedge.html
The controls are basic and it may run a little slow as I only have one type of the two types of triblock showing. There is also no collision detection so you can walk right through all of the blocks. I built it using three.js, and I'm hoping to get to the point where it can be edited. It at the very least will give everyone an idea of what I am going for in the landscape. Just imagine lots of these triangles put together into one large field. Anyway I'm back to figuring out how to make this even more interactive.
http://apoidgames.web44.net/wedge.html
The controls are basic and it may run a little slow as I only have one type of the two types of triblock showing. There is also no collision detection so you can walk right through all of the blocks. I built it using three.js, and I'm hoping to get to the point where it can be edited. It at the very least will give everyone an idea of what I am going for in the landscape. Just imagine lots of these triangles put together into one large field. Anyway I'm back to figuring out how to make this even more interactive.
21 March, 2013
Beginners Ambition
So I've come across this term in my research and I thought I would talk about it a little. Having spent the last few years of my life pursuing a dream that was far too ambitious for a first project, and also meeting many beginners in the game creation process, I have seen a definite pattern that has emerged. When someone is unfamiliar with what it takes to make a video game they think remaking some large game or creating an MMO is just a matter of using the existing framework and tweaking it a little. What happens afterward is a realization of what a colossal effort it takes, as every question they look up on Google leads to two or more new questions, which when followed lead to yet more questions. Soon a beginner is quite overwhelmed, and that grand game they have thought up becomes an unconquerable beast of a task.
So what advice would I give to someone interested in becoming a game developer. Well one is start small, with learning how to make pong for example. Think of pong as the monster conquerable by a beginning adventurer. It's not that exciting, but given you are just starting out it's where you are and it will give you valuable experience needed for the next level challenge and the challenge after that. Eventually you will be able to recreate games from the 8-bit era like super mario bros. Unfortunately there are no shortcuts if you wish to create something truly unique. If you wish to program a 3D game then you will need to learn matrix math and programming challenges that will really stretch your creative and analytic skill sets. Perhaps one day, hopefully with the help of others going through a similar journey, you will be able to take on that challenge and make your game.
Also I cannot stress enough that making games is a challenge that will require a good education in math, computer science, and depending on what you want to include in your game a wide variety of other subjects. It is not a challenge for the faint of heart, and unlike playing most games you will fail many times before you succeed. I have a great respect for game developers now, and I truly hope that many of the rising generation are able to take on the challenge to become great game developers in the future.
So what advice would I give to someone interested in becoming a game developer. Well one is start small, with learning how to make pong for example. Think of pong as the monster conquerable by a beginning adventurer. It's not that exciting, but given you are just starting out it's where you are and it will give you valuable experience needed for the next level challenge and the challenge after that. Eventually you will be able to recreate games from the 8-bit era like super mario bros. Unfortunately there are no shortcuts if you wish to create something truly unique. If you wish to program a 3D game then you will need to learn matrix math and programming challenges that will really stretch your creative and analytic skill sets. Perhaps one day, hopefully with the help of others going through a similar journey, you will be able to take on that challenge and make your game.
Also I cannot stress enough that making games is a challenge that will require a good education in math, computer science, and depending on what you want to include in your game a wide variety of other subjects. It is not a challenge for the faint of heart, and unlike playing most games you will fail many times before you succeed. I have a great respect for game developers now, and I truly hope that many of the rising generation are able to take on the challenge to become great game developers in the future.
Labels:
Apoid,
beginning programming,
Brift,
game,
game development,
Hexwars
Subscribe to:
Posts (Atom)