<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Cutscene engine</title>
		<link>http://www.allegro.cc/forums/view/597606</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Thu, 11 Sep 2008 19:38:23 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I am currently working on a cutscene engine for my Psychopyretic game. Does anyone have any idea how to do this? My current thought is to use functions that take a pointer to int and pass the &quot;frames&quot; variable that is incremented by your timer function to it. Does anyone have any better approaches, and are there any bad problems with that one?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (alethiophile)</author>
		<pubDate>Fri, 05 Sep 2008 08:42:54 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It depends entirely on what kind of cutscene you want.<br />Is your cutscene a movie (think FFVII)?<br />Is your cutscene an in-game scene acted out by sprites (think FFVI, Chrono Trigger)?<br />Is your cutscene a series of images (.bmp, .jpg, .png...)?</p><p>If your cutscene is a movie, just play the movie. <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" /><br />If your cutscene is an in-game scene, a series of triggers and events would be best. Alternatively, you could use clever timing to get it done (after 20 frames, sprite turns left. after 60 frames, sprite moves diagonally.).<br />If your cutscene is a series of images, something like what you suggested would probably work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Schyfis)</author>
		<pubDate>Fri, 05 Sep 2008 08:50:57 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If #2 (an in-game scene), others have set it up so the NPCs and players&#39; characters can be controlled by script (move up, then left, then right...).  There should be something like:
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"U3R2W50"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">2</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">1</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"U2R2W50"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">3</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">2</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"U1R2W50"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">4</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">3</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"R2W50"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">5</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">4</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"D1R2W50"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">6</td><td>&#160;</td></tr><tr><td class="number">7</td><td>  map-&gt;process_scripts<span class="k2">(</span><span class="n">0</span>, <span class="n">1</span>, <span class="n">2</span>, <span class="n">3</span>, <span class="n">4</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// This waits while they all move and their scripts finish</span></td></tr><tr><td class="number">8</td><td>&#160;</td></tr><tr><td class="number">9</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">0</span><span class="k2">]</span>.set_text<span class="k2">(</span><span class="s">"Lower your shields!"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">10</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">4</span><span class="k2">]</span>.set_text<span class="k2">(</span><span class="s">"Surrender!"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">11</td><td>  map-&gt;process_scripts<span class="k2">(</span><span class="n">0</span>, <span class="n">4</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// Wait while they say their individual threats</span></td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"R1"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">14</td><td>  map-&gt;process_scripts<span class="k2">(</span><span class="n">5</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// Move the "enemy" right 1 tile</span></td></tr><tr><td class="number">15</td><td>&#160;</td></tr><tr><td class="number">16</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_facing<span class="k2">(</span>FACE_LEFT<span class="k2">)</span><span class="k2">;</span> <span class="c">// Face the "enemy" to the left</span></td></tr><tr><td class="number">17</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_text<span class="k2">(</span><span class="s">"Never! You shall all die now!"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">18</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"W50"</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// After the witty comeback, wait 50 cycles</span></td></tr><tr><td class="number">19</td><td>  map-&gt;process_scripts<span class="k2">(</span><span class="n">5</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// Do all the above</span></td></tr><tr><td class="number">20</td><td>&#160;</td></tr><tr><td class="number">21</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_text<span class="k2">(</span><span class="s">"Attack! All your base are mine!"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">22</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_movement_speed<span class="k2">(</span>SPEED_FASTEST<span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">23</td><td>  map-&gt;NPCs<span class="k2">[</span><span class="n">5</span><span class="k2">]</span>.set_script<span class="k2">(</span><span class="s">"L2"</span><span class="k2">)</span><span class="k2">;</span></td></tr><tr><td class="number">24</td><td>  map-&gt;process_scripts<span class="k2">(</span><span class="n">5</span><span class="k2">)</span><span class="k2">;</span> <span class="c">// Lunge at the enemies, spewing threats!</span></td></tr></tbody></table></div></div><p>

So now you can totally control all of the characters by simple scripts, waiting for one or more actions to finish, then doing other actions after it, etc.</p><p>Is that what you had in mind?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (OnlineCop)</author>
		<pubDate>Fri, 05 Sep 2008 11:46:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That would be nice, but I&#39;m not sure how it&#39;s supposed to work. What is <tt>map</tt>?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (alethiophile)</author>
		<pubDate>Fri, 05 Sep 2008 20:06:47 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think it would actually work best if you could use a script to process the entire cutscene. Rather than executing short bursts in script and then hard coding the rest, it would be much easier I think if the talking, for example, was also handled by the script. This way, rather than having hundreds of little scripts, you could just have one script per cutscene with all the information it needs.</p><p>I&#39;ve never attempted anything like a cutscene or actually implemented a scripting engine before, but it should be possible and will probably make cutscenes really easy when done. <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Fri, 05 Sep 2008 20:13:16 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I know the KQ project did these kinds of cut scenes (this was more-or-less where I borrowed this suggestion from).  They use LUA to implement the scripting, and all of their &quot;move up 3 spaces, then right 2 spaces, then wait 50 clicks, then ...&quot; could be applied to all the NPCs (and player&#39;s character) simultaneously if all of the IDs were specified in the &quot;process_entities()&quot; list.</p><div class="quote_container"><div class="title">alethiophile said:</div><div class="quote"><p>
That would be nice, but I&#39;m not sure how it&#39;s supposed to work. What is map?
</p></div></div><p>
NPCs had several states: WALK_RANDOM, WALK_SCRIPTED, WALK_STANDSTILL.  When their state was &quot;WALK_SCRIPTED&quot;, it took a string of inputs as cues to fulfill.</p><p>The main Map would contain all of the NPCs positions, including &quot;current_tile, target_tile, current_[xy]&quot;.  So if you start an NPC moving in a certain direction, its current_tile may be (10,7) and its target_tile may be (10,8).  Its current_x would be 160 (10 tiles * 16-pixel tile width) and current_y would be 112 (7*16), then 113 (7*16 + 1), then 114 (7*16 + 2), ...</p><p>So &quot;map&quot; is just whatever map you&#39;re drawing to the screen.  It&#39;s the main controller for all the NPCs contained in it.  It&#39;s responsible for all the bounds-checking to ensure an NPC doesn&#39;t step on an invalid tile (or one occupied by another NPC).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (OnlineCop)</author>
		<pubDate>Fri, 05 Sep 2008 22:34:20 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>If you&#39;re doing movie cutscenes, then take a look at <a href="http://kcat.strangesoft.net/apeg.html">APEG</a>.</p><p>There is lots of support available since it&#39;s made by one of the members in this forum <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Archon)</author>
		<pubDate>Sat, 06 Sep 2008 07:21:45 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How does someone go about making a movies that APEG can play?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Black)</author>
		<pubDate>Sat, 06 Sep 2008 10:16:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
How does someone go about making a movies that APEG can play?
</p></div></div><p>Record a video, and save it as an mpeg1 or ogg theora video.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 06 Sep 2008 10:26:01 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>It&#39;s the recording a video part that I don&#39;t get. I know I can use CamStudio or the like to record a video, but how would I make a cutscene video?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Black)</author>
		<pubDate>Sat, 06 Sep 2008 10:38:08 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">Quote:</div><div class="quote"><p>
but how would I make a cutscene video?
</p></div></div><p>A video is a video. All games with pre rendered cutscenes do is play back a video file.</p><p>One way is to render it in a 3d app, and then encode that, or use a special higher quality scriptable version of your engine to render each frame, and encode that (if its not higher quality, or special in any way, you might as well just use in game scripted cutscenes).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 06 Sep 2008 12:29:33 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I guess my real question is how would I animate a video for a cutscene, but I think Ive hi-jacked this thread for long enough.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Neil Black)</author>
		<pubDate>Sat, 06 Sep 2008 12:32:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I do believe I gave two options <img src="http://www.allegro.cc/forums/smileys/smiley.gif" alt=":)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Thomas Fjellstrom)</author>
		<pubDate>Sat, 06 Sep 2008 13:40:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Me and my friend Per have implemented a really simple cut scene system for one of our games that yet hasn&#39;t been finished. It might give you some ideas. The cut scene is an entity in our engine just as an enemy or the player. You initialize the cut scene by pushing events to it and the events are carried out in the order they were pushed.</p><p>Each entity has a logic function that is called each logic frame. The cut scene counts frames and draws itself accordingly.</p><p>You can look at the code here (sorry for the formatting):<br /><a href="http://code.google.com/p/db-nmc/source/browse/trunk/src/entities/cutscene.hpp">cutscene.hpp</a><br /><a href="http://code.google.com/p/db-nmc/source/browse/trunk/src/entities/cutscene.cpp?r=276">cutscene.cpp</a><br /><a href="http://code.google.com/p/db-nmc/source/browse/trunk/src/entityfactory.cpp#108">entityfactory.cpp</a></p><p>If the player is to be animated, the player is simply disabled and replaced by an animation. When the cut scene is over the player is put back in place and enabled.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Næssén)</author>
		<pubDate>Sun, 07 Sep 2008 01:33:15 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>My current idea is to make a scriptable NPC framework, then run cutscenes by passing the right scripts to the NPCs. I can also use the scripts for simple AI actions. Some people have mentioned Lua as a scripting addition; is that a good idea, or should I use something different? I could probably make a scripting engine myself, but I would rather use an already-created one.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (alethiophile)</author>
		<pubDate>Mon, 08 Sep 2008 02:54:19 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>For an action based system I would make two general types of actions:<br />blocking actions<br />and non-blocking actions</p><p>A blocking action blocks the action queue and unblocks it when it&#39;s finished.<br />A non-blocking action, well, doesn&#39;t block.<br />Note that at one point in time there can be only one blocking action getting executed.</p><p>So you have one action queue (your cutscene), a list of actions &quot;in progress&quot; and a main thread like this (pseudo-code):
