<?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, 06 Aug 2010 15:32:46 +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: 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>3</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>
		<item>
		<title>OpenGL Engine in a WPF hosted Window.</title>
		<link>http://deadbeefgames.com/blog/?p=86</link>
		<comments>http://deadbeefgames.com/blog/?p=86#comments</comments>
		<pubDate>Mon, 08 Feb 2010 18:03:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Game Programming]]></category>
		<category><![CDATA[Graphics Articles]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=86</guid>
		<description><![CDATA[
I have been working on my editor as of late in hopes of being able to use it to make my simple demo I have been talking about. I found a lot of doubt on the internet about the ability to interop OpenGL with the WPF rendering stack.
Well, we got it to work and it [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter" src="http://deadbeefgames.com/GravitasPictures/WpfOpenGL.jpg" alt="Wpf OpenGL" width="474" height="395" /></p>
<p>I have been working on my editor as of late in hopes of being able to use it to make my simple demo I have been talking about. I found a lot of doubt on the internet about the ability to interop OpenGL with the WPF rendering stack.</p>
<p>Well, we got it to work and it is very similar to the setup I had used to get it working in WinForms. Here is how we did it. First of all, you need a 3D Engine with the ability to take an HWND and use that for rendering. A complete tutorial on how to do this can be found in a gamedev article <a href="http://www.gamedev.net/reference/programming/features/D3DCsharpWinform/">here</a>.</p>
<p>Once you get this far, its only a matter of creating some xaml.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Window</span> <span style="color: #000066;">x:Class</span>=<span style="color: #ff0000;">&quot;GravEdit.MainWindow&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:x</span>=<span style="color: #ff0000;">&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">Title</span>=<span style="color: #ff0000;">&quot;GravEdit&quot;</span> <span style="color: #000066;">Height</span>=<span style="color: #ff0000;">&quot;800&quot;</span> <span style="color: #000066;">Width</span>=<span style="color: #ff0000;">&quot;800&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;WindowsFormsHost</span> <span style="color: #000066;">x:Name</span>=<span style="color: #ff0000;">&quot;OpenGlPanel&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>        
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Window<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>And your C# for this xaml would look something like:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">public</span> <span style="color: #0600FF;">partial</span> <span style="color: #FF0000;">class</span> MainWindow <span style="color: #008000;">:</span> Window
        <span style="color: #000000;">&#123;</span>
            <span style="color: #0600FF;">private</span> GravWrap gravWrap <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> GravWrap<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//an instance of the engine</span>
            ILua LuaPortal<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF;">public</span> MainWindow<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                InitializeComponent<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Panel</span> panel <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Windows</span>.<span style="color: #0000FF;">Forms</span>.<span style="color: #0000FF;">Panel</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">OpenGlPanel</span>.<span style="color: #0000FF;">Child</span> <span style="color: #008000;">=</span> panel<span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//add the winform panel as a child to the winformhost</span>
                IntPtr LuaState <span style="color: #008000;">=</span> <span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">gravWrap</span>.<span style="color: #0000FF;">Initialize</span><span style="color: #000000;">&#40;</span>panel.<span style="color: #0000FF;">Handle</span>.<span style="color: #0000FF;">ToInt32</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//pass the panels hwnd.</span></pre></div></div>

<p>We created a Panel within the WinformsHost and that was it.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=86</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving and Loading Lua Tables to a file.</title>
		<link>http://deadbeefgames.com/blog/?p=81</link>
		<comments>http://deadbeefgames.com/blog/?p=81#comments</comments>
		<pubDate>Mon, 25 Jan 2010 17:43:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Game Programming]]></category>
		<category><![CDATA[Lua]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=81</guid>
		<description><![CDATA[So, you have integrated Lua into your game engine, you are able to write scripts that define game objects and program some game logic. But what happens when you want to stop your engine? Can you reproduce a game state 20 minutes in? Well, this is where saving/loading lua tables comes in handy.  If [...]]]></description>
			<content:encoded><![CDATA[<p>So, you have integrated Lua into your game engine, you are able to write scripts that define game objects and program some game logic. But what happens when you want to stop your engine? Can you reproduce a game state 20 minutes in? Well, this is where saving/loading lua tables comes in handy.  If your Lua environment is anything like mine, tables store everything.  And being able to save tables to a file and then re-load them completely intact can achieve this result.</p>
<p>You have 1 and a half options. why the half? Because I soon found out that 1 option provided half the result (really nothing since it mangled tables). Those options? <a href="http://lua-users.org/wiki/PickleTable">Lua Pickle</a> and <a href="http://lua-users.org/wiki/SaveTableToFile">Table.save</a> . These little Lua scripts provide the functionality described above.</p>
<p><strong>Lua Pickle</strong> is the half, not coming with the file writing functionality but it was easy to put in. The problem with Lua Pickle was that if you saved and loaded and saved again, certain values would come back mangled when loaded, which doesn&#8217;t do us any good! The script is 10 years old though so it&#8217;s alright, it made a good run. Lastly, it does not store functions, which is not surprising if you do not think of them as first class variables. If your tables are very simple and do not have sub tables and complex self references, this is a decent option.</p>
<p><strong>Table.save</strong> is what I use, however there is a catch. The test that runs it causes it to fail. They claim that using a tmpfile() in io is fast for huge tables you want to save, but the stdio tmpfile function was deprecated on the msdn site, so i had to avoid that &#8220;extra feature&#8221;. the cool thing about table save is it also can save functions, which, as long as you use some sort of encapsulation (meaning the functions only refer to variables that exist in the table) then you are good to go!</p>
<p>So that&#8217;s all for now, comments are welcome!</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=81</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update: Editor and Lua Lighting&#8230;</title>
		<link>http://deadbeefgames.com/blog/?p=80</link>
		<comments>http://deadbeefgames.com/blog/?p=80#comments</comments>
		<pubDate>Mon, 25 Jan 2010 17:28:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Game Programming]]></category>
		<category><![CDATA[Graphics Articles]]></category>
		<category><![CDATA[Lua]]></category>
		<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://deadbeefgames.com/blog/?p=80</guid>
		<description><![CDATA[I moved the lighting objects to lua, and more so removed some of the legacy lua code (no more sandbox). I&#8217;m running lua the way its intended to be run with the engine, initializing lua objects and relying on events for all of their updating. 
I started converting my editor to wpf, which actually is [...]]]></description>
			<content:encoded><![CDATA[<p>I moved the lighting objects to lua, and more so removed some of the legacy lua code (no more sandbox). I&#8217;m running lua the way its intended to be run with the engine, initializing lua objects and relying on events for all of their updating. </p>
<p>I started converting my editor to wpf, which actually is not all that bad.  </p>
]]></content:encoded>
			<wfw:commentRss>http://deadbeefgames.com/blog/?feed=rss2&amp;p=80</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
