<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Deadbeef&#039;s Graphics/Game Dev Blog</title>
	<atom:link href="http://deadbeefgames.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://deadbeefgames.com/blog</link>
	<description>Hopefully the start of something great =)</description>
	<lastBuildDate>Fri, 15 Jul 2011 18:04:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Update: Back into shape&#8230;.</title>
		<link>http://deadbeefgames.com/blog/?p=137</link>
		<comments>http://deadbeefgames.com/blog/?p=137#comments</comments>
		<pubDate>Tue, 31 May 2011 22:36:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=137</guid>
		<description><![CDATA[Hello Everyone!
It has been a while since i have last updated, which is not very nice of me.
Things have been rather quiet on the game front&#8230; The networking prototype proved to be just that, a prototype. We have redesigned the networking from scratch to handle the more robust set of requirements needed for a full [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Everyone!</p>
<p>It has been a while since i have last updated, which is not very nice of me.<br />
Things have been rather quiet on the game front&#8230; The networking prototype proved to be just that, a prototype. We have redesigned the networking from scratch to handle the more robust set of requirements needed for a full fledged online game! </p>
<p>Aside from that, i have started a DX11 research project. I hope to do some of the lighting things in my old engine, as well as establish a good working knowledge of the d3d 11 api. Right now I am working on mesh importing, and have been getting into fbx.</p>
<p>SO, redesigning/reimplementing networking and asset importing are keeping me busy. </p>
<p>I am so proud of the Lua and AssetManager stuff from the older engine that i have brought that stuff over. I will be integrating it when the time is right.</p>
<p>until then&#8230; see ya!<br />
I will be better and post more!<br />
-J</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=137</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unity Engine, Networking, and Excitement!</title>
		<link>http://deadbeefgames.com/blog/?p=135</link>
		<comments>http://deadbeefgames.com/blog/?p=135#comments</comments>
		<pubDate>Fri, 19 Nov 2010 22:27:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=135</guid>
		<description><![CDATA[Hello Everyone,
Huge news for our little establishment. We are archiving our engine and have switched over to Unity Engine. They have basically everything we wanted to put into our own, and it is very affordable! A perfect example of why we did so, is that we managed to implement networking (a full server/client system complete [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Everyone,</p>
<p>Huge news for our little establishment. We are archiving our engine and have switched over to Unity Engine. They have basically everything we wanted to put into our own, and it is very affordable! A perfect example of why we did so, is that we managed to implement networking (a full server/client system complete with game lobby) in one week with Unity, where as it would take half a year for us to do it on our own from scratch and it would not be as fully featured as what we are doing with Unity.</p>
<p>So, it is safe to assume that our game will have multi-player! The year is almost over, so we better get to announcing something shall we? Stay tuned!</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=135</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenGL 3.0 and beyond</title>
		<link>http://deadbeefgames.com/blog/?p=132</link>
		<comments>http://deadbeefgames.com/blog/?p=132#comments</comments>
		<pubDate>Sat, 02 Oct 2010 01:35:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=132</guid>
		<description><![CDATA[Hello Everyone,
Aside from being busy from writing demos for JavaOne (my other job as a Graphics Engineer for JavaFX) I had re-written my renderer for a presentation on modern lighting algorithms. I was not able to get it where I wanted but that hasnt stopped me from working on it. The reason for the re-factor [...]]]></description>
			<content:encoded><![CDATA[<p>Hello Everyone,</p>
<p>Aside from being busy from writing demos for JavaOne (my other job as a Graphics Engineer for JavaFX) I had re-written my renderer for a presentation on modern lighting algorithms. I was not able to get it where I wanted but that hasnt stopped me from working on it. The reason for the re-factor was simple. The current renderer we had was based on OpenGL 2.1 fixed functionality, and although we had shaders, we were still very reliant on things like the matrix stack, which were starting to really impact our productivity.</p>
<p>So this is for anyone on the fence about moving. DO IT.</p>
<p>I consider a new age OpenGL renderer to have the following:<br />
1) No Matrix Stack. Pass ALL matrices to the shaders and mult them on the CPU if neccesary. This becomes much cleaner in terms of implementation. If you have trouble implementing your own math library for matrices, you can grab  <a href="http://glm.g-truc.net/">OpenGL Mathematics</a> which is a CPU version of GLSL.</p>
<p>2) State Objects. Much how DirectX Manages it&#8217;s state, you can wrap the OpenGL state machine with state objects, for example a rasterizer object would contain an enum type for Wireframe, fill, or none. you would then have a setState function which would set the state. State objects also make it easy to port your renderer to DirectX.</p>
<p>3) Render Target Objects. Similar to above, making you less error prone when dealing with the ins and outs of FBOs.</p>
<p>Good luck to anyone thinking about this, i highly suggest moving your old renderers forward in time (or rewrite new ones). the newer opengl stuff is great!.</p>
<p>-Joe </p>
<p>PS. I havent forgotten about quaternions!</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=132</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update: Quaternions Part 2 coming soon&#8230;.</title>
		<link>http://deadbeefgames.com/blog/?p=130</link>
		<comments>http://deadbeefgames.com/blog/?p=130#comments</comments>
		<pubDate>Fri, 06 Aug 2010 15:32:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=130</guid>
		<description><![CDATA[Lots going on!
Sorry for the delay!
I thhhinnkkk there is still a bug in the code, i have the post written up i just want to do some tests to make sure.
]]></description>
			<content:encoded><![CDATA[<p>Lots going on!</p>
<p>Sorry for the delay!</p>
<p>I thhhinnkkk there is still a bug in the code, i have the post written up i just want to do some tests to make sure.</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=130</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quaternions Part 1</title>
		<link>http://deadbeefgames.com/blog/?p=124</link>
		<comments>http://deadbeefgames.com/blog/?p=124#comments</comments>
		<pubDate>Thu, 15 Apr 2010 21:07:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=124</guid>
		<description><![CDATA[The very first thing I&#8217;m going to say about Quaternions is that they are EASY to understand how to use! They are hard to understand why they work (ie. proofs and such). With that said&#8230; us game/graphics programmers care a lot about how to use stuff, which is what I&#8217;m going to talk about.
When you [...]]]></description>
			<content:encoded><![CDATA[<p>The very first thing I&#8217;m going to say about Quaternions is that they are EASY to understand how to use! They are hard to understand why they work (ie. proofs and such). With that said&#8230; us game/graphics programmers care a lot about how to use stuff, which is what I&#8217;m going to talk about.</p>
<p>When you rotate an object, you use some matrix math to rotate on either the X, Y, or Z axis.</p>
<p>A look at <a href="http://en.wikipedia.org/wiki/Transformation_matrix#Perspective_projection">matrix transformations on wikipedia</a> will give an idea. When you are limited to these 3 axes, problems arise when you you rotate a certain amount on one axis you can align it with another, and then rotating on another axis becomes the same. VERY CONFUSING i know, but the important thing to realize is that you are limited to 3 axes when rotating an object with a standard matrix.</p>
<p>A quternion is just a vector with a rotation applied to it. THAT is it! this vector represents an arbitrary (meaning you define it) axis which the rotation value is applied to.</p>
<p>what makes this different than matrices is you can add quaternions together to get ONE rotation, as opposed to 3 separate rotations! When you are done with the rotation, you can simply compose a matrix out of the quaternion and use that matrix with your translations to get the proper rotation!</p>
<p>I will leave it to you to research teh functions.</p>
<p>Part 2 will show some code for our camera.</p>
<p>-DB</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=124</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Event Data from C++ to Lua using Luna(r).</title>
		<link>http://deadbeefgames.com/blog/?p=111</link>
		<comments>http://deadbeefgames.com/blog/?p=111#comments</comments>
		<pubDate>Thu, 08 Apr 2010 20:37:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Game Programming]]></category>
		<category><![CDATA[Lua]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=111</guid>
		<description><![CDATA[It has been a while since I have updated, but I have a couple of posts I will make within the next week. The first post is on the enhancements I have made to our Event System.
The basic implementation of this event system is from lua programming gems (very nice book). It consists of a [...]]]></description>
			<content:encoded><![CDATA[<p>It has been a while since I have updated, but I have a couple of posts I will make within the next week. The first post is on the enhancements I have made to our Event System.</p>
<p>The basic implementation of this event system is from lua programming gems (very nice book). It consists of a lua object (otherwise known as a table) that contains a couple of tables that stores Events, Pending Subscribers and Pending Unsubscribers, as well as a couple of functions for updating subscribers and firing events. You can get the full source for the Event System <a href="http://www.lua.org/gems/">here</a> (toward the bottom, 21 I believe). This Event system has a C++ implementation that simply pushes a string onto the stack and calls the lua function like so.</p>
<p>The Fire Event function looks something like:</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;"> <span style="color: #b1b100;">function</span> EventManager:FireEvent<span style="color: #66cc66;">&#40;</span> eventName, ... <span style="color: #66cc66;">&#41;</span>
   self.Events<span style="color: #66cc66;">&#91;</span> eventName <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">=</span> self.Events<span style="color: #66cc66;">&#91;</span> eventName <span style="color: #66cc66;">&#93;</span> <span style="color: #b1b100;">or</span> <span style="color: #66cc66;">&#123;</span><span style="color: #66cc66;">&#125;</span>
   <span style="color: #b1b100;">for</span> subscriber,_ <span style="color: #b1b100;">in</span> <span style="color: #b1b100;">pairs</span><span style="color: #66cc66;">&#40;</span> self.Events<span style="color: #66cc66;">&#91;</span> eventName <span style="color: #66cc66;">&#93;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #b1b100;">do</span>
     subscriber<span style="color: #66cc66;">&#91;</span> eventName <span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#40;</span> subscriber, ... <span style="color: #66cc66;">&#41;</span>
   <span style="color: #b1b100;">end</span>
 <span style="color: #b1b100;">end</span></pre></div></div>

<p>and in C++ looks like:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> FireEvent<span style="color: #008000;">&#40;</span> lua_State<span style="color: #000040;">*</span> L, std<span style="color: #008080;">::</span><span style="color: #007788;">string</span> eventName <span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
  <span style="color: #666666;">//Call the lua FireEvent on this event manager object.</span>
  lua_pushlightuserdata<span style="color: #008000;">&#40;</span> L, <span style="color: #0000dd;">this</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: em</span>
  lua_gettable<span style="color: #008000;">&#40;</span> L, LUA_REGISTRYINDEX <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: self</span>
  lua_pushstring<span style="color: #008000;">&#40;</span> L, <span style="color: #FF0000;">&quot;FireEvent&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: &quot;FireEvent&quot;, self</span>
  lua_gettable<span style="color: #008000;">&#40;</span> L, <span style="color: #000040;">-</span><span style="color: #0000dd;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: FireFunc, self</span>
  lua_pushvalue<span style="color: #008000;">&#40;</span> L, <span style="color: #000040;">-</span><span style="color: #0000dd;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: self, FireFunc, self</span>
  lua_pushstring<span style="color: #008000;">&#40;</span> L, eventName.<span style="color: #007788;">c_str</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: self, eventName, FireFunc, self</span>
  lua_pcall<span style="color: #008000;">&#40;</span> L, <span style="color: #0000dd;">2</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//STACK: self</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>As you may see, there is some lost functionality in this process. Although the lua fire event function takes additional arguments (note the &#8220;&#8230;&#8221; ), the C++ function does not account for this. This allows event data to be passed around at the lua level, but not from C++ to lua. This is the primary use of an Event! when you have keyboard and mouse input you would like to fire an input event that contains the bytecodes of the input used!</p>
<p>This is okay, with a little effort and C++ template magic we can fill in the little gap. we need to be able to pass in any type of data and include it in the arguments to lua like anything else.<br />
In order to do this, we need 2 things.</p>
<p>First we need to change the C++ FireEvent function to a template function, allowing us to only write it once, and still be able to take many types of event data.</p>
<p>Secondly, we need to expose our EventData classes to lua, and be able to push each EventData type onto the lua stack. This can get very complicated, and as i said before, there are many ways to expose data to lua, this is just one of them.</p>
<p>I used luna (actually lunar but I copy and pasted some of it into my luna class). Luna is somewhat of a pain if you want to expose multiple things into your lua environment from C++, but I find that it is mostly copy and paste and chaging names once you got it down.</p>
<p>Here now, is the new code:</p>
<p>C++ FireEvent and Push Function for a collision event</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">    <span style="color: #0000ff;">template</span> <span style="color: #000080;">&lt;</span><span style="color: #0000ff;">typename</span> T1<span style="color: #000080;">&gt;</span>
    <span style="color: #0000ff;">inline</span> <span style="color: #0000ff;">void</span> fireEvent<span style="color: #008000;">&#40;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">string</span> eventName, T1 a1<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
         EventLog <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;FireEvent:: &quot;</span> <span style="color: #000080;">&lt;&lt;</span> eventName <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #008080;">;</span>
        <span style="color: #666666;">//Call the lua FireEvent on this event manager object.</span>
        lua_pushlightuserdata<span style="color: #008000;">&#40;</span> L, <span style="color: #0000dd;">this</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>            <span style="color: #666666;">//STACK:    em</span>
        lua_gettable<span style="color: #008000;">&#40;</span> L, LUA_REGISTRYINDEX <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>        <span style="color: #666666;">//STACK:    self</span>
        lua_pushstring<span style="color: #008000;">&#40;</span> L, <span style="color: #FF0000;">&quot;FireEvent&quot;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>            <span style="color: #666666;">//STACK:    &quot;FireEvent&quot;, self</span>
        lua_gettable<span style="color: #008000;">&#40;</span> L, <span style="color: #000040;">-</span><span style="color: #0000dd;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>                        <span style="color: #666666;">//STACK:    FireFunc, self</span>
        lua_pushvalue<span style="color: #008000;">&#40;</span> L, <span style="color: #000040;">-</span><span style="color: #0000dd;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>                        <span style="color: #666666;">//STACK:    self, FireFunc, self</span>
        lua_pushstring<span style="color: #008000;">&#40;</span> L, eventName.<span style="color: #007788;">c_str</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>        <span style="color: #666666;">//STACK:    self, eventName, FireFunc, self</span>
        PushArg<span style="color: #008000;">&#40;</span>a1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
        lua_pcall<span style="color: #008000;">&#40;</span> L, <span style="color: #0000dd;">3</span>, <span style="color: #0000dd;">0</span>, <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">void</span> PushArg<span style="color: #008000;">&#40;</span>CollisionEvent<span style="color: #000040;">*</span> EV<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">void</span> PushArg<span style="color: #008000;">&#40;</span>PickEvent<span style="color: #000040;">*</span> PE<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">void</span> PushArg<span style="color: #008000;">&#40;</span>InputEvent <span style="color: #000040;">*</span> IE<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #666666;">//here is what the PushArg for a Collision event looks like and how the new fire event is    </span>
    <span style="color: #666666;">//used.</span>
    <span style="color: #0000ff;">void</span> EventManager<span style="color: #008080;">::</span><span style="color: #007788;">PushArg</span><span style="color: #008000;">&#40;</span>CollisionEvent<span style="color: #000040;">*</span> EV<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        Luna<span style="color: #000080;">&lt;</span>CollisionEvent<span style="color: #000080;">&gt;</span><span style="color: #008080;">::</span><span style="color: #007788;">push</span><span style="color: #008000;">&#40;</span>L, EV, <span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #666666;">//Here is the Event System in action, using a Collision Event to pass collision data to lua.    </span>
&nbsp;
    CollisionEvent<span style="color: #000040;">*</span> CE <span style="color: #000080;">=</span> <span style="color: #0000dd;">new</span> CollisionEvent<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> id1 <span style="color: #000080;">=</span> pair.<span style="color: #007788;">actors</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>userData<span style="color: #008080;">;</span>
    <span style="color: #0000ff;">void</span><span style="color: #000040;">*</span> id2 <span style="color: #000080;">=</span> pair.<span style="color: #007788;">actors</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>userData<span style="color: #008080;">;</span>
    std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;collision:&quot;</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>id1<span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;::&quot;</span><span style="color: #000080;">&lt;&lt;</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>id2<span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;&lt;</span> std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>
    CE<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Obj1_ID <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>id1<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <span style="color: #666666;">//GameObject ID set at actor creation</span>
    CE<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>Obj2_ID <span style="color: #000080;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #000040;">*</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span><span style="color: #000040;">*</span><span style="color: #008000;">&#41;</span>id2<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    Events<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>fireEvent<span style="color: #000080;">&lt;</span>CollisionEvent<span style="color: #000040;">*</span><span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;Collision&quot;</span> , CE <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
   <span style="color: #666666;">//and lastly, the luna(r) implementation of a collision event </span>
&nbsp;
<span style="color: #339900;">#ifndef COLLISIONEVENT_H</span>
<span style="color: #339900;">#define COLLISIONEVENT_H</span>
&nbsp;
<span style="color: #339900;">#include &quot;luna.h&quot;</span>
<span style="color: #339900;">#include &lt;iostream&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">class</span> CollisionEvent
<span style="color: #008000;">&#123;</span>
  <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
    CollisionEvent<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    CollisionEvent<span style="color: #008000;">&#40;</span>lua_State <span style="color: #000040;">*</span>L<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    ~CollisionEvent<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">char</span> className<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">static</span> Luna<span style="color: #000080;">&lt;</span>CollisionEvent<span style="color: #000080;">&gt;</span><span style="color: #008080;">::</span><span style="color: #007788;">RegType</span> methods<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span>
    <span style="color: #666666;">//static const Luna&lt;Foo&gt;::RegType Register[];</span>
    <span style="color: #0000ff;">int</span> getObj1ID<span style="color: #008000;">&#40;</span>lua_State <span style="color: #000040;">*</span>L<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000ff;">int</span> getObj2ID<span style="color: #008000;">&#40;</span>lua_State <span style="color: #000040;">*</span>L<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
  <span style="color: #666666;">//private:</span>
    <span style="color: #0000ff;">int</span> Obj1_ID<span style="color: #008080;">;</span>
    <span style="color: #0000ff;">int</span>    Obj2_ID<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
<span style="color: #0000ff;">typedef</span> <span style="color: #0000ff;">struct</span> <span style="color: #008000;">&#123;</span> CollisionEvent <span style="color: #000040;">*</span>pT<span style="color: #008080;">;</span> <span style="color: #008000;">&#125;</span> CollisionEventdataType<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #339900;">#endif</span></pre></div></div>

<p>Phew, quite a bit. Here is how that very collision event code example is handled by a subscriber in lua.</p>

<div class="wp_syntax"><div class="code"><pre class="lua" style="font-family:monospace;">    <span style="color: #b1b100;">function</span> Obj:Collision<span style="color: #66cc66;">&#40;</span> CEvent <span style="color: #66cc66;">&#41;</span>
            t <span style="color: #66cc66;">=</span> CEvent:getObj2ID<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
            d <span style="color: #66cc66;">=</span> CEvent:getObj1ID<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
            <span style="color: #b1b100;">print</span><span style="color: #66cc66;">&#40;</span> t .. <span style="color: #ff0000;">&quot;,&quot;</span> .. d .. <span style="color: #ff0000;">&quot;:and my ID:&quot;</span> .. self.ID <span style="color: #66cc66;">&#41;</span>
    <span style="color: #b1b100;">end</span></pre></div></div>

<p>Not too bad huh?! </p>
<p>In conclusion, you can see that template functions and classes can go a long way in making it easy to provide many kinds of event types for an Event System. In Particular, you see how the update function in this event system lends itself to such an implementation in C++. I hope you found this post useful! Next will be on quaternions!</p>
<p>DB<br />
PS. thanks to dmail, ddn, and m_switch on the gamedev forums for the help in coming up with this.</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=111</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GDC, focus, and prototyping.</title>
		<link>http://deadbeefgames.com/blog/?p=109</link>
		<comments>http://deadbeefgames.com/blog/?p=109#comments</comments>
		<pubDate>Tue, 16 Mar 2010 18:11:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=109</guid>
		<description><![CDATA[The GDC was last week, and it gave me some perspective about what I&#8217;m doing and what we need. We have shifted gears and put this project into overdrive. We have prioritized what we need and have begun prototyping gameplay using the systems and sub-systems of the engine. It&#8217;s go time, crunch time, it&#8217;s time [...]]]></description>
			<content:encoded><![CDATA[<p>The GDC was last week, and it gave me some perspective about what I&#8217;m doing and what we need. We have shifted gears and put this project into overdrive. We have prioritized what we need and have begun prototyping gameplay using the systems and sub-systems of the engine. It&#8217;s go time, crunch time, it&#8217;s time to make a game, make it happen, and show the world what we can do.</p>
<p>Be excited for some upcoming announcements!</p>
<p>DB</p>
<input id="gwProxy" type="hidden" />
<input id="jsProxy" onclick="jsCall();" type="hidden" />
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=109</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checkin out the gdc today</title>
		<link>http://deadbeefgames.com/blog/?p=108</link>
		<comments>http://deadbeefgames.com/blog/?p=108#comments</comments>
		<pubDate>Fri, 12 Mar 2010 17:46:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=108</guid>
		<description><![CDATA[Hey everyone!
On my way to the gdc right now. I&#8217;ll provide a full update when I get back. Maybe I&#8217;ll see you there!
Db
]]></description>
			<content:encoded><![CDATA[<p>Hey everyone!</p>
<p>On my way to the gdc right now. I&#8217;ll provide a full update when I get back. Maybe I&#8217;ll see you there!</p>
<p>Db</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=108</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Expression Blend to spiffy up the interface</title>
		<link>http://deadbeefgames.com/blog/?p=102</link>
		<comments>http://deadbeefgames.com/blog/?p=102#comments</comments>
		<pubDate>Sun, 28 Feb 2010 06:22:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=102</guid>
		<description><![CDATA[So I was referred to Microsofts Expression Blend 3 by my friend who works with silverlight.  Expression Blend is a nice editor like tool used to design fancy shmancy gui&#8217;s in WPF and Silverlight.
The learning curve for it is slightly high (for the non designer, developer type like myself that at the moment is [...]]]></description>
			<content:encoded><![CDATA[<p>So I was referred to Microsofts Expression Blend 3 by my friend who works with silverlight.  Expression Blend is a nice editor like tool used to design fancy shmancy gui&#8217;s in WPF and Silverlight.</p>
<p>The learning curve for it is slightly high (for the non designer, developer type like myself that at the moment is still new to WPF), but given a couple weeks and with my backend in need of a more robust frontend, i think the time invested will have a nice payoff. The problem is i need to take some time to learn the thing. anyways, here is a picture of the interface.</p>
<div id="attachment_103" class="wp-caption aligncenter" style="width: 310px"><a href="http://deadbeefgames.com/blog/wp-content/uploads/2010/02/EB.jpg"><img class="size-medium wp-image-103" title="Expression Blend Interface" src="http://deadbeefgames.com/blog/wp-content/uploads/2010/02/EB-300x187.jpg" alt="Expression Blend Interface" width="300" height="187" /></a><p class="wp-caption-text">Expression Blend Interface</p></div>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=102</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excited for Nvidia&#8217;s Parallel Nsight</title>
		<link>http://deadbeefgames.com/blog/?p=97</link>
		<comments>http://deadbeefgames.com/blog/?p=97#comments</comments>
		<pubDate>Fri, 19 Feb 2010 01:28:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=97</guid>
		<description><![CDATA[I just watched the following video and I have to say this is what i have been waiting for! I hope the OpenGL support is as good as the D3D support.

]]></description>
			<content:encoded><![CDATA[<p>I just watched the following video and I have to say this is what i have been waiting for! I hope the OpenGL support is as good as the D3D support.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="450" height="375" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/c-K55PVZC5U&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6&amp;hd=1&amp;border=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="450" height="375" src="http://www.youtube.com/v/c-K55PVZC5U&amp;hl=en_US&amp;fs=1&amp;color1=0x006699&amp;color2=0x54abd6&amp;hd=1&amp;border=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=97</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