</p><div class="source-code snippet"><div class="inner"><pre>do:
  <span class="k1">if</span> script.ready:
    Action nextAction <span class="k3">=</span> script.nextAction<span class="k2">(</span><span class="k2">)</span>
    currentActions.add<span class="k2">(</span>nextActions<span class="k2">)</span>
    <span class="k1">if</span> nextAction.blocking:
      script.ready <span class="k3">=</span> <span class="k1">false</span>
  foreach action in currentActions:
    action.advance<span class="k2">(</span><span class="k2">)</span> <span class="c">// Process 1 frame</span>
    <span class="k1">if</span> action.finished: <span class="c">//Action has finished</span>
      <span class="k1">if</span> action.blocking:
        script.ready <span class="k3">=</span> <span class="k1">true</span>
      currentActions.remove<span class="k2">(</span>action<span class="k2">)</span>
</pre></div></div><p>

An action could be a simple command (&quot;Move char A to (X,Y)&quot;) or even a sequence of actions, though this could be difficult to implement.<br />If you want to do several things simultaneously you would just insert a few non-blocking actions to the queue and add another one that is blocking (e.g. &quot;move A to (X,Y) non-blocking&quot;, &quot;move B to (X,Y) non-blocking&quot;, &quot;move C to (X,Y) non-blocking&quot;, &quot;wait 1000 blocking&quot;).</p><p>Just an idea. On a second thought it is similar to Næssén&#39;s system.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Simon Parzer)</author>
		<pubDate>Mon, 08 Sep 2008 19:54:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>What I&#39;m implementing currently is that all actions block, you call <tt>npc.update()</tt> in your main loop to update the current action, and you have to call <tt>npc.setscript()</tt> every time an action finishes and you want a new one. I may add a queue and non-blocking actions later, but that&#39;s all I need for now.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (alethiophile)</author>
		<pubDate>Tue, 09 Sep 2008 05:12:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><div class="quote_container"><div class="title">alethiophile said:</div><div class="quote"><p>
