Tuesday, September 10, 2013

Capstone Blog #2 Prototyping away!

Well it's week two, school is back into full swing, I've started working at MWG again, and the homework is starting to pile up.  They days just seem to be getting shorter and shorter each day, however this is no time to complain because innovation and iteration must be completed! As the programmer I had 3 main goals for this weeks activities 1. get familiar with UDK just in case we actually go down that road, 2. Start our light game prototype in Unity 3. Mobile development research.

UDK install and set up was really straight forward I started messing with it a little bit however I quickly re evaluated my time and decided while this was useful to work on it should not be my main focus at this time.  UDK is a powerful tool but actually being able to prototype ideas in any engine at all is much more beneficial for stage one.

I quickly moved onto out light game creation of which I spend most of this sprints time working on.  It took me a little while to get back into the swing of coding with unity and playing with Unitys lights is always a pain. However within a few hours I had a first person cylinder holding a flashlight that was able to explore a darken scene.  Off in the distance an "enemy" walked back and forth.  This is where the "hard" part came, I've used ray-casting in the past.  Which is a form of hit detection, basically the computer shoots out a line from an origin point outwards until it collides with something, it then returns information on when,where ,what, and how it hit.  While this is a great but slightly complicated tool to use it didn't fully accomplish what I wanted which was to know if my flashlight was shinning on our enemy.  A flashlight is obviously not just a straight line, it's more of a cone and as such i could not use a basic ray-cast.  There were a few options I looked into which consisted on semi advance math using dot product and distance equations to calculate if the enemy is actually in front of me in a cone range and then ray casting towards it to make sure it's actually in light of sight and not blocked by a while.  However it was more work then I really wanted to commit to for a prototype and could quickly get messy.  Doing a little poking around I found what is know as a sphere-cast. Basically it's a "thick" ray-cast.  Instead of shooting a line from an origin toward a direction. It shoot out a sphere of a specific radius and return any information back to me.  Which works perfectly for what I was trying to do. As my sphere-cast travels I increase the radius of the sphere to compensate for the wide cone of the flashlight. If/when it hits my enemy I use a get component function to slow down and bring the enemy to a stop in a matter of seconds.  The exact type of reaction we were looking for.

At this point we hand our next team meeting.  I went over what I accomplished, we once again worked on trying to come up with a team name, and we had a rather long dialog about working on a mobile platform and all of the limitations that we could run into.  Scree size, real estate , engine, 3d or 2d.  A lot of ifs ands or buts all of which I am starting to uncover.

No comments:

Post a Comment