<?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>Athena's Pad &#187; ORE</title>
	<atom:link href="http://athena.outer-reaches.com/wp/index.php/archives/category/ore/feed" rel="self" type="application/rss+xml" />
	<link>http://athena.outer-reaches.com/wp</link>
	<description>Notes from the codex of wisdom and war according to AthenaOfDelphi</description>
	<lastBuildDate>Sun, 27 Jun 2010 15:58:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>ORE Shared Memory</title>
		<link>http://athena.outer-reaches.com/wp/index.php/archives/165</link>
		<comments>http://athena.outer-reaches.com/wp/index.php/archives/165#comments</comments>
		<pubDate>Thu, 22 Mar 2007 01:25:15 +0000</pubDate>
		<dc:creator>AthenaOfDelphi</dc:creator>
				<category><![CDATA[ORE]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://athena.outer-reaches.com/wp/index.php/archives/165</guid>
		<description><![CDATA[After last nights post about implementing ORE, I tried a few more experiments in the hope that I&#8217;d be able to achieve my goal of having a BDS compiled EXE load an FPC compiled DLL and share objects between the two.
The biggest obstacle to implementing my goal is being able to allocate memory that is [...]]]></description>
			<content:encoded><![CDATA[<p>After last nights post about implementing ORE, I tried a few more experiments in the hope that I&#8217;d be able to achieve my goal of having a BDS compiled EXE load an FPC compiled DLL and share objects between the two.<span id="more-165"></span></p>
<p>The biggest obstacle to implementing my goal is being able to allocate memory that is fully accessible on both sides of the application/DLL boundary.  This is key to being able to share objects across the boundary.</p>
<p>Inspired by some sample code from Technomage, I hooked the EXE&#8217;s memory manager into the DLL&#8217;s memory manager.  Due to the differences in implementation, this required some intermediate functions, but, the DLL loaded and the EXE appeared to be able to allocate (and to a certain extent use) memory using the DLL&#8217;s memory manager&#8230; so things were looking up.</p>
<p>Unfortunately, as the initialisation phase was nearing completion, *BOOM* EInvalidPointer exceptions.  The strange thing about this is that by that stage, it had already requested a number of blocks of memory that in many cases had actually had data written to them.</p>
<p>Try as I might, I couldn&#8217;t find the cause.  But as soon as I compiled the DLL with BDS the problem went away and I had memory shared between the EXE and the DLL and I was able to pass objects across the app/DLL boundary with no problems at all.</p>
<p>I guess somethings just aren&#8217;t meant to be.</p>
<p>Still, there are other options for compiling the DLL, including the free Turbo Explorer, so I think I&#8217;m going to plod on and get the system working entirely with BDS and then worry about the finer points of implementation at a later stage.  One option could be to actually have both the app and the DLL hook their memory managers into a memory manager in another DLL.</p>
<p>But, one good thing has come out of all this&#8230; many of the concerns and questions I had about the design of ORE are now cleared up as I&#8217;m going to make the assumption that I can share objects across the application/DLL boundary.  This frees up the design quite considerably since I don&#8217;t have to worry about a whole bunch of pointer transfer mechanisms&#8230; I can just pass an object.</p>
<p>And on the design front, I&#8217;ve made some progress with the statemachines in the play engine.</p>
<p>Main play engine statemachine:-</p>
<div align="center"><img src='http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/statediagram_main.png' alt='Play Engine - Main Statemachine' /></div>
<p>Initialisation statemachine:-</p>
<div align="center"><img src='http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/statediagram_initialising.png' alt='Play Engine - Initialisation Statemachine' /></div>
<p>Thats about it for now, overall progress has been a little slow over the last week or so, mainly due to trying to figure out all my convoluted data transfer mechanisms to get around the app/DLL boundary issues, but now I&#8217;ve got that side of things straight in my mind, I&#8217;m hoping things will speed up a little (they better do as I&#8217;m looking forward to making The Outer Reaches &#8211; Rise of The Raiders with the new engine <img src='http://athena.outer-reaches.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
]]></content:encoded>
			<wfw:commentRss>http://athena.outer-reaches.com/wp/index.php/archives/165/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORE Implementation Obstacles</title>
		<link>http://athena.outer-reaches.com/wp/index.php/archives/127</link>
		<comments>http://athena.outer-reaches.com/wp/index.php/archives/127#comments</comments>
		<pubDate>Tue, 20 Mar 2007 22:07:41 +0000</pubDate>
		<dc:creator>AthenaOfDelphi</dc:creator>
				<category><![CDATA[ORE]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://athena.outer-reaches.com/wp/index.php/archives/127</guid>
		<description><![CDATA[Its been a bit of a slow week (and a bit) for ORE.  Firstly&#8230; design&#8230; it doesn&#8217;t half get in the way and secondly&#8230; nice in theory&#8230; hellish in practice&#8230; my theories about how to shift data around the system have largely evaporated.
Design&#8230; I&#8217;ve tried several times to design my software before I write [...]]]></description>
			<content:encoded><![CDATA[<p>Its been a bit of a slow week (and a bit) for ORE.  Firstly&#8230; design&#8230; it doesn&#8217;t half get in the way and secondly&#8230; nice in theory&#8230; hellish in practice&#8230; my theories about how to shift data around the system have largely evaporated.<span id="more-127"></span></p>
<p>Design&#8230; I&#8217;ve tried several times to design my software before I write it and every single time I reach a point I just can&#8217;t get past.  My mind gets clouded with a plethora of questions&#8230; can it?  will it?  what if?  and the whole design process grinds to a halt.  This normally results in me sitting there trying to break though the mental blocks that have crept in&#8230; ultimately I fail and its at that point I say &#8216;screw the design&#8230; LETS CODE <img src='http://athena.outer-reaches.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  &#8216;</p>
<p>This time it happened, and I found myself hacking away at one of the data transfer objects.  Now, I&#8217;m so glad I did because things have progressed&#8230; kind of, but more on that below&#8230; the thing is, my design was blocked by questions&#8230; I&#8217;ve answered some of these by coding and this is where I&#8217;ve been going wrong&#8230; so blinded by my desire to have a design before code have I been that I&#8217;ve forgotten some very important things.</p>
<p>Design is an iterative process, just like the actual coding&#8230; you can&#8217;t finish a design without doing your research, without being able to make informed decisions about the how&#8217;s and the what if&#8217;s&#8230; the only way to make informed decisions is to do&#8230; prototype, test, tinker.</p>
<p>It sounds obvious and it truly is obvious, but for some reason I just didn&#8217;t think like that.  I have a CASE tool that can reverse my prototyping into the model, so I can tinker around, solve a problem, reverse it into the model and continue with the guts of the design.  DOH! Why didn&#8217;t I think of that a week ago?</p>
<p>Anyhow, in my enlightened state, I&#8217;ve been tinkering with the general theory of how ORE is going to come together.</p>
<p>The concept of having the play engine (Compiled with BDS 2006) and a game function library (Compiled with FreePascal) is excellent&#8230; in theory.</p>
<p>Until of course you consider the reality.</p>
<p>I figured I&#8217;d ship data around with pointers&#8230; one of the things I needed was a TINIFile style object for a general purpose data store.  I wrote one that used linked lists, but its performance against my favourite (TMemoryINI) was diabolicle, so back to the drawing board&#8230; I created a variant of TStringList called TExposedStringList that exposed its data store via a property, allowing you to create two instances of the object and plug one instances data store into the other (cross the App/DLL boundary for example) and then used this to create TExposedMemoryINI whic used TExposedStringLists for its data storage.</p>
<p>In the end, there were no strings in these two objects&#8230; everything was done with base data types, pointers and PChars for strings.</p>
<p>Unfortunately, across the app/DLL boundary its still no good.  Weird things start to happen once you allocate memory on both sides and deallocate it.  So, its become plainly obvious that I&#8217;m going to have to use a shared memory manager&#8230; the worst thing about this is that it has to be Delphi and FPC compatible.</p>
<p>But this is actually a good thing&#8230; with a shared memory manager, I should (if the object mechanisms are compatible) be able to ship objects across the boundary instead of transfering all the data using pointers <img src='http://athena.outer-reaches.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Many thanks to Robert, Technomage and Chebmaster on PGD for bouncing a few ideas around.  Gave me a lot of food for thought and experimentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://athena.outer-reaches.com/wp/index.php/archives/127/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORE gets off the ground</title>
		<link>http://athena.outer-reaches.com/wp/index.php/archives/76</link>
		<comments>http://athena.outer-reaches.com/wp/index.php/archives/76#comments</comments>
		<pubDate>Mon, 12 Mar 2007 13:05:32 +0000</pubDate>
		<dc:creator>AthenaOfDelphi</dc:creator>
				<category><![CDATA[ORE]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://athena.outer-reaches.com/wp/index.php/archives/76</guid>
		<description><![CDATA[Well, after nearly 12 months of no action, I&#8217;ve decided its about time to resurrect our PGD competition entry from 2006. I&#8217;ve also decided that although we&#8217;re going to try and sell it, I&#8217;m going to keep a track of how things are progressing with the project on here.
Since theres a good chance you don&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Well, after nearly 12 months of no action, I&#8217;ve decided its about time to resurrect our <a href="http://www.pascalgamedevelopment.com" target="_blank">PGD</a> competition entry from 2006. I&#8217;ve also decided that although we&#8217;re going to try and sell it, I&#8217;m going to keep a track of how things are progressing with the project on here.<span id="more-76"></span></p>
<p>Since theres a good chance you don&#8217;t know what the aims of the competition entry were, let me give you a brief overview. We wanted to create a top down 2D retro style roleplaying game (Hence the name&#8230; Outer Reaches Retro Roleplay Engine &#8211; or *ORE* for short). To begin with, the competition entry was looking good considering it was the first time I&#8217;d ever written a client based game engine, but towards the end&#8230; it was a nightmare.</p>
<p>The first thing I guess is to say where I went wrong with the orginal&#8230; thats easy&#8230; time pressure throughout the competition meant I made decisions on the fly without actually thinking about what I was doing. The net result was some very poor decisions that had serious consequences the further into the project I got. I actually had to rewrite the whole play engine in an attempt to make the final deadline, but to no avail&#8230; we lost by a whisker <img src='http://athena.outer-reaches.com/wp/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  to Tanx.</p>
<p>So, the first thing to do this time around is to actually think about what I&#8217;m doing and to try and address some of the issues that caused problems with the competition entry.</p>
<p>The first major hurdle was load times&#8230; All our image data was stored in an imagelist that formed part of the game data object that held everything about the game as a whole. When the game started, it had to decompress this object (a requirement of the competition was submissions that were less than 20MB in size)&#8230; this took an age, but what was weird was it took longer on faster machines? Scratch my head did I, but I couldn&#8217;t explain why this should be. Anyhow, this also created problems elsewhere&#8230; I was using unDelphiX and one thing that its not so hot on is dynamically loading media&#8230; you have to deinitialise it, load your media and then reinitialise. You also have to do this when changing from full screen to windowed mode. So, the more image data you have, the longer this process takes.</p>
<p>The other major hurdle was script execution times&#8230; Since I was going for flexibility everything was event driven and all the events ran Delphi Web Script II scripts. This sounds great, but it lead to some jerkiness when you moved&#8230;. you&#8217;d run into a new map cell and*clunk* a short but noticeable stop as the system waited for events to be checked and executed as required.</p>
<p>The final hurdle was one that any project can end up with if careful thought and consideration isn&#8217;t given to the guts of the system&#8230; Object/class/data mishmash. Not to put too fine a point on it, the code was a mess&#8230; convoluted callbacks, unnecessary checks in the play engine, and in general&#8230; code that was cobbled together on the fly in a complete rush to meet competition deadlines.</p>
<p>With these issues in mind, I&#8217;ve started work on a new version <img src='http://athena.outer-reaches.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  One which *shock* *horror* I&#8217;m actually designing&#8230; yes, you did read correctly&#8230; designing first. I&#8217;ve decided its about time I did a proper job on one of my own projects so that instead of it becoming a mess, it actually has a decent chance of becoming a real viable little product.</p>
<p>So, without further ado, I&#8217;d like to introduce the first three class diagrams&#8230;.</p>
<p>First up, its the map editor brush classes. These will be used to build complex brushes within the map editor allowing the placement of multi-tile elements, scripts, visibility etc. with a single click.</p>
<p align="center"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/oreclasses2_120307.png" id="image74" alt="ORE Editor Map Brush Classes" /></p>
<p>Next up, the map zone classes. These will be used to provide &#8216;zones&#8217; on the maps. You could be in a forest zone for example, that will have the sound of birdsong playing&#8230; you could be within earshot of running water (a river)&#8230; I&#8217;m sure you get the picture.</p>
<p align="center"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/oreclasses1_120307.png" id="image73" alt="ORE Map Zone Classes" /></p>
<p>And finally&#8230; the map container classes.</p>
<p align="center"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/oreclasses3_120307.png" id="image75" alt="ORE Map Classes" /></p>
<p>Its not much, BUT, the map brush and map zone classes are complete <img src='http://athena.outer-reaches.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   So, its a start and a huge step in the right direction.</p>
<p>And here is what the old ORE engine did at the end of the competition&#8230;.</p>
<p align="center"><a href="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/level1.jpg" class="imagelink" title="Screenshot of old ORE in action"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/level1.thumbnail.jpg" id="image87" alt="Screenshot of old ORE in action" /></a> <a href="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/store.jpg" class="imagelink" title="Screenshot of old ORE in action"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/store.thumbnail.jpg" id="image89" alt="Screenshot of old ORE in action" /></a> <a href="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/instore.jpg" class="imagelink" title="Screenshot of old ORE in action"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/instore.thumbnail.jpg" id="image83" alt="Screenshot of old ORE in action" /></a></p>
<p align="center"><a href="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/itemdetails.jpg" class="imagelink" title="Screenshot of old ORE in action"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/itemdetails.thumbnail.jpg" id="image84" alt="Screenshot of old ORE in action" /></a> <a href="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/level1end.jpg" class="imagelink" title="Screenshot of old ORE in action"><img src="http://athena.outer-reaches.com/wp/wp-content/uploads/2007/03/level1end.thumbnail.jpg" id="image88" alt="Screenshot of old ORE in action" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://athena.outer-reaches.com/wp/index.php/archives/76/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