I may add a queue and non-blocking actions later, but that&#39;s all I need for now.
</p></div></div><p>
I would agree with Simon&#39;s approach of the list of non-blocked (followed by the blocked) action, because if you have three or four NPCs that you want to march out of a room, or fly away in a set formation, or whatever, you can&#39;t do that: you have to send one away, followed by the next, then the next.</p><p>The queue would be a bit of a better approach as you wouldn&#39;t need to code in too much extra to implement it, and it would make program flow a lot easier...
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (OnlineCop)</author>
		<pubDate>Tue, 09 Sep 2008 07:11:44 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>No, there would just be one &quot;currently executing&quot; action for each NPC. I could call npc1.update(), npc2.update(), etc. in my main loop, and all execute at once.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (alethiophile)</author>
		<pubDate>Tue, 09 Sep 2008 08:45:49 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Triggers are often more convenient than co-ordinating scripts manually.  e.g. Set a trigger such that &quot;When npc1 is at positon x, npc2.action = walkto y&quot;.   The active triggers are kept in a list and each of their conditions is tested every frame, after the updates.</p><p>Activating and deactivating the triggers is defined in the script, so a mixture of direct commands and triggers can be used in any script.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matt Smith)</author>
		<pubDate>Wed, 10 Sep 2008 07:44:51 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>That&#39;s probably a good idea, but right now I&#39;m just trying to implement simple scripts.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (alethiophile)</author>
		<pubDate>Wed, 10 Sep 2008 09:17:30 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I think a simple script would be a char[] array:</p><p>To move in any four direction, specify &quot;UDLR&quot; (or if you want compass coordinates, &quot;NEWS&quot;), followed by the number of steps in that direction:
