Showing posts with label apoidgames. Show all posts
Showing posts with label apoidgames. Show all posts

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.

12 February, 2013

The power in WebGl

I recently stumbled upon a pretty amazing demo showing just what can be done with javascript and Webgl.  You can check it out at https://developer.mozilla.org/en-US/demos/detail/bananabread . Basically they took a full game engine written in C++ and OpenGL and ported it to javascript and webgl.  It's open source, so I will be able to study it out and get a good idea of where I could go to start my own game later on.

10 December, 2012

Firefall review

So I recently had the opportunity to try out Firefall and I must say that for a free to play game it was very impressive.  I liked the ability to swap out battleframes, which is very similar to the idea I have for switching roles.  There was a definite PvE (player vs environment) push, with PvP(player vs player) being almost an afterthought.  The PvP matches were basically 5v5 team deathmatch style with the possibility of 10 v 10 on different maps, but there is not the persistent open world pvp I was kind of hoping would be there.  There are a kind of simple tower defense type situation where you and your squad defend a thumper (a type of mining device) from wave after wave of overgrown bugs and other mutated wildlife, which provides a challenge of it's own.  Finally there is the Chosen, who are evil incarnate NPC (non player characters) who come to take over watchtowers and generally make life difficult.  Some of them are quite powerful, leaving me roasted a many a time as I tend to walk around alone.  Even so I was able to take out dozens of them single handed, and I'm sure that even with improved AI players will eventually figure out way's to kill them easily.

As for what I would hope to see,  I would say that player controlled chosen would make the game very interesting.  That way large scale open world pvp could be realized, though that also introduces some problems as to how would tech and other items work.  That and if you have the "good" side and the "bad" side developers often will unconsciously favor the good side.

Product vs Service

As I continue to study the art of game creation I came across an interesting and thought provoking concept, that we are moving away from games as a product to games as a service.  I certainly would say that I hope to create a system for the latter, but I suppose I should explain the differences before I go into that.

In the past games were required to be in a complete state (meaning completely coded, put into a package to be sold in retail outlets, etc..) before they got to the consumer.  Often once it had shipped the developers would no longer have anything to do with the product other than wait for one of two outcomes, success and the opportunity to make more games or rejection by the masses which usually meant the end of said game development company.  With every "product" shipped there was a definite gamble,  and since publishers who were funding the product from the inception and who also are very concerned with making a profit were pretty much in control, any failure to produce said profit was a death sentence to any game developer who didn't perform well.

Now switch to games as a service.  MMO's are a great example of how this mindset works.  A game is created and then costumers are brought in before the game is complete (usually in beta) and they give feedback as to what they would like to see in the game as a finished product.  The thing is that the game is never really finished, as things keep getting added on.  Costumers also don't do the one time purchase as in the other model, rather they pay on an ongoing basis either through subscription costs or via micro-transactions.  The game developer and the consumer then have this continual relationship where there are feedback loops and opportunities for creating an experience that players enjoy and game developers are happy to provide.  It also means that game developers are able to work with a product long after it has reached the hands of the consumer.

I think the second option has a better chance of creating communities around a game, and also gives developers a chance to polish and work out games to become the very best that they can.  I look forward to the change in paradigms that is already occurring.

15 November, 2012

Marching Cubes

As part of my algorithms class I need to present an algorithm that I have looked into and analyzed.  For this assignment I chose the marching cube algorithm.  It's a nice straightforward algorithm that was designed to display 3d volumetric information and it was originally presented in 1987.  Anyway I am learning quite a bit about voxels through this, and apparently this algorithm or something very similar is commonly used in place of height maps for creating the base landscape in many games.  The reason why is that it make negative spaces like caves and overhangs possible.

So a quick explanation is that you take a large set of cubes put into a 3d array like 512x512x512.  Then going through each of the smaller cubes you determine whether one of the 8 corners is either inside or outside of your volume.  The program then repeat this for all of the remaining cubes keeping track of which ones are inside and which ones are outside and drawing triangles based on the intersections.  In the end you have a rough 3d representation of the volume being measured.

Now I need to go and write a 20 page paper on this, and I find myself wondering what fillers to use to stretch this out.  Wish me luck.

10 November, 2012

What I'm learning about programming

