tag:blogger.com,1999:blog-84685883598555163652024-03-13T17:44:36.945-07:00Jacob EllenbergJacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-8468588359855516365.post-78756003217524619162015-03-31T09:20:00.003-07:002015-03-31T09:20:53.588-07:00Blob Game Physics Project<div class="separator" style="clear: both; text-align: center;">
<iframe width="320" height="266" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/nhStRNh9LKk/0.jpg" src="http://www.youtube.com/embed/nhStRNh9LKk?feature=player_embedded" frameborder="0" allowfullscreen></iframe></div>
<br />
This project was built off a previous physics project discussed <a href="http://jacobellenberg.blogspot.com/2015/02/solar-system-simulation.html">here</a>. So I already had some of the basics of a physics engine such as a physics object. The goal of this project was to create some sort of game using contacts, rods, cables, bungees, springs and mass aggregates. The first step was to create the contact system. This allows for contact generators to generate contacts and then a contact system to go through and resolve all of the contacts. For this game I went with a simple implementation of resolving the most important contact until all contacts were resolved or the loop went over the initial amount of contacts times two. From here it was time to create actual contact generators. The first one being the ground contact generator. This simply created a contact if the physics object went past a certain y value. With the ground contact it was important that our contact system handled something called a resting contact. We determine this by checking if velocity has changed. Once we determine it is resting we cancel out the velocity effects of the contact preventing the physics object from vibrating. That is pretty much all there is to the basics of contacts.<br />
<br />
The next step was implementing the rods, cables, springs and bungees. This was pretty simple because we went over this in detail in class and had code examples in the book and the slides. From here we used rods to setup our mass aggregates. This was interesting because you had to be careful how you connected your rods or the object would not do what you expected. For this project I created a cube, a pyramid, and a tetrahedron.<br />
<br />
Now that all of our physics was setup it was time to make the game. The first thing I did was add simple player movement to the player adding force in 4 directions based on WASD. Next I added a bungee cord to the camera and the player. I was able to get a pretty clean effect using a bungee cord over a spring and a significant amount of dampening. Without these tweaks a spring attached camera does not work very well at all. After the camera was working I decided to add collectibles and make them data driven. I made it so when you got into a certain range of a collectible it would attach a cable between you and one of the physics objects that was part of the collectible shape. When a lot of objects are attached to the player it can be tricky to move around the game but that is just part of it.<br />
<br />
Finally I decided to create a simple enemy AI. Once the player gets into a certain range of this AI it starts to follow the player. If it gets close enough it attaches a spring between the player and the AI. It then runs away from the player until it reaches the edge of the map. This makes it harder for the player to collect the objects needed to win the game.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-2218751817029507642015-02-19T05:59:00.002-08:002015-02-19T05:59:50.462-08:00Two Brothers Iteration 6The first thing I worked on this week was a node graph generator. This creates a node graph with all of the connections that our AI needs to path-find effectively. The first step in this was creating the nodes.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqo57FFgs52UAE5yvHSqLS8RHE1-e3QDb2ieC2E_lOOjtuERCLdQCmrkI9-9KV6DqgSWC0KgFXX1Ldolwc-nMt03NdnKZTpzLfrwsKjNe2sSPOrGL1PbflzlAWBaGW3Xa0iK1-Tpnxpx8L/s1600/CubeGeneration.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqo57FFgs52UAE5yvHSqLS8RHE1-e3QDb2ieC2E_lOOjtuERCLdQCmrkI9-9KV6DqgSWC0KgFXX1Ldolwc-nMt03NdnKZTpzLfrwsKjNe2sSPOrGL1PbflzlAWBaGW3Xa0iK1-Tpnxpx8L/s1600/CubeGeneration.png" height="318" width="640" /></a></div>
<br />
The above image shows my first generation attempt. Here I displayed cubes on the nodes for viability. Basically what I did was given a start point, size, and distance between nodes create nodes in all directions based on that distance until we've reached the size. The next step from here was creating the connections.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRtT-z4nUhIFt8UyfE1AeqplzoG67UVCPc4gbA_GYSWIN_e3ewtRSHOuY_xkBFM-ZRWMcx6UvKMQAl1YCP8jxCo30AoyRhSeArzFsOgwzbH8u5lIkLsJTLR9CxrUi-WSBuAuWYAPmoiivm/s1600/CubeGenerationWithConnections.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRtT-z4nUhIFt8UyfE1AeqplzoG67UVCPc4gbA_GYSWIN_e3ewtRSHOuY_xkBFM-ZRWMcx6UvKMQAl1YCP8jxCo30AoyRhSeArzFsOgwzbH8u5lIkLsJTLR9CxrUi-WSBuAuWYAPmoiivm/s1600/CubeGenerationWithConnections.png" height="374" width="640" /></a></div>
<br />
The way I created connections this week was to check each possible adjacent position and check if there could be a valid connection. This method works but after doing some testing I think it would be good next week to try to connect to all other nodes rather then just the adjacent ones. In order to determine if a connection was valid I did a ray-cast from node to node to make sure there wasn't any collisions in between the two nodes. This still wasn't enough to assume all nodes were valid.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIQvxyinEWbc2miRPT1PotAVKq4rMUSTQMvvO7M-23NRqN9ukJLKxhzGboEPp0_rxRW3_OX5TfDl68vx0wb6O1QAoqeUsmlfFkvSqsN26j9j1Eru90Lh4UKqjEttSJ6zob_46xX3zBz26G/s1600/ConnectionsGeneratedWithPaths.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIQvxyinEWbc2miRPT1PotAVKq4rMUSTQMvvO7M-23NRqN9ukJLKxhzGboEPp0_rxRW3_OX5TfDl68vx0wb6O1QAoqeUsmlfFkvSqsN26j9j1Eru90Lh4UKqjEttSJ6zob_46xX3zBz26G/s1600/ConnectionsGeneratedWithPaths.png" height="390" width="640" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
I cut down on the nodes and connections even more. On creation I added collision box to the nodes and destroyed them if they collided with anything. And after all the connections were made I took the node closest to the start and checked if every other node could path to it. If the pathing failed I destroyed the node because it was invalid. This ended up creating the picture above of a much more reasonable node graph.<br />
<br />
You might be wondering at this point how it would be possible to do all of these calculations during the game. Well you can't; it took up-to 30 minutes to generate some of these graphs. Fortunately after the graph is generated I can just pause the game and save the graph as a prefab. This way we can generate the graph for each level before hand and not have to worry about any creation time processing. <br />
<br />
Now that I had my node graph created it was time to write the AI to follow it. I added path following to my AI control and created a wonder AI. The wonder AI just choose a random node and pathed to it. At first this caused lag issues on pathing but I optimized the path finding function a bit and limited the path length because there was no need to wonder to a specific point 100 nodes away. This fixed all of the lag issues. The AI still was running into everything and dying constantly because it did not do anything to avoid the trails or smaller obstacles.<br />
<br />
So then as intended I knew I had to create some avoidance AI. I created rays in-front, above, to the left, and right of the player to check where obstacles were. In the event that an obstacle was in-front of me I checked for an open direction. I then avoided in that open direction. Once the opposite of the direction I avoided in was open I went back to what ever I was doing before. After a lot of tweaking of numbers and playing around with I got something I was happy with, for a start.<br />
<br />
Finally I played around with actually being able to get the flag. The way this worked was I would path find to the flag until I was within a certain distance. Once I was within this distance I would just go strait for the flag. Once I got the flag I would just wonder. This worked well enough for getting the flag once but the AI was not able to pickup the flag again because his trail was in the same spot that he was aiming for making it impossible to avoid. This is something to workout in the future but overall I was happy with this weeks progress.<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-21562451933852203352015-02-17T07:19:00.000-08:002015-02-17T07:28:43.715-08:00Solar System SimulationMy first game physics project was to create a solar system. This is a simulation of our solar system including the sun, 8 planets and the earths moon. Here is a video of the finished product.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/x_39ve1lNtE/0.jpg" frameborder="0" height="266" src="http://www.youtube.com/embed/x_39ve1lNtE?feature=player_embedded" width="320"></iframe></div>
<br />
In order to create this the first step was to create a physics system. The first part of this is just a basic physics object. I used euler physics for moving objects to make the calculations simpler. This works but it does leave inaccuracy that can affect the simulation. After adding the physics object it was important to add forces. The way I did this was have force generators, in this case a gravity force generator, that would be registered with each object pair. In this system each planet is registered with all the other planets. This allows gravity to affect everything the way we would expect. Once this system was done I needed to figure out the actual values I would use to setup my planets.<br />
<br />
I used the <a href="http://en.wikipedia.org/wiki/Orbital_speed">precise orbital speed equation</a> to figure out the planets initial velocity at the perihelion. I also looked up the values for each of the planets perihelion and placed the planets at those distances in AU. These calculations worked reasonably well for the sun and 8 planets but unfortunately this was not the case for the moon.<br />
<br />
At first I thought that looking up the initial velocity of the moon would work. Later I figured out that it would need to be the combination of the velocity of the moon and the earth because the value I had looked up was relative to the earth and not the sun. Even this value did not work as expected, the moon would constantly get further away from the earth. This could be due to various inconsistencies within the system that were not easy to fix. Because of this I just played with the numbers until I got a moon that orbited reasonably around the earth. The values I have now allow it to orbit around the earth for a good amount of time but eventually it will still leave orbit.<br />
<br />
Another challenge was choosing the sizes for all of the planets. What I ended up doing was having the sun be way smaller then it would be and have all of the other planets be relative to an arbitrary size for the earth. This was the only way the planets could be viewed in relative sizes and still us AU for distance. This allowed me to setup my camera to view all of the planets while still keeping some relativity. There is an issues with the moon, however, because it is so close to the earth it appears to be inside the earth because of the scale I used. This scale was not a perfect solution but I think it was ideal in showing off what I wanted to show off.<br />
<br />
<br />JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-58536646231638292852015-02-13T08:00:00.000-08:002015-02-19T05:41:12.406-08:00Two Brothers Iteration 5This week I got the start of the AI working. I got a ship simply able to move to a point. I do this by finding the direction between the ship and the desired point and rotation towards it. I make sure to take the ship mobility into account so that it moves within the same constraints as a real player. I also started writing my A* path finding algorithm which will allow me to navigate the node graph.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-82053424318393538402015-02-06T05:39:00.000-08:002015-02-19T05:39:32.608-08:00Two Brothers Iteration 4This week I spent primary on researching the AI. What I am thinking right now is using a node graph to allow the ships to navigate the map. This way they will intelligently move around big structures and obstacles before even getting close to them. On top of this I want to add a avoidance algorithm that allows the ship to avoid things that are right in front of him. The combination of these will hopefully leave to a ship that is able to navigate the map without instantly dying.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-11731096311312804232015-01-30T19:03:00.000-08:002015-02-19T05:36:31.014-08:00Two Brothers Iteration 3Last week I spent a good amount of time working on the networking systems for the game. I integrated networking into the split screen selection system. This way players could join and see each other choose different colors and y-axis inverted over the network. I also spent some time working on the network initialization of players, sending inputs over and working on the movement of the player ships. I was getting close to a point to start showing the basic networking aspects but during yesterdays class we decided networking would not be worth it given our resources. As much as I enjoy networking I agreed with the reasons not to do it. Instead I will start to look into creating AI for the ships in the upcoming weeks.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-24873749472740802562015-01-22T07:24:00.003-08:002015-01-22T07:24:37.827-08:00Two Brothers Iteration 2This week I started working on the networking aspects. At first I had some trouble just testing the build because I do not have a controller and there are no keyboard controls. Paul said that he was going to work on adding them this week. Because of that I spent the first week getting a feel for the code base and creating the background systems for networking such as the lobby system. Given this start it seams reasonable that I will have prototype networking up and ready two weeks from now.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-85397322229008574342015-01-16T07:19:00.000-08:002015-01-22T07:19:51.023-08:00Two Brothers Iteration 1This is the first week I will be working with my new team, Two Brothers. Here is a video of what they had at the end of last semester.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/obgXjQtVYlw?feature=player_embedded' frameborder='0'></iframe></div>
The first thing my team asked me to do was look into weather or not networking is reasonable. There are some definite challenges given the nature of this game. Such as important twitch movement and having trails work over the network. I'll talk with lawson and keep these things in mind to see if it is reasonable.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-68575372344454941492014-11-13T08:56:00.003-08:002014-11-13T08:56:55.733-08:00Screams From The West Iteration 7This week the main thing we wanted to focus on was getting rid of the gun without getting rid of the gun. We felt that the gun was taking over the game in a way we did not want. When someone saw our game they saw it as a shooter more than anything else. We wanted the gun originally to be a side mechanic but there were a few things preventing this from happening.<br />
<br />
When you first started the game the first thing you saw was an aiming reticle and the ability to shoot. This instantly told our players, hey you should be shooting things. Another thing was that we punished our players for having the lantern out. The lantern provided more light so we said it should burn fuel constantly. This lead to forcing players to have the gun mode out 90% of the time. This, along with spiders roaming around, made it very clear to the player that they should be using the gun as their primary mechanic.<br />
<br />
In order to make our game not a shooter we made a few changes this week. We increased the crowd control abilities the player could use on the spiders. We also removed the constant drain of the lantern so that players could keep it out as their primary weapon. We added an investigation state where the spiders stop attacking players to investigate sounds they have heard. We also made the game start with the lantern out so the players would feel that it is more about the lantern then the gun.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/8VLMW0KT16w?feature=player_embedded' frameborder='0'></iframe></div>
<br />
The above video shows the increased crowd control I made for the spiders. When the player uses the lantern the spiders now get dazed and then stunned. While dazed they move in random directions for a random increments of time giving a very confused look. It took a while to get these values to look good but in the end I thought it came out nice. The other thing we added is the torches and flares now also stun the spiders. When the torch first gets planted any spiders near it will get stunned. When the flare hits the ground all spiders close to the flare will get stunned. This will give the player more options when trying to escape the spider.<br />
<br />
The video also shows briefly the throwing of a glass bottle. We did not have an art asset for this yet so it is just a small rectangle. What it does is that all spiders within a certain distance go towards where it landed. Once they get close enough they resume normal action. We also made a similar thing happen when the player shoots. This will give players more options on how to manipulate spiders out of the way of their objectives.<br />
<br />
We felt this was a good step forward but at the end of the week, after our presentation we decided more still could be done. As it is currently the gun still kills the spider. We decided that this was not the feel we wanted so we are planning on changing it so that the gun also just stops the spider briefly like many of or other effects.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-40032902020396382342014-11-06T08:35:00.000-08:002014-11-13T08:36:16.815-08:00Screams From The West Iteration 6This week the first thing I wanted to do was stabilize the networking. Last week I got basic functionality working, which was great but there was still a lot to be done to get the complete network experience. Kyle was able to quickly get it into testing and get me feedback on what wasn't working. I already knew most of these things were not done but it was nice to get a list of things that did not work.<br />
<br />
So I spent most of the week fixing these bugs. This included things like making replay ability. In order to do this I had to make sure that anything that was created or could be destroyed during game play was destroyed at the end of the game. I also had to make sure things that needed to be there that could be destroyed such as pick ups and egg sacs were created at the beginning of a match. This was the most challenging part, the rest of it was just bugs that took some debugging.<br />
<br />
After this I wanted to add another goal to show off what we wanted to do with procedural generation. What we decided would be good to add was collecting gold because this would be simple and still show our intentions. There are a bunch of empty game objects around the map where the gold can spawn. The amount of gold that spawns and the amount required are dependent on the number of players. I also made it so the egg sacs spawn at random preset locations and the number of them dependent on the number of players. Later both of these will also depend on difficulty settings.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-42896478486859780432014-10-30T15:35:00.000-07:002014-10-30T17:21:56.296-07:00Screams From The West Iteration 5As said in the previous post the big challenge for this week was adding networking. I started out by researching and re-factoring the code. I wanted the code to be in the best state it could before starting to add networking aspects to make the process easier. Once I had cleaned up the code it was time to think about how I was going to network the game.<br />
<br />
I continued researching on what would be the best way to network my game. In the past I have done peer to peer in both Pew and my Game Networking class. I could have done that here but synchronizing the state of possibly a large amount of spiders could be dangerous using this method. If I were to have the host do this, the easiest way, then it would be way too much upload bandwidth for one person to handle. I later figured that I may have been able to split this work on multiple machines but this could be tricky. I decided that I would try to go with an authoritative server based setup. This way all of the spiders action would be handled on the server and sent to the players. The way an authoritative server works is the players send only their inputs to the server and the server sends the game-state to the players. This is also good because it prevents the possibility of cheating. In peer to peer you are often sending information such as position and damage and health, that all can be hacked into and changed, causing cheating to be realistically easy. With the server, however, sense the only thing being sent is inputs that means they can only change what our inputs allow them to change. This makes cheating much less severe and problematic. Another reason I wanted to do a server based system was that I never explored that way of networking before and wanted to do something new.<br />
<br />
So great I figured out I wanted to do server and had all the right reasons to do it. Of coarse now I had to actually implement it. I started out by getting the basic connection working looking what I had done in production 2. I got this working after spending some time trouble shooting. Once I got that working I started implementing a menu system that is essential for a networked game. I decided sense there were going to be many things shared over these screens that I would create a base screen class for all the other menu screens to inherit from. This base class had information such as the back ground texture, various font/style information and positions for constant aspects such as the back button. This allowed me to create a menu manger that switched through these screens easily.<br />
<br />
The next thing to do was to get the players in the game spawned and moving. I created a spawner class that had the server use Network.Instantiate on all of the players. That way the server owned all the players and was the one to synchronize their state. I created a class inside the player that held a string id that was unique to each player. This way it was easy to tell still which player was local on the client machines. I created a player input manager that held a dictionary of all player inputs on the server. The clients would send their input on change to the server and the server would save the most recent inputs. This way when I wanted to use inputs in other classes I would reference the most recent inputs from the input manager for that player. On Saturday I worked on this and the player movement so I could see the inputs doing something. I spent a while debugging it but I could not figure out why the inputs were not being correctly sent over. After a spending maybe an hour of debugging without results I decided to stop for the day and continue tomorrow. At this point I was not sure if I had been pragmatic about what I could do; was it really possible for me to network this in just one week?<br />
<br />
The next morning I woke up early and decided that regardless of weather or not I can get it all working I wanted to keep trying. I figured out the bug that was haunting me the day earlier in like 30 minutes. From here I gained a huge amount of excitement. I was starting to believe that I could do this, which motivated me to work hard and stay focused for most of the day. After I got the player movements working I worked on networking the spiders. To do this I had the server sent over the position and rotation values of the spiders. On the client I used lerping to make it the values look smooth. I also just had to make sure all of the AI still worked as expected. The next challenging part was getting the projectiles to work.<br />
<br />
I ended up doing a bunch of prediction to make the bullets work right. The first form of prediction I did was when I first got the input there was an amount of time it took to get that input. I predict where the bullet would be if it fired when he did the click. I then use a raycast to see if it would have already hit a spider. If it would then I don't fire it and just destroy the first spider hit. Otherwise I fire the bullet and send information to the clients about its initial position and velocity. Then on the client side I predict where the bullet should be given the amount of time given that information and set the velocity to the given velocity. From here I let the clients do the rest of the physics calculations because the velocity is constant. There is very little possibility for the projectiles to become not synchronized here but it is possible. As with almost all networking perfection is not a the goal, its getting as close as you can.<br />
<br />
From here it was just making sure to handle all the little networking aspects I needed to handled. There is a long list of those things so I won't bore you with the details. All in all I got the basic functionality down and I was happy. We presented yesterday and everything worked as expected. Kyle also brought the game to testing last night and from what I heard about it there were no bugs that I wasn't aware of. This was a pretty big accomplishment for me to do in a week. I worked hard and it definitely payed off.<br />
<br />JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-71652056464962067712014-10-22T17:07:00.000-07:002014-10-29T17:07:19.716-07:00Screams From The West Iteration 4<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
This weeks main goal was to get the game and the rest of the team ready to present for stage 2. We had previously discussed having a melee mechanic and jumping spiders but had never fleshed them out. This week we decided that it was important to our game so we decided to add them.</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/fyPexsFm8nw?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />The first mechanic I worked on was the melee mechanic. As you can see in the video above, I create a cylinder in front of the player and swing it. When it collides with the spider, it pushes the spider away from the player. This seamed to work pretty well for what we wanted.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/AALVc6dpF5A?feature=player_embedded' frameborder='0'></iframe></div>
<br />
The next thing I worked on was the jumping spiders. I have it so when a spider gets in range of the player he jumps at him. After that he just chases the player as before until he gets far enough away to jump. This made it harder to get around spiders in buildings making the game more challenging and fun.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/XR9Mqv5eKKE?feature=player_embedded' frameborder='0'></iframe></div>
<br />
I also made a full game play video to show off the current state of the game. In this video I already knew where the egg sacs were so I ran through it quickly. This was just so I could show all of the game play in a reasonable amount of time. We used this along with a video of each mechanic during our presentation.<br />
<br />
<br /><br />
<div>
Our presentation went really well. They said that we passed as long as all the documentation is in order. Because of this we decided to proceed with this next week as if we passed. One thing brought up during the presentation though was the fact that we wanted to do multiplayer. Professor Ferguson questioned the need for multiplayer at all so during our meeting we discussed it. Ryan played the devils advocate but we decided that the journey we went through with our previous games was really about the cooperation aspects. Because of this we felt that we would not be doing our team justice to ignore this aspect. So we decided we wanted to do it but with time running out the team asked if I could get it basically working this week. At first I was caught pretty off guard, even though I knew it was coming to a close, I wasn't fully aware how much time we had left. I told the group that I wasn't sure if I could do it. The response was for me to try my best this week and if I was unsuccessful then we would just do single player. I am already starting to reformat my code and research what networking practices would be best for our game so I will let you know in next weeks blog how I do. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-61900214140665973622014-10-15T05:46:00.000-07:002014-10-15T05:46:10.130-07:00Screams From The West Iteration 3This week I added secondary mechanics such as torches and flares, and looked into more AI elements. We now have a flare that allows the player shoot something and see further then he ever could before. We also have a torch that the player can place to have a place permanently lit.<br />
<br />
I improved the wandering AI. There was a bug in the AI that was causing the spiders to mass in the center causing distress for the players. I looked into this and now it seams that the spiders wander all over the map equally making the mass of spiders much less likely.<br />
<br />
I looked into how I could do walking on walls/ceilings with the current AI system I was using. It turned out not to be possible with unity's navmesh system. There is a strict limit on the slope for navigation meshes so it is impossible to go strait up walls. I talked to Lawson about this during my discipline review. He suggested just to involve simple iterations with walls if we want to do stuff with walls, such as going strait up to a window rather then path-finding around the wall. Based on the feedback of my group though, this is not a huge thing and can be looked more into later in development.<br />
<br />
I also started working on a jumping attack. I am currently doing all of my spider movement using unity navmeshagent. This does not allow me to tell the spider to jump. Because of this I will attach a rigidbody temporarily to do my jump physics and remove it to go back to AI after the jump is complete. When I was working on this yesterday I was unsure of how the jump sequence should happen so I talked about it in our team meeting. We decided that we would have the spider jump towards the player a a certain distance, and when it hit something it would stop moving in the horizontal direction and just fall strait down. If the something it hit was the player it would do damage. We also discussed having an animation for the initial jumping off the ground, in the air, hitting the player, and landing.<br />
<br />
We were originally planning on presenting for stage 2. At the end of the week we all agreed, however, that it would be better to give ourselves some more time. For stage to we are supposed to demonstrate our core experience and I did not feel we were there yet.<br />
<br />
We had talked about definitely wanting some sort of melee system but we have yet to jump into what that exactly entails. We talked about having it not do damage but just knock enemies back. Regardless of what we decide to do with it, I think it is a core part of our player experience.<br />
<br />JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-14541927202748632702014-10-08T05:34:00.000-07:002014-10-15T05:46:24.023-07:00Screams From The West Iteration 2So this week we decided that we wanted a complete game flow. That meant having a start screen, a win state and a lose state. I decided to just take the egg sacs that we currently had in the game and make them destructible for the player.<br />
<br />
Another thing I looked into was adding an aimer for the player. The way this works is I put an image in the center of the screen to let the player know where he is aiming. From here I do a raycast from the camera point out 300 units into the world. If it doesn't hit anything then the bullet travels in the direction from the player to that end point. If it gets interrupted by ground or spider it goes in the direction of the player to what ever the ray hit. This allows for the player to aim reasonably in a 3rd person view point.<br />
<br />
At the end of the week we were able to implement sound. There is a sound for the player shooting that has a reloading sound in it. Because of this I decided to add a delay on how often you can shoot to better match the sound. There is also sound for when you are out of ammo and take damage. The spiders make a walking noise as well as an aggressive noise when they detect you. This allows the player to be more aware of when things are going after him/her.<br />
<br />
Overall I felt we made good progress this week. The sound added a lot of feeling to the game.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-18203780730981814832014-10-01T16:44:00.004-07:002014-10-01T16:44:53.613-07:00Screams From The West Iteration 1So as discussed earlier we decided that the asymmetric multiplayer wasn't really going to work for this project. So what we are thinking now is 4 networked players working together to complete goals in a town overrun with spiders. These goals would be procedurally generated so that the game play would be different every time. Some examples of goals would be saving towns people, destroying the egg sacks, and collecting a certain amount of gold. The player would do this with limited resources starting out only with a few bullets in a gun and a lantern that requires oil to work.<br />
<br />
In our current prototype we showed off some of the basic mechanics. This includes having a weapon, a lantern and enemy spiders seen in the last prototype. It has been changed to feel darker and more vast and the lantern also now gives the ability to stun.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8fzJ92s6SHYWlQ5mwNuLJvzmJ9OfTaBnxhKAV6KcDsxKy59lZRgxDZMA4ylKRiwA71i_dX-LjfuhfqCrcmK5LoAYPej3h_sdajH_IUc9AvR9cNBUSEJTF_2BJOqkLh1uzzuvLVXzk45Hv/s1600/ScreamsFromTheWestSpiderStun.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi8fzJ92s6SHYWlQ5mwNuLJvzmJ9OfTaBnxhKAV6KcDsxKy59lZRgxDZMA4ylKRiwA71i_dX-LjfuhfqCrcmK5LoAYPej3h_sdajH_IUc9AvR9cNBUSEJTF_2BJOqkLh1uzzuvLVXzk45Hv/s1600/ScreamsFromTheWestSpiderStun.png" height="360" width="640" /></a></div>
<br />
Here the spider gets stunned and turns red to let the player know. This will soon be changed to an animation that lets the player know but this was easiest for now. The stun has diminishing returns that last up to 5 seconds and max out at three stuns. The collisions for the stun is not ideal at the moment because I am using a series of ray-cast so that it only hits the first spider rather then all of them. I will improve on this in the upcoming week.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVGpJpUkyWR4MztTtln6F14uay2x4HaGM0CYYmWb74DjRWc7TO3U7QjnDdqWOxvef6T9MhT4OBJ50PPoP2dcwRbNIazUKrW9PJJC30fHrQbJpvCZ-oLPQPvMLeMM57awxxrPLi0HTs7pc4/s1600/ScreamsFromTheWestPlayerShooting.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVGpJpUkyWR4MztTtln6F14uay2x4HaGM0CYYmWb74DjRWc7TO3U7QjnDdqWOxvef6T9MhT4OBJ50PPoP2dcwRbNIazUKrW9PJJC30fHrQbJpvCZ-oLPQPvMLeMM57awxxrPLi0HTs7pc4/s1600/ScreamsFromTheWestPlayerShooting.png" height="360" width="640" /></a></div>
<br />
This is a screenshot of the player shooting. As you can see the radius of the circle around the player is larger here then it is when the player is using his lantern. The thought behind this is that the players eyes would adjust to be able to see around himself more than when the lantern was out. The bullet is also lit so the player knows where their bullet goes.<br />
<br />
Right now I am using the unity navigation system for the spider AI. This works fine for the prototype but if we want to go further with the AI I will probably need to make my own system. We are thinking of having different spiders that climb on walls and drop from the ceiling. These sort of systems probably won't work using the unity navigation system. This AI would add a lot to the game and is of a decently high risk. Because of this after adding a few more systems to make the game flow complete I will probably be prioritizing the AI.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-18495796479128368002014-09-24T15:58:00.000-07:002014-10-01T15:59:02.599-07:00Asymmetric Survival GameThis week we decided to explore an asymmetric networked multiplayer game with a horror theme. I enjoy playing competitive games and have experience making asymmetric multiplayer games with pew. Ryan and I were both on that team so we are slightly hesitant towards this idea because it is close to something we had already done before but at the same time it could still be different enough to be fun to make. In the prototype I made you can switch between both sides of controlling a giant spider and controlling a human. In the full game there would be multiple humans fighting against a giant spider player.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFOO_0acPk4lAU8IakMT3UqLCrU3cuVACj6MArWKclfreWRri2oTHblUDndPAjKmbR4G_V-f6ysZwSP3kEY_t2XYjZi1E3jzwQ8F1rKyGHUexFEL8eWmwXKMStIxnI9cBo1dNepDlpCwjp/s1600/Asymetric+Multiplayer+Spider.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFOO_0acPk4lAU8IakMT3UqLCrU3cuVACj6MArWKclfreWRri2oTHblUDndPAjKmbR4G_V-f6ysZwSP3kEY_t2XYjZi1E3jzwQ8F1rKyGHUexFEL8eWmwXKMStIxnI9cBo1dNepDlpCwjp/s1600/Asymetric+Multiplayer+Spider.png" height="358" width="640" /></a></div>
<br />
This is a screen shot of the giant spider laying an egg sack. Egg sacks spawn a smaller spider every ten seconds. The only mechanic currently worked out for this character is to lay these egg sacks. We have other ideas such as setting up webs as traps but those are not fully thought out yet.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio6tb8qhIKHypndGSAp974UGRwnXGNrHQrLizY7F-sFDHT22ZsCutZZPPhFFHHlbRw08pHQnjMdoexEwAynS2rM-UeZsym0fkP-If9monifCR0jJtwoXufcU8ohzpq66WBI7clgzJgbNgI/s1600/Asymetric+Multiplayer+Human.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEio6tb8qhIKHypndGSAp974UGRwnXGNrHQrLizY7F-sFDHT22ZsCutZZPPhFFHHlbRw08pHQnjMdoexEwAynS2rM-UeZsym0fkP-If9monifCR0jJtwoXufcU8ohzpq66WBI7clgzJgbNgI/s1600/Asymetric+Multiplayer+Human.png" height="360" width="640" /></a></div>
<br />
This is a screenshot of the human fighting off the horde of spiders that the giant spider just created. It is night time for this player so he has a lantern. He also has a gun with limited ammo at the moment.<br />
<br />
Though we had fun with the conception of this idea I think we are starting to lean away from asymmetric multiplayer. One of the major issues with this idea is that it would rely heavily on the spider player knowing what he is doing for the game to play correctly. In the setting that this would be played the most, the QA labs, the players will be new to the game. It may take 3 games or so for the spider player to get it and during that time the other players aren't enjoying or truly testing the game. And by that time he will have to switch to a different game or role. Because of this and a few other reasons we have decided to take the game as a multiplayer coop against spider AI that I will get more into next week.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-47385586431484966822014-09-17T14:23:00.000-07:002014-10-01T14:38:58.574-07:00Magnetx Prototype 2This week we decided to further explore Magnetx. The two main things I added to the prototype is having the magnet powers lock onto magnetized objects and adding basic blocks to push and pull.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwgAGfzXlYW_-431iK-K59cjtGm2DXVpehEI1yM0eU4kHfMO6FhVssb0P-Mfye525S7drx_15W-ySxxUc3eJR4Lvr74nKtmmMVsLcT7aXDQ1IAnb4PxecJphD2GPD_HXrbUPhhfvU3xmDo/s1600/Magnetex+Prototype+2+Pulling+Block.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwgAGfzXlYW_-431iK-K59cjtGm2DXVpehEI1yM0eU4kHfMO6FhVssb0P-Mfye525S7drx_15W-ySxxUc3eJR4Lvr74nKtmmMVsLcT7aXDQ1IAnb4PxecJphD2GPD_HXrbUPhhfvU3xmDo/s1600/Magnetex+Prototype+2+Pulling+Block.png" height="297" width="640" /></a></div>
<br />
This is a very simple mechanic of being able to pull and push blocks within the environment. This would later be used to solve puzzles.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwwXIUEA1d3478Rka07sNuMqZVIAO2ieBmPXnLQgHVacgwqUf2CcjCbspGJa2xMDvfakrY2cG-TGnmriVwxLh31ql7qyRYGELmPURZ1FcY-aMf7jtH78UG0Iz29JwqtyIa12RcPfO5HzkT/s1600/Magnetex+Prototype+2+Locked+On.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwwXIUEA1d3478Rka07sNuMqZVIAO2ieBmPXnLQgHVacgwqUf2CcjCbspGJa2xMDvfakrY2cG-TGnmriVwxLh31ql7qyRYGELmPURZ1FcY-aMf7jtH78UG0Iz29JwqtyIa12RcPfO5HzkT/s1600/Magnetex+Prototype+2+Locked+On.png" height="304" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: left;">
The way this locking on mechanic works by using what we had before and adding a lock on target effect. Once you hit a magnetized object the magnetized rays point towards the point that they hit regardless of where the player goes. This gives sort of a grappling feel. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
This grappling feel was definitely very fun and could work in our platform puzzle environment but the problem is that it starts go away from the realism of magnetization. Mechanics such as this could be fun in a platform puzzle but don't represent how magnets really work. So we have to ask ourselves if we were interested in the mechanics or the realism of magnets.</div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-6092085529853865202014-09-09T19:16:00.002-07:002014-09-09T19:16:22.153-07:00Stealth Kids GameThis week my team decided to explore a co-op stealth game. The setting of this game takes place in a 1950's house. The main characters are two kids that are trying to sneak cookies without their parents knowing. This week I made a basic game play prototype to show off the kind of mechanics we would have in our game.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUSNY60kGRzwSBQpoPr6N2lXnsR5_OhuvG3Um4WhHYoAWi_4SoKSe2gXUlk8jADUmX3vJuMzY3v8Gne6hyueSkRBooDsc6YHUFqUG0kytlMvV9JeKd_esLMV2KOVYybhjeruwotONBnbAp/s1600/Parent+Cone+Uninterupted.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUSNY60kGRzwSBQpoPr6N2lXnsR5_OhuvG3Um4WhHYoAWi_4SoKSe2gXUlk8jADUmX3vJuMzY3v8Gne6hyueSkRBooDsc6YHUFqUG0kytlMvV9JeKd_esLMV2KOVYybhjeruwotONBnbAp/s1600/Parent+Cone+Uninterupted.png" height="301" width="320" /></a></div>
<br />
<br />
An interesting part of what I did this week was my detection implementation. The initial goal was to create an accurate cone of vision for the parent. I decided that an easy way to do detection that would not see through walls would be to use Unity's line-cast or ray-cast systems. So I created an object that would take a start point, an angle, and a distance for line casting. It also had a line render attached to it so that the detection could be displayed. From here I wrote a generator script that took in an angle range and a transform and then created these line renders around the given transform. In the picture above I have a parent with a range from 0-70 degrees creating a cone like shape of vision.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwHH4bYRoyHF_cON8PyvBNkMRr6CqWtmO18uOG8dprEn11gtCnUVIqzrkgizjZ8hHVZuCagCcZR4JFjaZ-ESezaGZ084NfH-PONfQ43TVpabAJ9Qj8H4IXKc4j-rY7OX8gbzvIAUoQYb9s/s1600/Parent+Cone+Interupted.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwHH4bYRoyHF_cON8PyvBNkMRr6CqWtmO18uOG8dprEn11gtCnUVIqzrkgizjZ8hHVZuCagCcZR4JFjaZ-ESezaGZ084NfH-PONfQ43TVpabAJ9Qj8H4IXKc4j-rY7OX8gbzvIAUoQYb9s/s1600/Parent+Cone+Interupted.png" height="306" width="320" /></a></div>
<br />
In this second picture the kid is in range of the parent but is not detected because the line-cast does not go past other objects.<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-41648161701564036472014-09-03T13:37:00.000-07:002014-10-01T13:40:18.853-07:00Magnetx Prototype 1<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The first game we're looking into doing for senior team is a game called Magnetix. In this game you play as an electromagnet in a puzzle platform environment. We have ideas of exploring magnets and different things that magnets can do too add to the fun of this puzzle game.</div>
<div>
<br /></div>
<div>
For this first week though I created a prototype that shows off the base mechanic. This prototype has attracting and repulsing abilities for the player. In order to do this I first had arms that rotate around a single axis. From here the player could left/right click and shoot out attraction/repulsion lines in the direction the arms are facing. This was done by simply adding force relative to the direction the arms are facing.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj84qnq6nqOk4p2yQCB4S0Y-3x_hPgZI6xCt4jGwul7CfvUICqG-HTq-1saYicDwsUv91tSWnfk_Eo0cbBlWEGUXbRUQJU3KL9qv096YnikLAlnM7xdz_FLGYcO1-n_6oC_0C68X4vHbZtE/s1600/Magnetex+Prototype+Pulling.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj84qnq6nqOk4p2yQCB4S0Y-3x_hPgZI6xCt4jGwul7CfvUICqG-HTq-1saYicDwsUv91tSWnfk_Eo0cbBlWEGUXbRUQJU3KL9qv096YnikLAlnM7xdz_FLGYcO1-n_6oC_0C68X4vHbZtE/s1600/Magnetex+Prototype+Pulling.png" height="225" width="400" /></a></div>
<div>
As you can see in the image above the attraction lines can be used to move the player towards objects. This can be useful to get to higher platforms.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsF7fUva4wFGHg3eAbpz_hXwzh7FN8isUr1JJMtjDjMzm-P080s5DmachaIOnb64ewZZTnk67Q7lpe0bZOg0hEOTYv7uGaaclOwi-HEGNKFLvKKYkVVJ3pkEqw-jvys3SjGUIWTrRdh3rS/s1600/Magnetex+Prototype+Repulsion.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsF7fUva4wFGHg3eAbpz_hXwzh7FN8isUr1JJMtjDjMzm-P080s5DmachaIOnb64ewZZTnk67Q7lpe0bZOg0hEOTYv7uGaaclOwi-HEGNKFLvKKYkVVJ3pkEqw-jvys3SjGUIWTrRdh3rS/s1600/Magnetex+Prototype+Repulsion.png" height="225" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The other option is to use repulsion. In the image above it is used on an object directly below the player to shoot him strait up. This could be used to get over areas that maybe have traps in a pit but there is a magnetized area to push off of. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Overall this prototype was successful in showing that these sort of physics can be fun. As soon as you jump in and play around it is kinda fun, even though there isn't much of a game yet. Based on that reaction alone it seams this game could have some good potential. </div>
<div>
</div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-72994291632680438532014-05-10T10:00:00.003-07:002014-05-10T10:03:54.121-07:00Pew<div class="separator" style="clear: both; text-align: left;">
This is a game I developed for my production 2 course with Matt Struble, Matt Therrien, Matt Cerasoli, Ryan Atkinson, John Cotto and Dan Thomas. Pew is a networked multiplier game. There are three teams, an ogre team and two archer teams. The objective of the game is to be the last team standing. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4cs2lcR3_6PWX6HDEn-OLd6pozNdSPGw2zc1EbFbCDG9yRVi8X_i86gnZfm9aKITrKUnxQVtjNN_HBgWlq2vjJYah2_rbvkEKu3jKbmWHeEja30s64s34F9K-ro3cpsdHB0PIuYdlZCAi/s1600/OrgeAttacking.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4cs2lcR3_6PWX6HDEn-OLd6pozNdSPGw2zc1EbFbCDG9yRVi8X_i86gnZfm9aKITrKUnxQVtjNN_HBgWlq2vjJYah2_rbvkEKu3jKbmWHeEja30s64s34F9K-ro3cpsdHB0PIuYdlZCAi/s1600/OrgeAttacking.png" height="480" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Matt Struble and I were the programmers on this project. In general we liked to work together in the labs, so we often had our hands in the same parts of the projects. There were a few things that got more separated towards the end such as I did more of the level/weapon select, loading, arrow homing, and UI/HUD elements while he worked more on the ogre weapon attacks, animations, and power ups. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2L64yWr-GjEepyZVYz0sDZvHgMLkTM5j-CJRwcnQE_C5T1CgNQDVFkVa3OfXZkQvk2hK-T_-BZ9E5wvcD7ZOZdOZk7TDQ72L-4dBh6TSKkTDL17hNTwZ5l3CuxgMQ5iBown1_zk2N8RJo/s1600/ArcherShooting.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2L64yWr-GjEepyZVYz0sDZvHgMLkTM5j-CJRwcnQE_C5T1CgNQDVFkVa3OfXZkQvk2hK-T_-BZ9E5wvcD7ZOZdOZk7TDQ72L-4dBh6TSKkTDL17hNTwZ5l3CuxgMQ5iBown1_zk2N8RJo/s1600/ArcherShooting.png" height="478" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
One of the more challenging aspects of this game was to get the arrows to look good over the network. Initially we implemented prediction and smoothing techniques for the arrows. This made the arrows look like they hit when they hit more but caused the arrows to curve in unexpected ways. At the same time we were having a design issue where an archer on archer fight would go on for too long without any hits. In order to solve both of these problems we decided to add arrow homing to give a reason for arrows to curve and make hitting enemies easier. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In this project we tackled a challenge of creating a networked game, with three teams and asynchronous multiplier. Given how little experience the programmers had with unity at the start of the project, it did seam that this might be a bit of a stretch. In the end the game came out pretty good. There are still some bugs though that it would have been nice to have more time to polish out. We ended up still adding important things even in the last week that gave us little time to make sure that everything new ran smoothly. Even still this game was a great accomplishment.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Click the <a href="http://jacobellenberg.blogspot.com/p/pew.html">Pew</a> link to play the game.</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-68067567307403835102014-03-07T13:04:00.001-08:002014-04-17T02:31:42.009-07:00Flashlight Game<br />
This was my final project for Game AI. I was on a team of three programmers consisting of <a href="http://evanschipellite.blogspot.com/">Evan Schipellite</a>, Paul Kubik, and myself. We decided to try and create a flashlight game with networking, sharers and AI for players and ghost for this 5 week project. We decided to use C# with XNA because we had already learned how to do networking in XNA for our game networking course. For this project I primarily worked on the <a href="http://jacobellenberg.blogspot.ca/2014/03/flashlight-game-level-editor.html">level editor</a>, the flash light effect, and the AI for the player.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWnQepbL0cT0kh0SQNz7EHMDiwhjSkhzmGLn8FqEdhlJwWH3amgOg5FTih4NQHYkVI18A5HV7nG4__qM1Qn1IyifhgBoOlva45Kbu6jeDd3aM_GsF5bWY_cD7zAc3Qry4BfBw7dAefzafg/s1600/Flashlight+Game.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWnQepbL0cT0kh0SQNz7EHMDiwhjSkhzmGLn8FqEdhlJwWH3amgOg5FTih4NQHYkVI18A5HV7nG4__qM1Qn1IyifhgBoOlva45Kbu6jeDd3aM_GsF5bWY_cD7zAc3Qry4BfBw7dAefzafg/s1600/Flashlight+Game.png" height="396" width="640" /></a></div>
<br />
<br />
For the flashlight I created a triangular light in front of the player that gets darker based on the distance from the player. I looked at this <a href="http://www.blackpawn.com/texts/pointinpoly/">source</a> to create the triangle effect and this <a href="http://www.soolstyle.com/2010/02/15/2d-deferred-lightning/">guide</a> to create the differed lighting effect. I also wrote a simple blender that uses the brightest light between all the players flash lights. This way there is not a darker spot in the middle of your flashlight from another player. I wanted to go further than this by making the flashlight stop at walls. I had several ideas on how to approach it but due to time constraints I decided that it was better to start focusing on the AI.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/PlyjP6W5EyY?feature=player_embedded' frameborder='0'></iframe></div>
<br />
<br />
In this video I have the player (Jake) controlled by the AI to show off the player AI. The player AI has 4 states searching a room, opening an object, avoiding a ghost, and moving to a room.<br />
<br />
In the searching a room state the player moves randomly around a the room. There is a set amount of time that a player searches a room. When this time runs out he will go to the move to room state. This works generally well but for smaller rooms it does not look right. It would be better if we scaled it based on the room size. While he is searching the room if he finds an object he will go to the open object state, and if he sees a ghost he will go to the avoid ghost state.<br />
<br />
In the open object state the player moves to the object that he saw, rotates towards the center of the object, and opens it. If during this time he sees a ghost he will go to the avoid ghost state. Otherwise, he will return to the searching room state after he finds the object.<br />
<br />
In the move to room state the player moves to a random adjacent room that the player hasn't been in yet. This way the player doesn't constantly search the same room. The player changes to the search room state when he gets to his desired room. If he spots a ghost on the way, however, he changes to the avoid ghost state.<br />
<br />
In the avoid ghost state the player will choose a random adjacent room to move to. This is not the best thing because it can cause the player to run into the ghost instead of run away but given the time constraints this is what we decided to do. The player changes to the searching state after arriving in the randomly chosen room.<br />
<br />
If we had more time some of the things we would have liked to improve is some of the AI for both the player and the ghost as well as making the flashlight not go past walls. In the avoid ghost state it would be better if the player choose a path that would avoid the ghost as well as leave the room. Currently the ghost can see players through walls. It would be worth limiting the ghost to only seeing what is within the room that they are in. Given that this was a 5 week project the overall scope for a networked game with AI was a bit ambitious. Considering the time period we are happy with what we were able to get done and enjoyed exploring how AI, networking and sharers work in a game together.<br />
<br />
<a href="https://www.dropbox.com/s/tq2djsces4am3jy/JacobEllenberg_FlashlightGame.zip">Flashlight Game Download</a>JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-11504233696651366412014-03-07T10:12:00.000-08:002014-03-08T06:42:45.777-08:00Flashlight Game Level EditorIn Game AI we were assigned a final project to create a game with state machine based AI. My group decided to make a networked collection game in a haunted mansion. In order to setup levels easily I created this level editor. I decided to iterate on the level editor that I created for our <a href="http://jacobellenberg.blogspot.ca/2013/11/hierarchical-pathfinding-tech-demo.html">Hierarchical Pathfinding Tech Demo</a>.<br />
<div>
<br /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjex-lpDdKjProvhx4Dz3Y_kMEpGUEDcEHL_qmLhS_QteF_R6GlQra6bQgGM0Z8cEZFqQwnhlrr3oQthyphenhyphen_JlMQziUDHckx9gP1P1jzijJQVMw9VPHy4jX04vBQYhcegs6XCFBDqhhc5E0Y1/s1600/ImportTileStrip.png" imageanchor="1" style="clear: left; display: inline !important; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjex-lpDdKjProvhx4Dz3Y_kMEpGUEDcEHL_qmLhS_QteF_R6GlQra6bQgGM0Z8cEZFqQwnhlrr3oQthyphenhyphen_JlMQziUDHckx9gP1P1jzijJQVMw9VPHy4jX04vBQYhcegs6XCFBDqhhc5E0Y1/s1600/ImportTileStrip.png" height="200" width="198" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihoxsRaBRi2HQ3V12Uxj8ty6-wsoutaxO8wxcObAR3DtoJEYhgiuwjO4g1m3u2cPzFWuQgoU5hmNqkvugPAVzIe_J9GudTBq7H8DDqB-ylLAN94pGIAdSv5Li4vfbmpoVMcsraWMXirAgR/s1600/AddWalls.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihoxsRaBRi2HQ3V12Uxj8ty6-wsoutaxO8wxcObAR3DtoJEYhgiuwjO4g1m3u2cPzFWuQgoU5hmNqkvugPAVzIe_J9GudTBq7H8DDqB-ylLAN94pGIAdSv5Li4vfbmpoVMcsraWMXirAgR/s1600/AddWalls.png" height="235" width="400" /></a></div>
<br />
The first tab is used to add walls and paint the rooms. All you have to do is import a tile strip and it will separate the tiles for you. Then just click on a tile to select it and left click on the editor screen to paint that tile.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdUNqG3Lg-w2xyZDW6sbGyiRF72svGyKsO7Gy2M19qRFTRDTxCfsVsfRU1wS1hqAm-WHMcKdIri_b9cvNJ_NPskulrDPFe6Du75UUhUtI7-ZPld7hbORzMTUIQ2sltMxpF7I_ZhopoTFcq/s1600/AddObjects.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdUNqG3Lg-w2xyZDW6sbGyiRF72svGyKsO7Gy2M19qRFTRDTxCfsVsfRU1wS1hqAm-WHMcKdIri_b9cvNJ_NPskulrDPFe6Du75UUhUtI7-ZPld7hbORzMTUIQ2sltMxpF7I_ZhopoTFcq/s1600/AddObjects.png" height="379" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIo3FnFvmnZAilcLRtHZIuigRMUyVyuFyRUHL6ctCZwMT9Pg4pUYKr-wlt5nfEWE1SIYJOigb7IF_hDiBk1vKXci6G0mX9E05iP7T7YiNbO3sMY-z_tCFx5bVZqAeb3TDLAnPfUIG7dLek/s1600/EditObject.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIo3FnFvmnZAilcLRtHZIuigRMUyVyuFyRUHL6ctCZwMT9Pg4pUYKr-wlt5nfEWE1SIYJOigb7IF_hDiBk1vKXci6G0mX9E05iP7T7YiNbO3sMY-z_tCFx5bVZqAeb3TDLAnPfUIG7dLek/s1600/EditObject.png" /></a></div>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzmK2sUwEvk2qxSQzSCl2UdSsR0L5Ps_fJG-pXljoXVOA5k-0qv67XcyJywMTwctxAGKBaV0BB1wXEgYgNVpgsEUA4ptZJaGSXvO2ORP1qAQna_tZQFh9uHm39IZkvxlR3i62XgAdD4vzU/s1600/ImportObject.png" imageanchor="1" style="clear: right; display: inline !important; margin-bottom: 1em; margin-left: 1em; text-align: center;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhzmK2sUwEvk2qxSQzSCl2UdSsR0L5Ps_fJG-pXljoXVOA5k-0qv67XcyJywMTwctxAGKBaV0BB1wXEgYgNVpgsEUA4ptZJaGSXvO2ORP1qAQna_tZQFh9uHm39IZkvxlR3i62XgAdD4vzU/s1600/ImportObject.png" /></a><br />
<br />
The next tab is used to add and manipulate objects. To import new objects the user simply opens the import object window, selects a .png and give it a name. Similar to the add walls you can select and object on the right and place it in the editor. However, when adding objects if the user holds down the mouse the user can move the objects around. The user can remove objects by right clicking on them. The user can change the rotation of an object or its search weight by clicking the middle mouse button on and object, which opens the edit object window. In order to easily add collisions to the objects and prevent more than one object being place on the same tile, I save where objects are in a 2D int array. When placing an object I check to see if there is one an object on any of tiles the object would be on. This prevents any overlapping issues. When saving the game I add the object array to the collision array, so in game the player can't collide with objects.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA3YJAa9uttRJukSCRUj4I331i6KnfXXxyP-FX-S_9Cjio8PnOH5mElohKey-M5vktGdL3hVnUwwLFolsxCxn4iJGNZVwCXJPPNtBkdEuoma_a8NGHAUTK1s19i9rqMMFKQLaNwVLTYiL0/s1600/Add+Rooms.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgA3YJAa9uttRJukSCRUj4I331i6KnfXXxyP-FX-S_9Cjio8PnOH5mElohKey-M5vktGdL3hVnUwwLFolsxCxn4iJGNZVwCXJPPNtBkdEuoma_a8NGHAUTK1s19i9rqMMFKQLaNwVLTYiL0/s1600/Add+Rooms.png" height="380" width="640" /></a></div>
<br />
In our Flashlight game the AI for both the player and ghost utilize rooms to define a search area. This tab is used to setup the rooms. When you select a room all of the room tiles and connection lines are highlighted while the tiles and connections for the other rooms are alpha-ed out. The ability to use alpha so easily is given to us because the editor window is using XNA. The user controls are pretty similar to other tabs, click the room on the right to select it, left click to paint rooms and right click to delete. The user can also change the name of the rooms in the text box in the top of the right side. The connections are created automatically by checking if any adjacent tiles are in another room.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyDjBd-wEjGO9_fAofH7REd7e6UjtbGJ70mAtli9Vedl88FnnUcLhyh6jW2xTln4ohkKKr7oJp3vbrN3uSsvxK2i78MXMGn6_SIx50qWHD6G9SHgxJIw1dOex4SNJkGRvPV4tXR4R0su_t/s1600/Ghost.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyDjBd-wEjGO9_fAofH7REd7e6UjtbGJ70mAtli9Vedl88FnnUcLhyh6jW2xTln4ohkKKr7oJp3vbrN3uSsvxK2i78MXMGn6_SIx50qWHD6G9SHgxJIw1dOex4SNJkGRvPV4tXR4R0su_t/s1600/Ghost.png" height="380" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5gqmaX6bBj3Py7Y4e3PULuO0ckyaAEo59zKeLiJFy_2VoMyUVOgtI4qXtG8XjFIBO4-kuLqUF2BnWpWuOqsnrkeRQhR7z6LowmmiOge_eA3BdQA-42jlAZSnyyZmDUNLt4O9u6lFnXTv_/s1600/EditStateTransitions.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq0qG23dvVBwRTA863eUMk0v19xQibF5M64MKTFu8svoXDTGopdZ3T-iOhj3mXMt1poFeO5WY5Cgq5wbn2kutoPTZqYr9-bwXxAz4Bk9SIr4tPt4jVyysMD5e89sWA2u6tr-ZM2KT1KZjE/s1600/EditGhostInfo.png" imageanchor="1" style="clear: left; display: inline !important; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq0qG23dvVBwRTA863eUMk0v19xQibF5M64MKTFu8svoXDTGopdZ3T-iOhj3mXMt1poFeO5WY5Cgq5wbn2kutoPTZqYr9-bwXxAz4Bk9SIr4tPt4jVyysMD5e89sWA2u6tr-ZM2KT1KZjE/s1600/EditGhostInfo.png" height="320" width="312" /></a><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5gqmaX6bBj3Py7Y4e3PULuO0ckyaAEo59zKeLiJFy_2VoMyUVOgtI4qXtG8XjFIBO4-kuLqUF2BnWpWuOqsnrkeRQhR7z6LowmmiOge_eA3BdQA-42jlAZSnyyZmDUNLt4O9u6lFnXTv_/s1600/EditStateTransitions.png" height="315" width="320" /></div>
<br />
<br />
Ghost are the enemy in our Flashlight Game. This section allows the user to place new ghost spawn points, ghost free zones and set up information about the ghost AI. If you middle click on a ghost spawn point it brings up an edit ghost info window that allows you to manipulate how the AI works for that particular ghost. Similar to how it works in add walls the user can draw ghost free zones that ghost can't travel into. This is so the ghost won't be too close to where the players start and reset. There are also options to setup the transitions for each of the ghost states.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXkwEp-LrfoXNChQC-RnX5r3o4cbFLePVcVR6kFmGq1vcQxuqeqmmjvdlj_LT_S7Nmm1ditfeMoTB1Gn2LvunXzgxyLNN_lC6RKfxTr6p8_e8ZpHh4w5gsNjfAhJ3ckb0baulEE12_jLfg/s1600/Player.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXkwEp-LrfoXNChQC-RnX5r3o4cbFLePVcVR6kFmGq1vcQxuqeqmmjvdlj_LT_S7Nmm1ditfeMoTB1Gn2LvunXzgxyLNN_lC6RKfxTr6p8_e8ZpHh4w5gsNjfAhJ3ckb0baulEE12_jLfg/s1600/Player.png" height="380" width="640" /></a></div>
<br />
The player section is used to setup the player start positions and add transitions for each player state. To place a player start position the user simply selects a player on the right and left clicks. To change transitions the user can click the transition buttons on the right to open up a window for that state.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/VWKosN5Rg-k?feature=player_embedded' frameborder='0'></iframe></div>
<br />
Though this level editor isn't completely bug free I am happy that I was able to make a working version in a about two weeks. I had to make it robust enough so that my other team member <a href="http://evanschipellite.blogspot.com/">Evan Schipellite</a> could use it to design the level. It worked well for us and allowed us to create an interesting level for our game.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-1570514484110705082013-12-03T21:23:00.001-08:002013-12-03T21:30:40.216-08:00Formation Movement<div>
A formation is a structure for units to move within. This can be used in games to make the AI look more realistic.</div>
<div>
<br /></div>
<div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFB-2Lac3PQObQ0dnz86L-vjpS1aKXFDwSLMfrqzfoOQ7BPEbxyC5BEj7VcKm3ajjDiB1on-myP2gW1VywEePJmjGKgTtivSZdDvgCvGkHcbUzi4wTNaPhjOFkuny8gfYeWe3lkXHZuvmK/s1600/movementWithAndWithoutFormation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="316" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFB-2Lac3PQObQ0dnz86L-vjpS1aKXFDwSLMfrqzfoOQ7BPEbxyC5BEj7VcKm3ajjDiB1on-myP2gW1VywEePJmjGKgTtivSZdDvgCvGkHcbUzi4wTNaPhjOFkuny8gfYeWe3lkXHZuvmK/s640/movementWithAndWithoutFormation.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<span id="goog_1790921243"></span><span id="goog_1790921244"></span><br /></div>
<div>
In the above example the first part is the movement of units that all act on their own to get to an end point. These units could have simple behaviors to avoid colliding with each other but don't have any knowledge of the group as a whole. The line formation on the other hand has to have an outside system with knowledge of where everything in the group can be. This system can be ran with one unit leading a group or an external formation manager, managing all of the positions and movement of the desired positions. This post will focus more on an external system managing units rather than a leader but many of the concepts can be applied to both.<br />
<br />
Dave Pottinger in an article called "Implementing Coordinated Movement" discusses many strategies of how to create and move formations. Researching these ideas I gained a good understanding of how the basics of formation movements work. Formations have slots that units fill and follow. A formation should have multiple states such as currently forming, formed, and moving along a path. A formation that is currently forming has units in it that have not yet filled a slot. It is often important to plan out the order in which units join the formation and can be worth it to have the units join one at a time. This is especially notable when creating a box formation.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLBjj_cv6CvZMt32pVNIwhgW6BIxn_fjbA0FyDfUMk5aFC6BvqM2WEODXEyzc78Ddr3QCWPWE5cCRyCvJDSlxSjKxaWbeApuyEIPPGDtHiWnIgR5SebMjJnajdZ9ZP8x_nOQGC3ddXxrpS/s1600/boxFormationExample1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="315" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLBjj_cv6CvZMt32pVNIwhgW6BIxn_fjbA0FyDfUMk5aFC6BvqM2WEODXEyzc78Ddr3QCWPWE5cCRyCvJDSlxSjKxaWbeApuyEIPPGDtHiWnIgR5SebMjJnajdZ9ZP8x_nOQGC3ddXxrpS/s640/boxFormationExample1.png" width="640" /></a></div>
<br /></div>
<div>
<br />
This problem can easily be avoided with some planning. One way of approaching this is having each slot get filled one at a time. The order for filling the slots would be based on their distance from a reference point. When a slot gets chosen it will then choose the best available unit based on a heuristic value. This heuristic value can be created by taking into account factors such as distance, and ease of travel based on obstacles in the way of the path. For this situation it would make sense to have the reference point be the center position because that is the most likely point to get blocked off. If however the formation was created in a corner the center may not be the best choice. In this case using the center point will often result in the part closest to the corner being blocked off as the last unit attempts to go into place. These sort of things depend on the environment of your particular game.<br />
<br />
Now that we have formed our formation, according to the way our states work, we can move. In all formations the units will be simply following their assigned slots in the formation. The formation itself and the slots will move using its own logic. Depending on the shape of the formation depends how it should move and rotate. In some cases the rotation doesn't matter much because the formation will look good regardless of the direction it is moving.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjbyqxiKoTKWp1L8XTzApS3oMThWla3Ssvw0yB80GafNvNjxYvkSx9TD3xjoF-3ofUFL6d7_FgWgVKXAviNUyIacRnSm5XwEgFUSKHmjBW5gANYQdq9N9E6b3zgWLHYUfcIkFdQcPvFAsc/s1600/formationMovmentExample.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="316" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjjbyqxiKoTKWp1L8XTzApS3oMThWla3Ssvw0yB80GafNvNjxYvkSx9TD3xjoF-3ofUFL6d7_FgWgVKXAviNUyIacRnSm5XwEgFUSKHmjBW5gANYQdq9N9E6b3zgWLHYUfcIkFdQcPvFAsc/s640/formationMovmentExample.png" width="640" /></a></div>
</div>
<div>
<br />
However, as seen in this example, with a line formation it must rotate in order to look correct. This can be done rather simply by stopping the formation and reforming it based on the new desired rotation.<br />
<br />
I made a tech demo in order to understand some of these ideas in action. In this demo you can see square formation with the center as a reference point when it is not made at the corner of the screen. It also shows movement with both box and line formations as previously described.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/Cjt7cHb2GXw?feature=player_embedded' frameborder='0'></iframe></div>
<br />
This is just a simple example of formation movement but in a full game there would be many more obstacles to deal with. If a unit within the group gets far away from a point it needs to act accordingly. The article "Realistic Behavioral Model for Hierarchical Coordinated Movement and Formation Conservation for Real-Time Strategy and War Games" discusses a movement strategy to help solve this issue. Each unit has three movement states, slow, normal, and fast. Based on various factors such as the units distance for its slot it may switch between states. But regardless it will stay within the constraints of the fastest and slowest states. I implemented this in my tech demo based on the distance but it is not very noticeable due to lack of obstacles and collisions.<br />
<br />
In the book, "Artificial Intelligence For Games" by Millington, Ian, and Jon Funge, there is a section on scale-able formations. This is a formation such as a defensive circle that can get larger based on the number of units. This can be done fairly simply by increasing the radius of the circle allowing for more slots to be added.<br />
<br />
Formations are often used in RTS games. In this case there are many units that group and move together across a complex map. In this situation path finding algorithms would be necessary to figure out a path that the entire formation could go but we won't go into that here. Another game that formations can be used in is a battle ships like game. In this situation a player could be the captain of a fleet of ships and have a formation follow him in an intelligent manner. These are just a few examples of where formations can be used.<br />
<br />
As discussed earlier in order for formations to work well a lot of planning is needed. Making these plans and acting on them takes a decent amount of CPU time. Because of this it is important to consider how complex you want to make your formations based on your platforms restraints. On PC it is entirely possible to utilize the CPU power of modern day machines to have really well working complicated algorithms that create intelligent formation movement. This is not to say it can't be done on platforms such as mobile because it most certainly has; it is just important to tone down the complexity of the AI for a platform such as mobile to allow it to run smoothly. This technique can be used on most platforms if the complexity and efficiency are considered with the platform in mind.<br />
<br /></div>
<div>
References:<br />
<br />
<div dir="ltr" style="margin-bottom: 0pt; margin-left: 36pt; margin-top: 0pt; text-indent: -36pt;">
<div style="text-align: left;">
<span style="line-height: 32px; white-space: pre-wrap;">Mamdouh, Abdulla M., Ahmed Kaboudan, and Ibrahim F. Imam. "Realistic Behavioral Model for</span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;"> Hierarchical Coordinated Movement and Formation Conservation for Real-Time Strategy and</span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;"> Games."</span><span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;">IAENG International Journal of Computer Science (2012): n. pag. Web.</span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;">Millington, Ian, and John David Funge. Artificial Intelligence for Games. Boca Raton: CRC, 2009. Print. </span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;">Pottinger, Dave. "Gamasutra - Coordinated Unit Movement." Gamasutra Article. N.p., 22 Jan. 1999. Web.</span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;"> 04 Dec. 2013. </span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;">Pottinger, Dave. "Gamasutra - Implementing Coordinated Movement." Gamasutra Article. N.p., 29 Jan.</span></div>
<div style="text-align: left;">
<span style="line-height: 32px; text-indent: -36pt; white-space: pre-wrap;"> 1999. Web. 04 Dec. 2013. </span></div>
</div>
</div>
JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-33604772698527012702013-11-28T22:19:00.000-08:002014-03-07T07:47:09.460-08:00Hierarchical Pathfinding Tech Demo<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/tK52bEgC8TY?feature=player_embedded' frameborder='0'></iframe></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiv5ZGhKG9BmkBFZavuljGotW76Xxk6-beRnh1u3hJYV8Zo7HhO8d1ctzvSCdv1ht3Pp8YHWsJ9VA78sd5XLBxZ90acJYP_ZrvgjnXuDTgeSgGRp1oLnlixmxpMXs0uiPwMe2fNTCC5-Hv/s1600/LevelEditorScreenShot1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiv5ZGhKG9BmkBFZavuljGotW76Xxk6-beRnh1u3hJYV8Zo7HhO8d1ctzvSCdv1ht3Pp8YHWsJ9VA78sd5XLBxZ90acJYP_ZrvgjnXuDTgeSgGRp1oLnlixmxpMXs0uiPwMe2fNTCC5-Hv/s400/LevelEditorScreenShot1.png" height="240" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ildfDzha59i1tewuvM2OPIFiyz0_jxamDKWg5zJpyJF8KJ0z8odDaUReWysI6Ei2O24vUAmhyphenhyphenp4Es6CfsHjfbOTtGOt3-Blhs-Hd6ehGzW9pnoyDbY3HRMbBoRW2agfPIQNQviKQa24H/s1600/LevelEditorScreenShot2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1ildfDzha59i1tewuvM2OPIFiyz0_jxamDKWg5zJpyJF8KJ0z8odDaUReWysI6Ei2O24vUAmhyphenhyphenp4Es6CfsHjfbOTtGOt3-Blhs-Hd6ehGzW9pnoyDbY3HRMbBoRW2agfPIQNQviKQa24H/s400/LevelEditorScreenShot2.png" height="238" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEho6zLob7SBIeZRxWwEgRT9G1Q8tW8xUsNZz73WAImpMH6H_U6lRxwA0HgvVDYQOpvwzbVXf0j3806cjfhD9HU7SYnNfpc3_CR6BkWYGCBMEKYhY2qYkjcoFyQsRVG3bXu8fyLaKdNXyOw6/s1600/LevelEditorScreenShot3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEho6zLob7SBIeZRxWwEgRT9G1Q8tW8xUsNZz73WAImpMH6H_U6lRxwA0HgvVDYQOpvwzbVXf0j3806cjfhD9HU7SYnNfpc3_CR6BkWYGCBMEKYhY2qYkjcoFyQsRVG3bXu8fyLaKdNXyOw6/s400/LevelEditorScreenShot3.png" height="238" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
This is a tech demo I did with <a href="http://evanschipellite.blogspot.com/">Evan Schipellite</a> for my game AI course. We implemented hierarchical pathfinding and path smoothing. The purpose of hierarchical pathfinding is to make the movement path calculated much smaller and relative to the characters current area. For example if your in your room and you need to get to work, the only path that is immediately important is the one to get out of your room and into the next one. In order to know which room is the next one (going into the hallway instead of your bathroom) there needs to be a higher level plan. To create this plan the hierarchical pathfinder needs to group up sections and layers. The first layer being the node information that would be used for something like A*; In our tech demo we use a tile grid with connections to all adjacent tiles without collision. The next layer could be grouped as rooms like the bed room, upstairs hallway, bathroom, ect. The layer after that could be the buildings such as your house, your work building, ect. From here you can keep making as many layers as necessary to increase efficiency. I created a level editor using C# XNA with winforms to provide the data for our tech demo. Using this editor we were able to easily specify sections in as many layers as we wanted as shown in the pictures above.<br />
<br />
The most challenging part of this project was understanding and implementing hierarchical pathfinding. We used <i>Artificial Intelligence For Games</i> by Ian Millington and John Funge for the explanation of how hierarchical pathfinding works and algorithm for implementing the pathfinding. It took us a few hours to completely understand how hierarchical pathfinding should work and how we should approach doing it. I was able to create an infrastructure that would read in the data from my level editor and create multiple layers that we could use in our pathfinding algorithm. We were then able to take that infrastructure and apply it to the algorithm in the book to get a working hierarchical pathfinder.<br />
<br />
To show off the smaller subsections of hierarchical pathfinding working we added the ability to turn on and off continuous pathfinding. When continuous pathfinding is off the characters only move to the next room on the higher path. This demonstrates how small of a path is created at one time.<br />
<br />
In order for hierarchical pathfinding to really be worth it the map would need to be much larger than it is in this tech demo. In this situation it would not be impossible to A* across the whole map but if the map was much larger it would take far too much time to A* to any position. In that case this technique would be very useful to allow for pathfinding over a smaller area.<br />
<br />JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.comtag:blogger.com,1999:blog-8468588359855516365.post-16334666974402330912013-10-03T20:19:00.000-07:002013-10-04T04:19:59.929-07:00Spacewars Game Jam<div class="separator" style="clear: both; text-align: center;">
<object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i1.ytimg.com/vi/T_h0YoVhtJw/0.jpg" height="266" width="320"><param name="movie" value="http://www.youtube.com/v/T_h0YoVhtJw?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://www.youtube.com/v/T_h0YoVhtJw?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
In my networking class last Friday our professor <a href="http://prof.johnpile.com/">John Pile</a> surprised us with a Spacewar themed game jam. The goal was to group with one other person and make a networked game similar to the 1985 version of Spacewar. I choose to group with my friend <a href="http://evanschipellite.blogspot.com/">Evan Schipellite</a>. We decided to use his game for the last assignment as a starting point. From here we both just looked at the requirements and started to code. I started to work on game-play features such as the player class while he converted the architecture to work better with our new game. After I finished creating a few classes I needed to merge them with his architecture in order to test if they worked. Evan at this point had already setup some classes to make it relatively easy to merge our work. With just a little help I was able to get everything linked up and ready to go. The player class started to work with little need for fixes. The speed and some other values weren't the best but it worked and that was good. At this point there was still much to be done and with only very little time left. I was able to squeeze in bullets and the display of health within the last few minutes but there was not time for perfection. I had initially set it up so each player would be authoritative over when they took damage from a bullet but when I looked at the clock and saw less than five minutes left I realized that sending health data over the network was not going to happen in time. So I decided to comment out the line making it authoritative and just had everyone decided the score for everyone else. At the end we had working ships that could move around in a way fairly similar to space wars, bullets that hurt enemies, a awesome star field background made by Evan and a win state. To be able to create all of these things in a somewhat working fashion in such a short period of time was a success that I could feel good about. In retrospect though it would have been good to have a little bit more planning as to what we each were going to get done and what we wanted to accomplish during the time period. While we were doing the game jam both of us had very little idea what we were going to do let alone what the other person was doing. We just looked at the list and started programming things that needed to be done.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/F-SNUszPPOc?feature=player_embedded' frameborder='0'></iframe></div>
<br />
After the game jam we decided to improve upon the game and take our own spin on Spacewar rather then trying to make an exact copy. I came up with the idea that instead of in space we could be in quick sand because this would still work for the idea of gravity in the game. We evolved the idea from there and decided to make it a group of tourist that got stuck in quicksand and the tour guide only being able to save the last one. From here I went into polishing the old game features and adding on new ones. One of the requirements for the game was to have the bullets limited to 10 per player but last forever (with screen wrap). This caused a lot more difficulties than originally intended. Having this happen wasn't to difficult but as we watched the game go on the bullets would lag behind on different player screens. If a bullet was only alive for a second than the difference was so minor that it couldn't be noticed but if it were on the screen for 10 seconds a bullet on one screen would be maybe 3 seconds behind another. This was a pretty major problem so we tried our best to fix it. First we attempted to have all the computers sync up without sending bullet information over the network. We used methods such as having a physics timer so the bullets would only update every 50 milliseconds, multiplying the elapsed time by the speed and reducing the frame rate. All of this went to no avail so in the end we made the host authoritative over bullets sending their positions with a byte ID over the network. In the end I am happy with how both versions of the game worked out.JacobEllenberghttp://www.blogger.com/profile/00670786060159741654noreply@blogger.com