Dyadic Development

I really wanted to just make a post about the main feature I have been working on, but at this time, it is still currently not working as intended. Here is a video anyway:

After two weeks from the beginning of development, we are at a point where we can start putting together the levels. Much has been achieved in the last week alone that has gotten us to this point. Our artist Angelica has done up a large amount of the art needed already, the level designer Jack Kuskoff has designed all the rooms for the game, our audio professional, Sam McLean has put together a group of people who will be recording the music live and the three programmers, Callan Syratt, Jared Ford and myself have put together the main mechanics of the game.

Our first milestone was today. That was to have all the mechanics functional. That milestone was unfortunately not achieved as we didn’t realise how difficult the mirrors would be to program. Originally, when the mirrors were made without them reflecting from mirror to mirror, it seems doable. It was very simple when we were just casting a line in one direction and checking if it hit anything. However, it became super complicated when we started having it so that the light will bounce off mirror to mirror and for it to work in all directions. Currently, as shown in the video, the light works when it goes to the right, however, for some reason, it doesn’t function correctly when shining to the left. Due to this not being completed, the milestone was not hit. We are hoping to only run one day late. Even though the mirror is not functioning 100% yet, everything else seems to be working.

The other work I completed over the weekend was making a hatch that allows players to pass objects between them, some ghost trail stuff and some base classes for the objects (which were later scrapped… and brought back… and then one was scrapped completely). Here is an example of the ghost trail I created:

I played around with the particle system in unity to create that motion blur. I first set it so that a maximum of 10 particles would appear at once. Then I made it fade from 100% alpha white to 0% alpha black to make that fading out effect. I also made it emit particles frequently to get that ghost effect. Finally, I set the texture to the same as the object it is applied too. We are unsure at the moment if we want to use it or not, but I’m sure I can find a use for it in the future.

Over the next week I want to improve upon the mechanics by giving user feedback, easing things etc.,making sure that mirror and reflecting light works correctly in all scenarios and help out with testing the rooms that will be created. At the moment, a lot of the mechanics are working, but not very appealing. I hope to make them a lot tidier and by the end of the week, have a game that somewhat resembled what we are going for. Also, just because, here is a video of what the game’s art looks like (I took the video from Callan. Thankyou :D)

 

Advertisements

Game Engine Stuff

Over the past week I have finally started putting my stuff together to begin a long term project I want to work on. I want to create a 2d game engine in c++. Already since starting it, I feel like I have learnt a lot of new concepts and worked out how to apply old ones. Current in my engine I have window support, input manager, vector2s, vector3, vector4 and matricies. I have also set up opengl and will be using that to render.

I found some libraries that assisted with the creation so far. Firstly was a library called GLFW. This library helps to manage windows and input. Using it I was able to easily create a window manager and also poll for events. Using this library has given me more motivation to actually get started with this as in the past when trying to make my own windows from scratch, I would get bogged down will all that stuff that you need to do to even make a window. Therefore, I feel like using this was a massive step in the right way for writing my first engine.

Next I found a library called GLEW. This is a library with all the openGL function pointers and will allow you to check if the user’s graphics card will support certain function from newer versions. This will prove to be very beneficial when I start writing rendering.

With the maths section, I was brought over my vector and matrices classes that I made a few weeks ago for my maths library. I plan on continuing to write my maths library but as a separate project that is linked to the engine. That way I can use it by itself if I ever need to or I can use it within my engine.

Day/Night 2D Game Shader

daynightshader

During the last couple of weeks, I have jumped aboard a fan game based on the legend of zelda. It has been somewhat difficult as I have joined the project during development, so catching up with all the information has been hard. Luckily there is alot of documentation, so I have been able to follow that.

when reading stuff about the game, there were some mentions of meeting people at night. So that raised the question: is there a day night cycle? When asking around the team leader said there isn’t at the moment and asked if that was something I could do. I thought about it and said I would look into writing a shader for a day night cycle.

I wanted to try an make this shader without looking at examples, so I did. I played around with paint.net to try and work out how to make colours darker mathematically. I eventually came up with taking the same amount of colour from the red, blue and green. This worked well and gave me the desired effect.

So I wrote a time system that set a uniform variable I. The fragment shader to say how much colour could be taken. The I just took the amount from the red, blue and green and then finally clamped the numbers between 0 and 1.

The end result can be seen above. I want to work on two more things relating to the day night cycle. Firstly I don’t want to use the shader indoors. That would be strange. Secondly I want to make the light transition slightly smoother. Overall, I am quite happy with the shader in its current form.

 

 

 

 

Matrix Class

After revising matrices in class last week, I decided to add a matrix class to my maths library. I intend to use it to eventually display graphics on screen with opengl.

