<?xml version="1.0" encoding="ISO-8859-1"?>
<rdf:RDF
	xmlns="http://purl.org/rss/1.0/"
	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
	xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel rdf:about="http://feeds.garagegames.com/rss/blogs/developer/67783/">
		<title>Blog for Amr Bekhit at GarageGames.com</title>
		<description>Blog feeds for Gamers and Developers in the GarageGames community.</description>
		<link>http://www.garagegames.com/</link>
		<image rdf:resource="http://www.garagegames.com/images/GarageGames_logo_small_w.gif" />
		<dc:date>2008-09-07T00:57:46+00:00</dc:date>
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://www.garagegames.com/blogs/67783/10749"/>
				<rdf:li rdf:resource="http://www.garagegames.com/blogs/67783/10697"/>
				<rdf:li rdf:resource="http://www.garagegames.com/blogs/67783/10677"/>
			</rdf:Seq>
		</items>
	</channel>
	<item rdf:about="http://www.garagegames.com/blogs/67783/10749">
		<dc:format>text/html</dc:format>
		<dc:date>2006-06-20T19:22:38+00:00</dc:date>
		<dc:creator>Amr Bekhit</dc:creator>
		<title>Thing learn't in 3DGPAI1: CH5 + Added thoughts</title>
		<link>http://www.garagegames.com/blogs/67783/10749</link>
		<description>Hoi!&lt;br&gt;&lt;br&gt;Back again with some more info learnt from this book. I have to admit, at times going through the book can be very tedious due to the large amounts of typing. This chapter has been the longest so far. The other alternative is for me to copy the source code from the CD and use that--but the good thing about typing the code all out is that you examine the code more thoroughly, in my opinion, than just reading what someone else has written.&lt;br&gt;&lt;br&gt;Another thing too: the author seems to go for the style of laying down the code first, then explaining it later. I'm not really in favour of that method. I prefer the style where explanations come first, then the code is put down to illustrate. For me, I feel that is better as I'll be writing code that I know how it works. Anyone ever read a rather old book called Teach Yourself Game Programming in 21 Days, by the amazing Andre LaMothe? I really enjoyed that book and felt I learnt a lot from it, one of the reasons being it did the explaining before putting down the code.&lt;br&gt;&lt;br&gt;Anyway, without further ado, chapter 5:&lt;br&gt;&lt;br&gt;The GameConnection.SetConnectArgs is a way of passing information form client to server when the client connects. I guess what you put there is up to you.&lt;br&gt;&lt;br&gt;Canvas.SetContent will display the gui object passed as a parameter onto the screen and Canvas.SetCursor will modify the cursor-I assume that the parameter passed by SetCursor is some sort of cursor profile or datablock.&lt;br&gt;&lt;br&gt;onWake: an event which occurs when the GUI object is displayed.&lt;br&gt;onSleep: an event which occurs when the GUI object is removed from the display.&lt;br&gt;&lt;br&gt;Pushdialog and PopDialog: Seems that torque incorporates a dialog stack. If you want to display a new dialog, you use pushDialog. When you do that, you can't interact with any other dialogs pushed before this one, without closing this dialog first by using PopDialog()&lt;br&gt;&lt;br&gt;Regular Push and Pop command will simply display and hide stuff, but won't implement this modal behaviour as with Push/PopDialog.&lt;br&gt;&lt;br&gt;When binding a function to an ActionMap, the function should have just one parameter. This parameter is set to 1 when the key is pressed and set to 0 when the key is released.&lt;br&gt;&lt;br&gt;The Schedule function allows you to have commands run after a particular time interval. The return value of the function is an event ID, which can be used to later cancel the scheduled event using the Cancel command. The thing I didn't quite understand at first is the 2nd parameter in the function, the reference. After searching through the forums, I found a post here: http://www.garagegames.com/mg/forums/result.thread.php?qt=22272 (3rd post), which indicates that the reference parameter is an object. If that object does not exists when the schedule function kicks in, then the schedule won't be called at all and will be cancelled.&lt;br&gt;Further reading confirms that a call to schedule like this:&lt;br&gt;Schedule(100,$someobj,&amp;quot;somefunc&amp;quot;);&lt;br&gt;&lt;br&gt;Is the same as this:&lt;br&gt;&lt;br&gt;$someobj.schedule(100,&amp;quot;somefunc&amp;quot;);&lt;br&gt;&lt;br&gt;So it makes sense that if $someobj is destroyed, the schedule function won't be called.&lt;br&gt;&lt;br&gt;&lt;br&gt;In the player.cs file, it confused me that some of the defined functions had a MaleAvatar namespace added before them, whereas others had HumanMaleAvatar. Now, the datablock name is HumanMaleAvatar and the datablock className property is set to MaleAvatar. The name MaleAvatar is arbitrary, so I could change it to SomeClass, and then change the namespaces of all the MaleAvatar functions to SomeClass and the game works just fine. The question is, why are some functions defined with the className namespace, and others with the Datablock name namespace? I understand that by defining functions with the datablock name namespace, I am essentially defining member functions for the datablock, but what of functions defined using the className namespace?&lt;br&gt;&lt;br&gt;Now here's another thing. It seems that it doesn't matter which namespace the functions are part of. As a test, I replaced all the namespaces with HumanMaleAvatar and the game seemed to work fine. Then I replaced them all with MaleAvatar and again the game seemed to work fine...hmm...&lt;br&gt;&lt;br&gt;Some more experimentation: Removing the onCollision function meant that the player stopped colliding with things like the weapons and ammo. Removing onImpact seemed to only remove the damage caused by falling from high places; seems to deal with collision with terrain and interiors.&lt;br&gt;&lt;br&gt;I felt the rest of the code, although not explained in depth, was relatively self-explanatory in what it did.&lt;br&gt;&lt;br&gt;I also modified the code to add a time limit too (as suggested). A schedule was all that was needed, and a dialog box for added fanciness at the end. I also took this oppurtunity to modify the source code of the engine too. While doing the time limit code, I realised the need for a function which returns the integer part of a number. So, I added a &lt;b&gt;mInt&lt;/b&gt; function to the source and works a treat!&lt;br&gt;&lt;br&gt;Battling on to chapter 6...&lt;br&gt;&lt;br&gt;--Amr</description>
	</item>
	<item rdf:about="http://www.garagegames.com/blogs/67783/10697">
		<dc:format>text/html</dc:format>
		<dc:date>2006-06-13T17:22:33+00:00</dc:date>
		<dc:creator>Amr Bekhit</dc:creator>
		<title>Things learn't from 3DGPAI1: Ch4</title>
		<link>http://www.garagegames.com/blogs/67783/10697</link>
		<description>Back again with another list of things learnt from the book. Initially I though that the book had a tendancy to put things down and not explain them. After reading on I get the impression that some things will be explained later on in the book. What's more, the book is very comprehensive: it seems to cover all aspects of making again except audio--even goes thorugh how to texture, UV map, model weapons, characters and static world objects, how to rig them and animate them. If the book were to go indepth on code it'd be massive. I recently ordered the Game Programmer's Guide to Torque so that'll hopefully give me more indepth info on the code and the Advanced 3DGPAI1 is worth looking into too...&lt;br&gt;&lt;br&gt;-The OnStart and OnExit functions of a class seem to act like constructors and destructors in other programming languages, except the OnStart doesn't get called when the class is exec'd.&lt;br&gt;&lt;br&gt;-nextToken is a very useful function for parsing a list of tokens in a string that are seperated by a particular character, e.g &amp;quot;one,two,three,four,five&amp;quot;. What it will do is take the tokenised string, then extrtact the first token from it, and return to you the original string WITHOUT that token and its seperator character. You can then use this new string to extract the next token, and so on. So in this case, the extracted token would be &amp;quot;one&amp;quot; and the returned string would be &amp;quot;two,three,four,five&amp;quot;.&lt;br&gt;&lt;br&gt;-SetModPaths: The wiki states that this function sets the current mod path to the value specified in the parameter. I think this means that if I set a mod path to &amp;quot;common&amp;quot;, then I can exec a script by calling its name and the engine will automatically look in the 'common' folder for it. It turns out by experimentation that this doesn't work for scripts-apparently used by the &lt;i&gt;resource manager&lt;/i&gt;. I guess scripts don't come under that then.&lt;br&gt;&lt;br&gt;-Packages: A package is collection of functions only. When a package is loaded using the ActivatePackage function, the functions in the package will override any existing loaded functions that have the same name. A package is unloaded using the DeactivatePackage function. This also unloads any packages that were activated after this one. A function can call is predecessor by using the Parent:: namespace.&lt;br&gt;I can see how this is useful: one might have a group of core functions that need to behave differently during different states in a game. When a new state takes place, its corresponding package can be loaded and the same core functions can be called in exactly the same way, but will behave differently. Now why does the book use a package in the control/main.cs file? Removing the package and placing the functions inline causes TGE to crash, so it clearly has a reason. From what I understand about packages, any subsequent calls to OnStart and OnExit will refer to the functions in the package.&lt;br&gt;&lt;br&gt;-The functions InitBaseServer and initBaseClient are written by the author and they simply exec some files that setup the server and client respectively.&lt;br&gt;&lt;br&gt;-The createServer function is another of the common routines and seems to simply load a mission. However, if you specify a multiplayer server, it will do a little bit more and setup network ports and allow the game to accept external connections.&lt;br&gt;&lt;br&gt;-Initcanvas seems pretty self explanatory; it creates a window which is ready for stuff to be drawn to. The functions first sorts out some preferences that the scripter specifies in code (or maybe derived from an options menu), loads the common guis the engine uses and some scripts related to the gui and then initializes the sound system.&lt;br&gt;&lt;br&gt;-GameConnection seems to be a C++ class, but had some trouble finding more detailed info about it. Information derived so far is that it handles anything related to the network connection: Spawning players, handling client connections are the examples used in the book.&lt;br&gt;&lt;br&gt;-I think ActionMap is another C++ object. Used to map input methods like the keyboard and mouse to functions using the Bind function, where you state the particular input and the function you would like it to trigger.&lt;br&gt;&lt;br&gt;-GameTSCtrl is a subclass of the GUI and is tailored to render the 3D scenes required in the game.&lt;br&gt;&lt;br&gt;-onWake is a GUI related event, but can't find any details on WHEN it occurs. Book says it occurs when 'the control becomes active'. Hmm...what do you mean by active?&lt;br&gt;&lt;br&gt;On to chapter 5...&lt;br&gt;&lt;br&gt;--Amr</description>
	</item>
	<item rdf:about="http://www.garagegames.com/blogs/67783/10677">
		<dc:format>text/html</dc:format>
		<dc:date>2006-06-10T17:42:48+00:00</dc:date>
		<dc:creator>Amr Bekhit</dc:creator>
		<title>Things Learnt from 3D Game Programming All in one</title>
		<link>http://www.garagegames.com/blogs/67783/10677</link>
		<description>Recently bought the TGE and TSE lisences and bought the 3DGPAI1 book to get started. I thought it might be useful to write down key things I learn as I go along and posting them here may help others.&lt;br&gt;&lt;br&gt;-To loads up scripts that you want the program to use, you use EXEC. When the scripts are loaded using exec, the inline code is called. The main body of the script is where you place the inline code and can be considered the main() function of the class. When the module is exec'd, the main code is run and can make calls to any of the functions present in the script&lt;br&gt;&lt;br&gt;-In the 3Dgpai1 book, I noticed that he used the function Main in his classes. A bit of experimentation showed that removing the function Main and putting the code inline has exactly the same effect.&lt;br&gt;&lt;br&gt;-Switch seems to work fine with strings...perhaps switch$ isn't really necessary?&lt;br&gt;&lt;br&gt;-Datablocks are used to group properties together in an easy to use variable. The syntax is as follows:&lt;br&gt;&lt;br&gt;Datablock Datablocktype(datablockname)&lt;br&gt;&lt;br&gt;Datablocktype defines the properties that this datablock has.&lt;br&gt;&lt;br&gt;-Use GetWord and SetWord to change values withing strings&lt;br&gt;&lt;br&gt;-SetTransform is used to set the position and rotation of an object:&lt;br&gt;&lt;br&gt;SetTransform(&amp;quot;px py pz rx ry rz rd&amp;quot;)&lt;br&gt;Px py pz; XYZ coordinates of the rotation&lt;br&gt;&lt;br&gt;Rx ry rz rd define a quaternion: the rx ry rz define the axis of rotration and the rd defines the angle in degrees.&lt;br&gt;&lt;br&gt;In the rotation example in chapter 3, it seems that the TGE uses radians? However, messing around with the world editor in the TGE 1.4 demos shows that it is using degrees! Perhaps the author has modified the engine?</description>
	</item>
</rdf:RDF>
