<?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>VectorStorm Blog &#187; MMORPG Tycoon</title>
	<atom:link href="http://www.vectorstorm.org/category/full-games/mmorpg-tycoon/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vectorstorm.org</link>
	<description>Creating games, one brightly glowing line at a time.</description>
	<lastBuildDate>Wed, 08 Feb 2012 09:14:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>More on custom terrain editing</title>
		<link>http://www.vectorstorm.org/2012/02/08/more-on-custom-terrain-editing/</link>
		<comments>http://www.vectorstorm.org/2012/02/08/more-on-custom-terrain-editing/#comments</comments>
		<pubDate>Wed, 08 Feb 2012 09:13:52 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2362</guid>
		<description><![CDATA[It occurred to me today that my post yesterday was kind of uninspiring.  &#8221;Oh look, I can make hills that are slightly sharper than the ones which I was making before.  Yay.&#8221; I wanted to make a point about the flexibility of the system, so I present you with the letter &#8220;A&#8221; stamped into the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vectorstorm.org/wp-content/uploads/2012/02/A.jpg"><img class="alignleft size-medium wp-image-2363" title="A" src="http://www.vectorstorm.org/wp-content/uploads/2012/02/A-300x173.jpg" alt="" width="300" height="173" /></a>It occurred to me today that my post yesterday was kind of uninspiring.  &#8221;Oh look, I can make hills that are slightly sharper than the ones which I was making before.  Yay.&#8221;</p>
<p>I wanted to make a point about the flexibility of the system, so I present you with the letter &#8220;A&#8221; stamped into the terrain.  Doing this required no code changes;  just creating the brush texture (which I&#8217;ve pasted over the screenshot in the image), and editing two data files (one to tell the cursor how to use the image, and one to add it as an action bar button).  All up, it took about five minutes.  (About half as long as it took me to write this post)</p>
<p>I don&#8217;t imagine that anyone will actually want to create a world with the letter &#8220;A&#8221; stamped into the terrain.  But this approach is extremely flexible, and should make it much easier for folks to customise the interface to make it more convenient for themselves and/or others.</p>
<p>Now I just need to make the GUI not be quite so terrible, visually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2012/02/08/more-on-custom-terrain-editing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editing terrain editing</title>
		<link>http://www.vectorstorm.org/2012/02/07/editing-terrain-editing/</link>
		<comments>http://www.vectorstorm.org/2012/02/07/editing-terrain-editing/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 11:06:10 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2359</guid>
		<description><![CDATA[Today I started hooking up properly moddable terrain editing tools.  This will both allow me to develop terrain editing capabilities more quickly (and with less code!) and also allow end users who are interested to do so, to create their own terrain editing abilities, including adding additional options to the toolbars. What I&#8217;ve done is [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vectorstorm.org/wp-content/uploads/2012/02/CustomisableTerrainBrushes.jpg"><img class="alignleft size-medium wp-image-2360" title="CustomisableTerrainBrushes" src="http://www.vectorstorm.org/wp-content/uploads/2012/02/CustomisableTerrainBrushes-300x173.jpg" alt="" width="300" height="173" /></a></p>
<p>Today I started hooking up properly moddable terrain editing tools.  This will both allow me to develop terrain editing capabilities more quickly (and with less code!) and also allow end users who are interested to do so, to create their own terrain editing abilities, including adding additional options to the toolbars.</p>
<p>What I&#8217;ve done is set up terrain tools to be able to reach image files, and use those images to determine how they affect the terrain when applied.  50% grey means no change, lighter colours go up, darker ones go down.  By changing the ramping or the shape, you can get terrain editing to automatically make different types of terrain shapes.  In the screenshot here, I have made a much steeper hill than is normally easy to create, just by using a tighter gradient than normal (gradient image shown on the right).</p>
<p>I&#8217;ve also exposed a lot more internal variables to be modified via simple text data files.  Tomorrow, I&#8217;ll be filling this out a bit further;  adding steep chasms, craters, and similar shapes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2012/02/07/editing-terrain-editing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A long-expected party</title>
		<link>http://www.vectorstorm.org/2012/01/29/a-long-expected-party/</link>
		<comments>http://www.vectorstorm.org/2012/01/29/a-long-expected-party/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 08:18:26 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2353</guid>
		<description><![CDATA[So here&#8217;s something I&#8217;ve been waiting an awful long time to see; I&#8217;ve finally reached the end of the massive AI refactoring job that has been consuming so much of my spare time over the past few months (that&#8217;s overstating it; I&#8217;ve really only been feeling up to outside-of-work coding for a few hours per [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vectorstorm.org/wp-content/uploads/2012/01/SourceTreeScreenSnapz001.jpg"><img class="alignleft size-medium wp-image-2354" title="Git Repo" src="http://www.vectorstorm.org/wp-content/uploads/2012/01/SourceTreeScreenSnapz001-300x146.jpg" alt="" width="300" height="146" /></a></p>
<p>So here&#8217;s something I&#8217;ve been waiting an awful long time to see; I&#8217;ve finally reached the end of the massive AI refactoring job that has been consuming so much of my spare time over the past few months (that&#8217;s overstating it; I&#8217;ve really only been feeling up to outside-of-work coding for a few hours per week, so this hasn&#8217;t actually taken up all that much of my time), and have merged it back into the main development trunk of MMORPG Tycoon 2.</p>
<p>What does this mean? Well.. not a lot, immediately; mostly it&#8217;s doing the same things that it was doing before, just with much more well-organised code. There are probably a few new bugs in the AI which weren&#8217;t there before (as this new implementation hasn&#8217;t been as extensively tested as the old one). But the architecture of the system is much, much better now.</p>
<p>For example, the handling of human-controlled PCs and AI-controlled PCs move through almost identical code paths. This means that human-controlled PCs now receive experience points and level up and get quest completion credit, the same way that AI-controlled ones do. The <a href="http://en.wikipedia.org/wiki/Bartle_Test" onclick="pageTracker._trackPageview('/outgoing/en.wikipedia.org/wiki/Bartle_Test?referer=');">Bartle type</a> of a PC is now stored on the subscriber, not on the individual character.. which means that no matter how many alts a subscriber makes, they&#8217;ll all have the same Bartle type, as you&#8217;d expect (which wasn&#8217;t the case, before). Similarly, the various desires (&#8220;socialise&#8221; vs &#8220;gain level&#8221;, etc) are now on the subscriber instead of on the PC, so a subscriber could now theoretically meet a desire to socialise by logging in with a different character, which was not previously possible.</p>
<p>But more important than that, all of the AI logic has been pulled apart into clean(er) modules, so it should now be much, much easier for me to insert new AI behaviours, such as adventuring as a party or as a guild.</p>
<p>I have also begun work on supporting different xp allocation mechanisms. Previously, MMORPG Tycoon 2 allocated experience points to every PC who thought they were attacking a monster when it died, whether or not they actually ever hit it (and similarly, any PC who chose to run away after damaging the monster would receive no XP if it was killed immediately afterward). Now, monsters keep track of who has damaged them, and award XP to those PCs. This also will be important for supporting party-based adventuring.</p>
<p>So what&#8217;s up next? Well, I&#8217;m really wanting to push ahead with some world editing interface work, and I&#8217;m thinking really hard about whether the MMORPG Tycoon 1-style spline roads are really a good choice, here, or whether a more traditional &#8220;tile grid&#8221;-based road system would make more sense for a game that&#8217;s played from this close up. The problem with spline roads is that a slight movement to a long road can require huge amounts of terrain modification &#8212; often I have to rebuild almost a quarter of the visible terrain in order to cope with a path that&#8217;s now taking a slightly different direction. Maybe the simple tile grid layout would help localise changes more. Although I really do like the freeform paths, I must confess.</p>
<p>Anyhow, moving on! There&#8217;ll be some general life news later in the week, as well. Further details then!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2012/01/29/a-long-expected-party/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Profiling is fun</title>
		<link>http://www.vectorstorm.org/2011/10/09/profiling-is-fun/</link>
		<comments>http://www.vectorstorm.org/2011/10/09/profiling-is-fun/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 08:02:21 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Engine]]></category>
		<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>
		<category><![CDATA[VectorStorm]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2269</guid>
		<description><![CDATA[Actually, that&#8217;s a dirty lie. Profiling is fun when it shows you something big that&#8217;s easy to fix.  Profiling is a lot less fun when everything is equally slow.  But luckily in my case, there was something big to fix.  :) I noticed the other day that editing roads in MMORPG Tycoon 2 had become [...]]]></description>
			<content:encoded><![CDATA[<p>Actually, that&#8217;s a dirty lie.</p>
<p>Profiling is fun when it shows you something big that&#8217;s easy to fix.  Profiling is a lot less fun when everything is equally slow.  But luckily in my case, there was something big to fix.  :)</p>
<p>I noticed the other day that editing roads in MMORPG Tycoon 2 had become extremely slow.  (Well.. actually I noticed that roads didn&#8217;t draw at all.  It was only after I fixed them not drawing that I noticed that they were slow to edit).   This was odd, because I have videos of early road editing, where it hardly touched the frame rate at all on a system much slower than the one I&#8217;m using now.  So after some profiling, I found that creating their procedural geometry was taking up about 75% of the whole processing time for the frame when they were created.  This was extremely bad when editing them, especially (because they&#8217;re regenerated every frame, when they&#8217;re being edited, or when the ground under them is being edited).</p>
<p>Those of you who were at Freeplay will remember the part of my talk where I discussed optimising games, and when to do it (or rather, when not to do it).</p>
<p>For those who weren&#8217;t there, the tl;dr version is this:  don&#8217;t optimise anything unless you have timing numbers that proves it&#8217;s slow relative to the rest of your program, and against which you&#8217;ll be able to judge your progress.  Ideally, you get these numbers by using a profiler of some sort.  (Visual Studio has one built in, modern Xcode uses Instruments while old Xcode used Shark, under Linux you have gperf, etc)</p>
<p>What I didn&#8217;t say in that talk (and which I&#8217;ve regretted ever since), is that there&#8217;s a second criteria which can make it acceptable to optimise some code, even if you don&#8217;t have performance numbers.  Here is that other criteria:</p>
<p><span id="more-2269"></span></p>
<h1>Monte Carlo Profiling</h1>
<ol>
<li>Make a build of your game with optimisations turned on (a &#8220;release&#8221; build, or &#8220;retail&#8221; build, or &#8220;dist&#8221; build, or whatever you call it), but with debugging symbols still present.</li>
<li>Run this build through your debugger of choice.</li>
<li>At any time of your own choosing, pause the execution of the game, and examine the call stack shown in your debugger.</li>
<li>Repeat step 3 nine more times (for a total of ten pauses and ten callstacks).</li>
<li>If in seven of the ten total times you paused the game you were in the same area of code, then you may spend time optimising that area of code, even without first profiling it.</li>
</ol>
<p>The Monte Carlo test is basically very quick and ad hoc profiling.  Profiling does exactly this same process, but instead of doing it ten times, it does it millions of times, far faster than you&#8217;re able to do it manually.  It avoids having to go to the bother of setting up proper profiling, and will still point out anything that&#8217;s extremely slow in your code.</p>
<p>But back to my story.  In my case, I did do real profiling.  Here&#8217;s what it looked like in Instruments:</p>
<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz002.jpg"><img class="aligncenter size-full wp-image-2271" title="InstrumentsScreenSnapz002" src="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz002.jpg" alt="" width="815" height="583" /></a><a href="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz002.jpg"><br />
</a><a href="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz001.jpg"><br />
</a>That graph is of CPU usage.  (Also, it totally breaks the site frame layout, but I don&#8217;t care.  I want you to see the details.  :) )  The spike at the start is the game starting up (and generating all the world geometry all at once).  The low part in the middle is just me looking around a bit, and then the heavy bit that I have highlighted is me editing a road &#8212; just dragging one of its endpoints around the map at random.</p>
<p>As you can see from the screenshot, it&#8217;s spending about 30% of the frame time in vsMeshMaker::BakeTriangleVertex, 20% of its time in vsFloor (called from vsMeshMaker::BakeTriangleVertex), 16% of the frame time in vsVector2D::SqLength() (also called from vsMeshMaker::BakeTriangleVertex)&#8230;  you get the idea.  Add it all up, and we were spending about 75% of our CPU time inside BakeTriangleVertex.  That BakeTriangleVertex function was really, really heavy for some reason, and I needed to figure out why.</p>
<p>Basically what vsMeshMaker::BakeTriangleVertex does is to look at all the triangle vertices in a procedurally generated model, and to decide (one at a time) whether they should be merged with other nearby vertices to make a smoothly curving surface.  The hardest part of this is actually finding other nearby vertices.  Previously, I had sped this up by dividing up space into grid squares, and storing each vertex into the appropriate grid space.  Then when I wanted to know about nearby vertices, I only had to check the other vertices in the same grid space, not every other vertices in the model.</p>
<p>But as it turns out, those grid spaces were too large, especially for large objects like roads, and so I was still comparing far too many vertices for merging.  So I increased the number of grid spaces (and made each grid space smaller, so there would be fewer vertices to test in each), so that instead of having an 8x8x8 grid and needing to test every vertex in those large squares, we have a 32x32x32 grid and only need to test every vertex in much smaller squares.  I had also noticed that very simple functions like vsFloor and vsVector3D::SqLength() were showing up in the profiling, and so made those functions inline, to hopefully reduce the cost of calling them.  This led to this graph:</p>
<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz003.jpg"><img class="aligncenter size-full wp-image-2272" title="InstrumentsScreenSnapz003" src="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz003.jpg" alt="" width="815" height="583" /></a></p>
<p>This one is fascinating.  Notice that the amount of CPU being used has dropped substantially, compared to the previous one.  Also note that functions like &#8220;vsFloor&#8221; and &#8220;vsVector3D::SqLength&#8221; have vanished, since I made them inline (they&#8217;re now included in the caller&#8217;s time).  Increasing the resolution of my vertex lookup grid had sped things up a lot &#8212; we&#8217;re down from 75% of our frame time, down to an average of 40% of our frame time (and made a huge improvement to the frame rate).  But here&#8217;s the interesting thing that I hadn&#8217;t noticed previously:</p>
<p>Look at that graph, how it increases over time.  I wasn&#8217;t doing anything unusual in-game, just rapidly dragging one end of the road back and forth over a single area of terrain.  But the more time I spent editing the road, the slower editing became.  This eventually pointed me to a bug in my code, where some of the merging work from previous frames was being left-over to do again on all subsequent frames, even though it didn&#8217;t accomplish anything on the new frames.  So I fixed that bug, and profiled again:</p>
<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz004.jpg"><img class="aligncenter size-full wp-image-2273" title="InstrumentsScreenSnapz004" src="http://www.vectorstorm.org/wp-content/uploads/2011/10/InstrumentsScreenSnapz004.jpg" alt="" width="626" height="481" /></a></p>
<p>Great!  Getting rid of that leftover repeated work brought us down from 40% frame time (on average, during a long editing session) to about 2.6% frame time, low enough that you don&#8217;t even notice a frame rate hit in-game.</p>
<p>The problem now was that my grid was so fine, that it actually uses a lot of memory.  A 32x32x32 grid has about 32,000 spaces in it, and each of those needed storage to hold an arbitrary number of vertices.  And I had one of these for every road (and indeed, every building, tree, etc).  That builds up fast!  And while 2.6% is low enough to be acceptable, I would have liked it to be even lower.  Let&#8217;s face it, my placeholder &#8220;road&#8221; model is ridiculously simple.  I&#8217;d really like this code to be much faster than it is now, to handle the much more detailed meshes that I&#8217;ll be throwing at it later.</p>
<p>So I set out to replace the grid with a new structure:  an octree.  For those who are interested, this implementation has been ported back into the main VectorStorm trunk, as VS_PointOctree.h, inside the VS/Utils/ directory.  It&#8217;s basically a tree structure which expands as more data is added to it, so it should behave far more predictably than the grid structure.  What&#8217;s more, it expands as data is added, instead of being a fixed (huge) size, which means that smaller models use much less space, exactly as you&#8217;d hope.  Profiling isn&#8217;t much different (down to about 2%), but memory usage is drastically lower.  So I call that a win.  And in future, I may return to this code to see if I can&#8217;t whittle it down even a little further, once it starts moving up into a prime spot in the profiling again.</p>
<p>I&#8217;ve also been doing other stuff recently, but I reckon that this blog post is enough of a novel already, so I&#8217;ll save the other stuff for tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/10/09/profiling-is-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some little updates</title>
		<link>http://www.vectorstorm.org/2011/09/19/some-little-updates/</link>
		<comments>http://www.vectorstorm.org/2011/09/19/some-little-updates/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 12:47:10 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2265</guid>
		<description><![CDATA[&#160; So work has been busy, and I haven&#8217;t had nearly as much time to code on things here as I would have liked, but I&#8217;ve made some interesting progress over the past week or two. The first thing to mention is that I believe I&#8217;ve finally cracked the nut of making the game&#8217;s height [...]]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/09/Smooth.jpg"><img class="aligncenter size-medium wp-image-2266" title="Smooth" src="http://www.vectorstorm.org/wp-content/uploads/2011/09/Smooth-300x173.jpg" alt="" width="300" height="173" /></a>So work has been busy, and I haven&#8217;t had nearly as much time to code on things here as I would have liked, but I&#8217;ve made some interesting progress over the past week or two.</p>
<p>The first thing to mention is that I believe I&#8217;ve finally cracked the nut of making the game&#8217;s height map look good;  no more weird diagonal diamond patterns visible across changes of surface facing!  (this involves re-triangulating the surface to try to minimise artefacts)  This was especially bad before at sharp creases, such as you can see at the bottom of this extreme hill, or around the edges of darker areas, at the crest of the hill.  It was also often very visible on the mountains at the region boundaries.  But now, it&#8217;s pretty much bang on every time.  I&#8217;ve been doing this &#8220;re-triangulate the mesh to try to hide those diamond patterns&#8221; thing for an awfully long time, but it was only today that I finally found the right combination of heuristics to actually make it work reliably.</p>
<p>I&#8217;ve also moved from a simple directional-lighting light model to a wrap-around lighting model, which gives the game a much softer look, which also helps with the smoothness.  And is just a nicer look overall, in my opinion.</p>
<p>I&#8217;ve also started implementing more ground shaping tools.  Most notably is the ground leveller.  Basically, it tries to flatten out the terrain under your cursor.  There are versions which will only raise terrain, only lower terrain, and which will go in both directions.  This is great for setting up flat surfaces to place buildings upon.  (Since buildings only place their centre point on the ground, it&#8217;s common for their corners to be floating, or for the ground to be embedded through the building geometry.  Still TODO is to have buildings automatically flatten the ground under them, when placed.</p>
<p>Oh, and incidentally, grass now flows downhill, instead of always east-west.  I don&#8217;t think you can make it out in this screenshot (I&#8217;m too far away), but trust me.  :)</p>
<p>I still need to do thinking about how to set up the overall ground editing interface.  The &#8220;paint on&#8221; interface is nice, but even with the work being farmed out to background threads, it&#8217;s hitting the frame rate too hard, when the user paints with a large brush.  I&#8217;ve been thinking about having the terrain editing tools work with a grid lattice, which I could easily update in real-time.  When the user is happy with his changes, he could click an &#8220;Accept&#8221; button, to assign the terrain rebuilding to a game developer.  This would make it work similarly to how placing buildings works;  giving commands to actually be executed by minions.  And it would also solve the problem of needing to rebuild the terrain every frame;  instead, it could just happen in the background, when the developer is actually performing the task.  Need to think about this more;  I&#8217;m not sure how the user would specify terrain types on a grid lattice, for example.</p>
<p>I took a stab at continuing with player AI, but rapidly banged my head against the current code setup.  I think I&#8217;m going to have to heavily refactor the code, before I can add anything more to it.  It works right now, but it was written in the fastest possible way, way back for my self-induced &#8220;Milestone 1&#8243;, and at this stage, I&#8217;m stumped as to how to add parties to the system, without breaking the quest-following behaviours that are already in there.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/09/19/some-little-updates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minor update</title>
		<link>http://www.vectorstorm.org/2011/09/01/minor-update/</link>
		<comments>http://www.vectorstorm.org/2011/09/01/minor-update/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 13:00:34 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2183</guid>
		<description><![CDATA[Very minor update today, since I didn&#8217;t have much time to code, but got a few things implemented. First, VectorStorm materials now have an optional &#8220;layer&#8221; value.  This value defaults to zero.  Within a scene, material batches are drawn in order, according to increasing &#8220;layer&#8221; values.  This allows us to force transparent geometry, such as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/09/MMORPG-Tycoon-2ScreenSnapz001.jpg"><img class="alignnone size-full wp-image-2184" title="MMORPG Tycoon 2ScreenSnapz001" src="http://www.vectorstorm.org/wp-content/uploads/2011/09/MMORPG-Tycoon-2ScreenSnapz001.jpg" alt="" width="422" height="455" /></a></p>
<p>Very minor update today, since I didn&#8217;t have much time to code, but got a few things implemented.</p>
<p>First, VectorStorm materials now have an optional &#8220;layer&#8221; value.  This value defaults to zero.  Within a scene, material batches are drawn in order, according to increasing &#8220;layer&#8221; values.  This allows us to force transparent geometry, such as the extending arrow effect, to draw later than opaque geometry, such as the ground surface.  Note that this only works when rendering is performed via the material batching interface on the vsRenderQueue;  materials applied by directly setting them within a vsDisplayList will render exactly as requested within the vsDisplayList.</p>
<p>Second, I&#8217;ve been removing lots of old, dead code.  Most notably, I&#8217;ve now removed the carcass of the old combat system.  Now that players and monsters are attacking each other using via configurable attacks, the fake old system really isn&#8217;t necessary any longer.  The Player AI really needs some serious refactoring;  I&#8217;m probably going to spend the weekend trying to massage the code into a simpler and more extensible state.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/09/01/minor-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The last multithreading post (for now)</title>
		<link>http://www.vectorstorm.org/2011/09/01/the-last-multithreading-post-for-now/</link>
		<comments>http://www.vectorstorm.org/2011/09/01/the-last-multithreading-post-for-now/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 14:12:55 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2180</guid>
		<description><![CDATA[Setting up multithreading code is complicated! Here&#8217;s what&#8217;s new: Set up a generic &#8220;task management&#8221; system for MMORPG Tycoon 2.  Systems generate &#8220;tasks&#8221;, and tasks are assigned out to worker threads, which work on those tasks, and then let the main game know when the tasks finish.  Heightmap building now uses these generic worker threads, [...]]]></description>
			<content:encoded><![CDATA[<p>Setting up multithreading code is complicated!</p>
<p>Here&#8217;s what&#8217;s new:</p>
<ul>
<li>Set up a generic &#8220;task management&#8221; system for MMORPG Tycoon 2.  Systems generate &#8220;tasks&#8221;, and tasks are assigned out to worker threads, which work on those tasks, and then let the main game know when the tasks finish.  Heightmap building now uses these generic worker threads, instead of having their own threads.  Right now, there are eight worker threads.  But in theory, it&#8217;s probably best to have the same number of threads as the user&#8217;s CPU has cores, potentially plus one.</li>
<li>Clutter generation stuff occurs using dedicated threads.  I need to convert these over to use the new generic worker threads.</li>
<li>The game now waits for all queued up tasks to complete, before rendering the next frame.  This fixes some problems I was having before, where different blocks of terrain were updating at different times and not matching each other, just due to how long they took to calculate in the background threads.</li>
<li>Fixed some issues with my OS X semaphore implementation (since OS X doesn&#8217;t support unnamed semaphores, for unknowable reasons).</li>
<li>Worked around a renderer bug, where anything which had no texture was being drawn opaque, regardless of its material settings.  This affects the live trunk, too;  I&#8217;ll bring the fix across at the same time as the various threading fixes I&#8217;ve mentioned in the past week or so.  (If anyone needs a quick workaround in the meantime, just remove the line &#8220;m_state_SetBool( vsRendererState::Bool_Blend, false );&#8221; from vsRendererSimple::SetMaterial() on VS_RendererSimple.cpp, line 958.)</li>
</ul>
<p>And now, I&#8217;m completely sick of dealing with the complexity of threads, and so the next thing on my list will be more player AI.  I think I&#8217;m going to work on making players assemble into parties that do quests together.  That ought to be entertaining.</p>
<p>And it raises some interesting questions, which actually come up in the development of real MMORPGs; how to handle characters who are of differing levels, but who want to team up &#8212; ignore it?  Boost the level of the lower character?  Lower the level of the higher player?  Not allow teaming between those characters?  And worse, what do we do when a character completes a quest multiple times, accompanying different party members.  Do they get the reward multiple times?</p>
<p>My understanding is that most modern MMORPGs now give credit for completing a quest again in this sort of situation, but older MMORPGs often will not give repeated completion XP.  I wonder whether I need to make this configurable for players, or whether I should just take the modern approach and assume that that&#8217;s what everyone will want.</p>
<p>Lots of stuff to think about!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/09/01/the-last-multithreading-post-for-now/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>More multithreading</title>
		<link>http://www.vectorstorm.org/2011/08/22/more-multithreading/</link>
		<comments>http://www.vectorstorm.org/2011/08/22/more-multithreading/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 13:06:14 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2175</guid>
		<description><![CDATA[Apologies for all the similar screenshots lately;  it&#8217;s what happens when I&#8217;m working on the behind-the-scenes tech, instead of new features. So I&#8217;ve finally finished converting the world across to being generated in a background thread.  This means that as the player moves around the world, there are no longer any frame rate stutters as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/08/Threads.jpg"><img class="aligncenter size-medium wp-image-2176" title="Threads" src="http://www.vectorstorm.org/wp-content/uploads/2011/08/Threads-300x173.jpg" alt="" width="300" height="173" /></a></p>
<p>Apologies for all the similar screenshots lately;  it&#8217;s what happens when I&#8217;m working on the behind-the-scenes tech, instead of new features.</p>
<p>So I&#8217;ve finally finished converting the world across to being generated in a background thread.  This means that as the player moves around the world, there are no longer any frame rate stutters as new blocks of terrain are created in front of the player.  I&#8217;ve also dramatically simplified the world rendering code, which comes as a tremendous relief.</p>
<p>So now that I&#8217;m not worrying about performance, I&#8217;m going to be diving back into more detailed world-building.  Which should mean more interesting screenshots in the near future!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/08/22/more-multithreading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bored of clutter yet?</title>
		<link>http://www.vectorstorm.org/2011/08/04/bored-of-clutter-yet/</link>
		<comments>http://www.vectorstorm.org/2011/08/04/bored-of-clutter-yet/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 13:29:15 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2159</guid>
		<description><![CDATA[Feels like I&#8217;ve been working on clutter for ages and ages.  And from a certain point of view, I guess I have.  These clutter systems are kind of a simpler version of most of the rendering parts of MMORPG Tycoon 2;  creating and destroying renderable geometry when it&#8217;s needed, so we don&#8217;t have a ridiculous [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.vectorstorm.org/wp-content/uploads/2011/08/MMORPG-Tycoon-2ScreenSnapz002.jpg"><img class="alignnone size-thumbnail wp-image-2160" title="MMORPG Tycoon 2ScreenSnapz002" src="http://www.vectorstorm.org/wp-content/uploads/2011/08/MMORPG-Tycoon-2ScreenSnapz002-150x150.jpg" alt="" width="150" height="150" /></a>Feels like I&#8217;ve been working on clutter for ages and ages.  And from a certain point of view, I guess I have.  These clutter systems are kind of a simpler version of most of the rendering parts of MMORPG Tycoon 2;  creating and destroying renderable geometry when it&#8217;s needed, so we don&#8217;t have a ridiculous amount of geometry just sitting around in memory all the time, not being used.  This is an important consideration, when your game world is the size of World of Warcraft!  The stuff I do here will eventually generalise out to the height map, and then (hopefully!) to most other procedural geometry int he game, and should make the game feel a lot more responsive.</p>
<p>So today I&#8217;ve done phase two of the multithreading of clutter.  Yesterday, each &#8220;clutter tile&#8221; kept its own thread which would sleep while waiting for a &#8220;build some new clutter&#8221; job to arrive.  Today, there is now just one &#8220;worker thread&#8221; which handles all clutter rebuilding tasks.  This behaves a lot more nicely (particularly for people with fewer cores on the CPU), and should scale a lot better.  And it&#8217;s noticeable faster again to rebuild tiles of ground clutter, even compared against how fast it was yesterday.  From my point of view, the system side of ground clutter is now basically finished.  All that remains to do is to generate different types of clutter depending upon the terrain type (right now, it generates grass on everything, even bare mountain faces)</p>
<p>The plan is that tomorrow and over the weekend, I&#8217;ll be bringing this same system over to edge clutter, and to the base height maps as well.  This should substantially improve the frame rate jitters that I currently get when a new block of world terrain comes into view.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/08/04/bored-of-clutter-yet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multithreading</title>
		<link>http://www.vectorstorm.org/2011/08/04/multithreading/</link>
		<comments>http://www.vectorstorm.org/2011/08/04/multithreading/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 14:55:29 +0000</pubDate>
		<dc:creator>trevor</dc:creator>
				<category><![CDATA[Engine]]></category>
		<category><![CDATA[Full Games]]></category>
		<category><![CDATA[MMORPG Tycoon]]></category>
		<category><![CDATA[VectorStorm]]></category>

		<guid isPermaLink="false">http://www.vectorstorm.org/?p=2156</guid>
		<description><![CDATA[Just a couple quick notes today, because I really ought to be sleeping instead of posting. Today, MMORPG Tycoon 2 has finally become a multithreaded game.  It&#8217;s not ubiquitous by any means, but it&#8217;s taken the first step;  the ground clutter is now being generated in a background thread.  The only bit of clutter-related code [...]]]></description>
			<content:encoded><![CDATA[<p>Just a couple quick notes today, because I really ought to be sleeping instead of posting.</p>
<p>Today, MMORPG Tycoon 2 has finally become a multithreaded game.  It&#8217;s not ubiquitous by any means, but it&#8217;s taken the first step;  the ground clutter is now being generated in a background thread.  The only bit of clutter-related code which is now occurring in the main thread is copying the final geometry into the buffer that OpenGL renders from.  Now all the setup work as you move around the map is being handled in separate threads.</p>
<p>This means a couple of things.  For one, it means that MMORPG Tycoon 2 can finally use a little more of the CPU time from everyone with a multi-core computer (which is just about everyone with a computer from the last six years or so), and it also means that as more tasks can be moved out into other threads, I&#8217;ll be able to do more and more processing without hurting the game&#8217;s frame rate.</p>
<p>I&#8217;ll also note that Mac OS X&#8217;s support for semaphores is half-broken, and Win32&#8242;s support for semaphores is bizarre and generally unrelated to traditional semaphores.  Makes me a sad coder.  (for the non-coders in the audience:  semaphores are a tool for synchronising multiple threads, to help keep them from stepping on each other&#8217;s toes)</p>
<p>More details tomorrow.  Or later today, I guess, technically.  And semaphores will eventually be ported back into the VectorStorm trunk, if anyone wants to look at them.  Also fixed some bugs in the vsTask class, and added features to the vsMutex.  Will need to move all those changes back to the live trunk in the near future.  Maybe over the weekend.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vectorstorm.org/2011/08/04/multithreading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