</p><div class="source-code snippet"><div class="inner"><pre><span class="k1">char</span> script_buffer<span class="k2">[</span><span class="n">128</span><span class="k2">]</span><span class="k2">;</span>
<span class="c">// ...</span>
<a href="http://www.delorie.com/djgpp/doc/libc/libc_767.html" target="_blank">strncat</a><span class="k2">(</span>script_buffer, <span class="s">"U10"</span>, <span class="n">3</span><span class="k2">)</span><span class="k2">;</span>
<span class="c">// ...</span>
</pre></div></div><p>

Then, step through each character of the array until you hit the &#39;\0&#39;-terminator.  If the character is a letter, call the appropriate <tt>case __:</tt> statement to start collecting the important information afterward (usually, this just means to check the NEXT characters to see if they&#39;re numbers, and if so, parse the actual int value from them).</p><p>It may be easiest to actually turn this into an expanded string once you have made all of the movement adjustments, such as turning &quot;U4D3&quot; into &quot;UUUUDDD&quot;, if it makes the process loop easier for you.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (OnlineCop)</author>
		<pubDate>Wed, 10 Sep 2008 18:22:07 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I&#39;ll assume that you&#39;re referring to acting out scenes within the game engine, ala Warcraft 3 cut-scenes.</p><p>In the past I&#39;ve been lazy a few times and implemented cut-scenes as scripts.
</p><div class="source-code snippet"><div class="inner"><pre>Player.Perform<span class="k2">(</span>Move<span class="k2">(</span><span class="n">19</span>, <span class="n">20</span><span class="k2">)</span><span class="k2">)</span>
Player.Perform<span class="k2">(</span>Attack<span class="k2">(</span><span class="k1">true</span><span class="k2">)</span><span class="k2">)</span>
</pre></div></div><p>

This however, although very powerful and can provide lot of detail to your cut-scenes , is still coding. Which means it&#39;s very hard to write any intuitive tools to create and edit cut-scenes. So a better way could be to implement it in the same manner as you implement macro&#39;s in an application, as a sequence of commands/actions.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (monkeyCode)</author>
		<pubDate>Thu, 11 Sep 2008 13:08:11 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>An XML (or whatever) based system might be nice;<br />This is probably how I would design it (not giving it to much thought right now though)