Ok I know I haven't posted for a while, but that is mainly because I haven't done a whole lot as far as this game is concerned.  School again is sucking up lots of time.  I am having what I think is an important understanding of something though.

Programming ,indeed all of computer science, is all about tackling problems and learning to teach oneself in order to tackle ever increasingly difficult problems.

I think that is why when I look at jobs in the world of gaming they always have the requirement of having shipped at least one title.  That is because an appropriate candidate will have proven that faced with problems they did not give up and run away, rather they figured out a way to make it work.  In my college experience I have railed at how it seems that I must teach myself, yet I think that is the actual goal of studying computer science and programming, to develop in students the ability to self teach and problem solve without the assistance of someone else.  Higher order thinking skills are really hard to pick up though, which is why when someone is able to show that yes they did have problems that were hard and yes they did solve them even when it wasn't fun that is says something about that person.

Which is why I need to kick myself in the rear and get to work overcoming some of these obstacles I keep running into.  I also need to remember that I can learn it little by little, step by step.  So now back to getting my homework done.

29 October, 2012

Problem with trying to use Voxels and triangles

So I've encountered a little bit of a problem when it comes to using the voxel mindset with triblocks.  The problem is that I need each and every triblock to have it's own unique ID, yet if  I try to use a single point for each triblock only half of the triblocks would be represented.  Voxel engines are very efficient because each voxel is basically one point which is either filled or not filled (it is possible to attach other information to them, but that isn't the problem as much.)  I suppose that one thing I could do is for any given point there would be the up triblock and the down triblock.  So the final title for the triblock would be something like x200y46z300up.  Ok I'm glad we had this chat as I no longer have a problem.

My First Screenshot

So I realize this has been a long time coming, but I am finally able to post a screen shot showing I am indeed making progress.  I know it may not look like much now, but the foundation for my game is laid out here.  This is a hexagonal room with the triangles on top and bottom and squares on the sides, meaning that it is possible to program.  I still have a long way to go, but it feels good to have something up.  In the program I have a working first person camera with WASD motion going on and the mouse being used to look around.  Thanks to lighthouse3d.com for a good tutorial to get me started.  If anyone wants the executable just let me know.

08 October, 2012

Github

In the vein of being completely and totally open about how I am moving forward with this project I have created a Github account and posted the code I have so far.  I am still trying to get a grasp on OpenGL and GLUT which is why I haven't done a whole lot recently.  Also I am struggling with how to represent the triblocks in a way that is not resource intensive.

Part of my problem is that for each triblock there are 5 neighboring triblock areas.  I need a way for the triblocks to be aware if each of the neighboring areas are either filled or not.  If they are filled then the triblock will not display the neighboring face, and if not then the face will be displayed.  I might have to make a huge set of pointers, which I am not looking forward to as I still haven't quite got the hang of them.

Anyway if you want to stop by and check out my code just look for Brift or Hexwars on github.

06 October, 2012

Single Hexfield battle

Because the game will need to be constructed in phases and the first proof of concept will need to be a full hexfield I have been mulling over how the game might play out if only 1 hexfield were involved.  So the ideas I have are this.

1. The game starts out with a 5/10/15 minute building phase when players can get their base set up.  All teams will start out with the exact same resources available via a console.  It will be up to members of each team to construct their base as they see fit.  Because I one day hope for six factions we'll just start out with 6 separate starting areas, divided up like the picture above.


2. At the end of the build phase the walls come down and the battling can commence.  If players are still setting up their base they are now in danger of being attacked.  If frozen while carrying a base item they will have to drop it once they get teleported, which means that there is an opportunity for enemy players to capture the item and use it for their own base.  This means that there is a good reason to both attack and or defend right from the time those walls come down.

3. The battle will commence until there is only one team standing,  Once a team's teleporter is taken down then they will lose the ability to respawn and will remain frozen in place until they either get a new teleporter down or all of their team is frozen, at which point they will be given the option to concede and exit the game.

Teams could be chosen at random or there could be the option of having precreated teams.  This format of play will be where beginners will start the game,  and it is through demonstrated knowledge of the game mechanics and ability to follow the rules that they can be allowed to play in the big game.  It will also be a place where the factions for each color can come in and train new players while  recruiting for their faction.