Originally, I created a matrix class that utilised 2D arrays. This worked well for the most part, but was quite en-cumbersome. To set each element of the matrix, the user would have to call Set(indexHorizontal, indexVertical, value). That means to make a 3×3 matrix, the user would have to first define the matrix, then set each element individually. This would require 10 lines of code…and that is inefficient.

After showing some people, I got told about a thing called veradic templates and veradic functions. These allow the user to specify all the data at once by doing the following for a 3×3 matrix: matrix.Set(1, 2, 3, 4, 5, 6, 7, 8, 9);

That will create a matrix like:

[1, 2, 3

4, 5, 6

7, 8, 9]

Obviously this is a much better method because the user only has to write two lines of code to create a matrix and populate it. Then to further make the matrix flexible, I templated the whole call so in theory, you can have a matrix of vector3s if you wanted.

Here is my code:

https://drive.google.com/file/d/0B_j8opAF2t_GYk5xS05CUGtWRmc/view?usp=sharing

 

Make-A-Thing, 2015

I entered Make-A-Thing in Feburary, and created something quite interesting with Jim Vincent, Callan Syratt, Richard Stein and the late comer, Chris Schnitzerling.

Again, this was an excellent experience. I love Make-A-Thing. Callan and I discussed making an oculus rift game, and we managed to wrangle Jim, Richard and Chris into it. It was… interesting.

We spent the first day coming up with the idea and all the little details about it. What we ended up with was a game where you would deliver coffee to people in an office. Once person would be in the office which is a massive maze with the oculus on. Then a second person would have a map of the office, and the two would need to communicate to determine where they were and then where they need to be. We thought this was an excellent idea for using the oculus and we all agreed on it.

However, we once again bit off too much. We honestly never learn!! On day 1, everything we wanted seemed plausible. By the end of day 5, half of what we wanted wasn’t fully functioning. We wrote a system for the AI to move around the building, but never ended up using it because we didn’t have the delivery system fully working with it. We had many models that were not added simply because we ran out of time. We have sounds as well, but again, ran out of time. It was unfortunate that we ran out of time, but we learnt something big. Next time, there will be a cut off point. At the point, whatever is implemented will be polished, and anything not implemented will not be. This is crucial to getting the game polished in such a short amount of time.

In the end, we had a game where one saw through the oculus and the other had the map. At the beginning of the game, it would tell them what room they needed to locate. They would communicate to work out where they were in the building. Once they determined where they were, they would make it to the door and the demo would be over.

It’s unfortunate the rest isn’t implemented such as going to pick up coffee, trying to deliver as many in the time limit, people walking around or not being in their room to mess with the players, a mail man that would push his trolley down the halls to be a dynamic obstacle and randomly choosing the floor map that will be used from an assortment of 5-10 different maps (mind, this was never intended to be implemented in the 5 days). However, we plan on continuing work on this project as we all love the idea.

Below is a map of the office which I created.

MakeAThingFeb2015MapNoGrid

A* bot

Over the last week, I started working on implementing A* to my bot for the killbots competition. This was extremely interesting and beneficial, as the bots are written in C++, and I am still new to it, so trying to create the A* was a great learning experience.

First I watched a few videos to get the concept of it. It make a lot of sense after watching those videos, and I was super keep to implement it. To begin, I had to get the map details and store them in an array somehow. I decided to keep the whole map in the 1D array rather than a 2D array. This means to access the tile at X and Y, I would have to do mapArray[(Y * mapWidth) + X)] rather than mapArray[x][y]. I chose this method as 1D array are faster as all the data is store in memory next to each other whereas the 2D array has it’s memory in different places.

Next I created a Node class which is used to store the G, H and F values of the node. This made it easy to store those values. Originally I had an idea to keep the values in an array in the main class, but as fast as I had the idea, I dismissed it as being a silly one.

I had a function called GetPath that would return a vector or all the nodes (in reverse order) that the bot must travel to reach it’s destination in the shortest amount of tiles. Once the check was complete, I would then move the bot to the last tile in the vector because of the reverse order, and once it reach the tile, it would remove it form the vector until it’s destination was reached.

During development, I ran into many, many problems, including iterator problems. I was really struggling with removing elements while iterating (which I know now is not a good idea!), so I sought out other solutions. One extremely helpful solution is the following:

 

for(auto &a : vectorArray)

{

a->doStuff();

}

 

This allowed me to loop through a vector, do stuff to each element and even remove from the vector without any hassles. This is perhaps the biggest win from the whole endeavour.

Another problem I encountered in the maze is my bot wanted to travel through corners.

NoGo

 

This is obviously undesirable behaviour, so I had to come up with a solution. To counter this, I did extra checks for diagonal tiles. I would check if there is a block obstructing the way, and if so, then close the tile as it’s not a viable option. This has worked well and my bot mostly avoids the walls now.