</p><div class="source-code"><div class="toolbar"></div><div class="inner"><table width="100%"><tbody><tr><td class="number">1</td><td><span class="k3">&lt;</span>script start<span class="k3">=</span><span class="s">"start"</span><span class="k3">&gt;</span></td></tr><tr><td class="number">2</td><td> <span class="k3">&lt;</span>section name<span class="k3">=</span><span class="s">"start"</span> type<span class="k3">=</span><span class="s">"parallel"</span><span class="k3">&gt;</span></td></tr><tr><td class="number">3</td><td>  <span class="k3">&lt;</span>act type<span class="k3">=</span><span class="s">"execute"</span> target<span class="k3">=</span><span class="s">"enemy_advance"</span><span class="k3">/</span><span class="k3">&gt;</span></td></tr><tr><td class="number">4</td><td>  <span class="k3">&lt;</span>act type<span class="k3">=</span><span class="s">"execute"</span> target<span class="k3">=</span><span class="s">"player_advance"</span><span class="k3">/</span><span class="k3">&gt;</span></td></tr><tr><td class="number">5</td><td>  <span class="k3">&lt;</span>act type<span class="k3">=</span><span class="s">"execute"</span> target<span class="k3">=</span><span class="s">"conditional_move1"</span><span class="k3">/</span><span class="k3">&gt;</span></td></tr><tr><td class="number">6</td><td> <span class="k3">&lt;</span><span class="k3">/</span>section&gt;</td></tr><tr><td class="number">7</td><td>&#160;</td></tr><tr><td class="number">8</td><td> <span class="k3">&lt;</span>section name<span class="k3">=</span><span class="s">"player_advance"</span> type<span class="k3">=</span><span class="s">"serial"</span><span class="k3">&gt;</span></td></tr><tr><td class="number">9</td><td>  <span class="k3">&lt;</span>act type<span class="k3">=</span><span class="s">"move"</span> target<span class="k3">=</span><span class="s">"player"</span> x<span class="k3">=</span><span class="s">"5"</span> y<span class="k3">=</span><span class="s">"19"</span><span class="k3">/</span><span class="k3">&gt;</span></td></tr><tr><td class="number">10</td><td>  <span class="k3">&lt;</span>act type<span class="k3">=</span><span class="s">"move"</span> target<span class="k3">=</span><span class="s">"player"</span> x<span class="k3">=</span><span class="s">"9"</span> y<span class="k3">=</span><span class="s">"1"</span><span class="k3">/</span><span class="k3">&gt;</span></td></tr><tr><td class="number">11</td><td> <span class="k3">&lt;</span><span class="k3">/</span>section&gt;</td></tr><tr><td class="number">12</td><td>&#160;</td></tr><tr><td class="number">13</td><td> <span class="k3">&lt;</span>section name<span class="k3">=</span><span class="s">"conditional_move1"</span> type<span class="k3">=</span><span class="s">"serial"</span><span class="k3">&gt;</span> <span class="k3">&lt;</span><span class="k3">!</span><span class="k3">-</span><span class="k3">-</span> <span class="k1">if</span> a section has a condition, it will continuously check <span class="k1">if</span> it<span class="s">'s true --&gt;</span></td></tr><tr><td class="number">14</td><td><span class="s">  &lt;condition type="reached_area" target="player" area="area_01"/&gt; &lt;!-- where area_01 is defined in the map editor --&gt;</span></td></tr><tr><td class="number">15</td><td><span class="s">  &lt;condition type="variable_equals" target="conditional_move1_done" value="0"/&gt;</span></td></tr><tr><td class="number">16</td><td><span class="s">  &lt;act type="set_variable" target="conditional_move1_done" value="1"/&gt;</span></td></tr><tr><td class="number">17</td><td><span class="s">  &lt;act type="move" target="player" x="1" y="1"/&gt;</span></td></tr><tr><td class="number">18</td><td><span class="s"> &lt;/section&gt;</span></td></tr><tr><td class="number">19</td><td><span class="s"></span></td></tr><tr><td class="number">20</td><td><span class="s"> &lt;section name="enemy_advance" type="parallel"&gt;</span></td></tr><tr><td class="number">21</td><td><span class="s">  &lt;act type="execute" target="enemy1_advance"/&gt;</span></td></tr><tr><td class="number">22</td><td><span class="s">  &lt;act type="execute" target="enemy2_advance"/&gt;</span></td></tr><tr><td class="number">23</td><td><span class="s">  &lt;act type="execute" target="enemy3_advance"/&gt;</span></td></tr><tr><td class="number">24</td><td><span class="s">  &lt;act type="execute" target="enemy4_advance"/&gt;</span></td></tr><tr><td class="number">25</td><td><span class="s"> &lt;/section&gt;</span></td></tr><tr><td class="number">26</td><td><span class="s"></span></td></tr><tr><td class="number">27</td><td><span class="s"> &lt;section name="enemy1_advance" type="serial"&gt;</span></td></tr><tr><td class="number">28</td><td><span class="s">  &lt;act type="move" target="enemy1" x="80" y="90"/&gt;</span></td></tr><tr><td class="number">29</td><td><span class="s">  &lt;act type="move" target="enemy1" x="75" y="95"/&gt;</span></td></tr><tr><td class="number">30</td><td><span class="s"> &lt;/section&gt;</span></td></tr><tr><td class="number">31</td><td><span class="s"></span></td></tr><tr><td class="number">32</td><td><span class="s"> ...</span></td></tr><tr><td class="number">33</td><td><span class="s">&lt;/script&gt;</span></td></tr></tbody></table></div></div><p>
Should be fairly easy to implement; You&#39;d need an action factory and a condition factory, and some semi-clever logic to make it all work together <img src="http://www.allegro.cc/forums/smileys/wink.gif" alt=";)" />
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Thu, 11 Sep 2008 13:26:59 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Rather than trying to implement an XML-based system, I think you&#39;d probably be better off integrating with an existing scripting engine (i.e. Lua).
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (bamccaig)</author>
		<pubDate>Thu, 11 Sep 2008 19:27:50 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Lua is probably more useful in the long run, yes. But I&#39;d say it&#39;s easier to implement the XML-system (assuming that you have a decent XML parser, like tinyXML).</p><p>There&#39;s a fair bit of things you have to consider when integrating a scripting engine; when to run the scripts, what scripts to run, what functions you should share with the scripting engine etc. You&#39;d also have to learn the scripting language.</p><p>But yeah, go with the 3rd party scripting language. It&#39;s better in the long run.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Jonatan Hedborg)</author>
		<pubDate>Thu, 11 Sep 2008 19:38:23 +0000</pubDate>
	</item>
</rss>
