<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://oldwiki.devbox.themanaworld.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Avaniel</id>
	<title>The Mana World - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://oldwiki.devbox.themanaworld.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Avaniel"/>
	<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/wiki/Special:Contributions/Avaniel"/>
	<updated>2026-05-06T06:03:11Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=User_talk:Dabe/Backstory&amp;diff=6302</id>
		<title>User talk:Dabe/Backstory</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=User_talk:Dabe/Backstory&amp;diff=6302"/>
		<updated>2007-03-12T10:45:19Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: just talking&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;We need to discuss creating a timeline to take the place of this awkward article.  Any event worth giving detailed information about, can be turned in to a link/article.  I would like to have something more like a video game intro, to very vaguely &amp;amp; quickly tell the story.  (like in SoM of course)&lt;br /&gt;
&lt;br /&gt;
I&#039;m not sure how to go about doing this efficiently, in a wiki environment. [[User:Dabe|Dabe]] 00:42, 5 March 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @ Epic ===&lt;br /&gt;
I like the short one, the perspective that is given to a new player, is exactly what you would expect to remain from an ancient history. We had four crystals, world was good; crystals gone, world in turmoil. Then it&#039;s up to the player to find out why and how to fix it. Maybe even something like &amp;quot;A hero gave us four crystals, to balance the world.&amp;quot; If you&#039;re still going with the one hero from every race, who defeated the gods together. [[User:Avaniel|Avaniel]] 11:45, 12 March 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Threat_level&amp;diff=6283</id>
		<title>Archive:Threat level</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Threat_level&amp;diff=6283"/>
		<updated>2007-03-09T16:50:02Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: comment&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
The premise of this page is to demonstrate a possible monster-threat system, where the game would warn the player when the monster is too strong for them to defeat. The system proposed here is fairly simple, but should work fine. Of course, this assumes the player isn&#039;t using any glitches/cheats. There might be a small bit of error for long-ranged players, due to the distance the monster has to travel to attack.&lt;br /&gt;
&lt;br /&gt;
 if m. exp &amp;lt; 0.1% p. lvl exp =&amp;gt; gray&lt;br /&gt;
     if (m. spd &amp;gt; player spd) &amp;amp; (m. atk &amp;gt; p. atk) &amp;amp; (m. hp &amp;gt; p. hp) =&amp;gt; red&lt;br /&gt;
     if (m. spd - player spd) &amp;lt; -99% m. spd&lt;br /&gt;
         if (m. atk - p. atk) &amp;gt; 49% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 49% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) = -50% to 50% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; -50% m hp =&amp;gt; green&lt;br /&gt;
         if (m. atk - p. atk) &amp;lt; 50% &amp;amp; &amp;gt; 0% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 99% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 149% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; 100% m. hp =&amp;gt; green&lt;br /&gt;
         if (m. atk - p. atk) &amp;lt; 0% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 99% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 149% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; 100% m. hp =&amp;gt; green&lt;br /&gt;
     if (m. spd - player spd) &amp;gt; -100% &amp;lt; 1% m. spd&lt;br /&gt;
         if (m. atk - p. atk) &amp;gt; 49% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 49% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) = -50% to 50% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; -50% m hp =&amp;gt; green&lt;br /&gt;
         if (m. atk - p. atk) &amp;lt; 50% &amp;amp; &amp;gt; 0% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 99% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 149% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; 100% m. hp =&amp;gt; green&lt;br /&gt;
         if (m. atk - p. atk) &amp;lt; 0% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 99% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 149% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; 100% m. hp =&amp;gt; green&lt;br /&gt;
     if (m. spd - player spd) &amp;gt; 0% m. spd&lt;br /&gt;
         if (m. atk - p. atk) &amp;gt; 49% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; -199% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; -249% m. hp =&amp;gt; green&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; -200% m. hp =&amp;gt; red&lt;br /&gt;
         if (m. atk - p. atk) &amp;lt; 50% &amp;amp; &amp;gt; 0% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 0% &amp;amp; &amp;lt; 49% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 50% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; 0% m. hp =&amp;gt; green&lt;br /&gt;
         if (m. atk - p. atk) &amp;lt; 0% m. atk&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; 49% m. hp =&amp;gt; red&lt;br /&gt;
             if (m. hp - p. hp) &amp;gt; -49% &amp;lt; 50% m. hp =&amp;gt; orange&lt;br /&gt;
             if (m. hp - p. hp) &amp;lt; -50% m. hp =&amp;gt; green&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;What would you say about, defining a meaningfull way to calculate being levels and basing threat level on that? --[[User:Avaniel|Avaniel]] 17:50, 9 March 2007 (CET)&#039;&#039;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6186</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6186"/>
		<updated>2007-03-03T00:42:08Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&#039;&#039;By [[User:Avaniel|Avaniel]] 20:37, 27 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (CSD-1) for an overview.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-dimensions.png|frame|none|Diagram (CSD-1) - Overview of the Circle-Sector and Disk]]&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divided in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (CSD-2).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi.png|frame|none|Diagram (CSD-2) - The x-y plane divide in 6 &#039;Voronoi&#039; regions]]&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (CSD-3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (CSD-4)). [[:Image:Collision-circlesecor-disk-example1.png|An example of a region 1 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi1.png|frame|none|Diagram (CSD-3) - &#039;Voronoi&#039; region 1 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis1.png|frame|none|Diagram (CSD-4) - Coordinate system 1]]&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha) = P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; {2sin(alpha)cos(alpha) / (cos&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha) - sin&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha))}&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (CSD-5). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example2.png|An example of a region 2 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi2.png|frame|none|Diagram (CSD-5) - &#039;Voronoi&#039; region 2 highlighted]]&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (CSD-6). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example3.png|An example of a region 3 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi3.png|frame|none|Diagram (CSD-6) - &#039;Voronoi&#039; region 3 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (CSD-7). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example4.png|An example of a region 4 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi4.png|frame|none|Diagram (CSD-7) - &#039;Voronoi&#039; region 4 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (CSD-8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (CSD-9)). [[:Image:Collision-circlesecor-disk-example5.png|An example of a region 5 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi5.png|frame|none|Diagram (CSD-8) - &#039;Voronoi&#039; region 5 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis2.png|frame|none|Diagram (CSD-9) - Coordinate system 2]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (CSD-10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (CSD-11)). [[:Image:Collision-circlesecor-disk-example6.png|An example of a region 6 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi6.png|frame|none|Diagram (CSD-10) - &#039;Voronoi&#039; region 6 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis3.png|frame|none|Diagram (CSD-11) - Coordinate system 3]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Bounding Circle ===&lt;br /&gt;
&lt;br /&gt;
The above laid out method is mathematically accurate and sufficient. However, it is not very fast. By applying a bounding circle and checking if the disk intersects with that, The six region based intersection test only have to be applied to likely candidates. An overview of the bounding circle is given in diagram (CSD-12). For these calculations coordinate system 4 will be used, which is shown in diagram (CSD-13).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-boundingcircle.png|frame|none|Diagram (CSD-12) - Overview of the bounding circle]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis4.png|frame|none|Diagram (CSD-13) - Coordinate system 4]]&lt;br /&gt;
&lt;br /&gt;
The radius of the bounding circle &#039;&#039;R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;&#039;&#039; is given by:&lt;br /&gt;
&lt;br /&gt;
:R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; = R / (2*cos(alpha))&lt;br /&gt;
&lt;br /&gt;
The coordinates of the center point in coordinate system 4 are then given by:&lt;br /&gt;
&lt;br /&gt;
:C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt; = R / (2*cos(alpha))&lt;br /&gt;
&lt;br /&gt;
:C&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt; = 0&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 4 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(beta)&lt;br /&gt;
&lt;br /&gt;
The condition for the disk intersecting the bounding circle is then given by:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt; - C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt; - C&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt; + R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inserting the values for &#039;&#039;C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;&#039;&#039;, &#039;&#039;C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;&#039;&#039; and &#039;&#039;R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;&#039;&#039;, into the condition yields:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)*cos(alpha) - P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;*R &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;*cos(alpha) + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;*R&lt;br /&gt;
&lt;br /&gt;
To achieve this result, both sides where multiplied by &#039;&#039;(2*cos(alpha))&#039;&#039;, which means that an extra condition is imposed.:&lt;br /&gt;
&lt;br /&gt;
:cos(alpha) &amp;gt; 0; alpha &amp;lt; 90&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Together with the observation that the bounding circle becomes infinitly large at a value for &#039;&#039;alpha&#039;&#039; of 90&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;, we have to limit &#039;&#039;alpha&#039;&#039; to a maximum of 85&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;, for practical reasons.&lt;br /&gt;
&lt;br /&gt;
The condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &#039;&#039;R&#039;&#039;, the half-top-angle &#039;&#039;alpha&#039;&#039;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &#039;&#039;P&#039;&#039; and the radius of the disk &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;, thereby obtaining the coordinates of &#039;&#039;P&#039;&#039; in the primary coordinate system.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 4.&lt;br /&gt;
* Check for an intersection with the bounding circle. &lt;br /&gt;
** Return false if there is no intersection.&lt;br /&gt;
* Check for a region 4 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;A&#039;&#039; in the primary coordinate system.&lt;br /&gt;
* Check for a region 3 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;B&#039;&#039; in the primary coordinate system.&lt;br /&gt;
* Check for a region 2 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 1.&lt;br /&gt;
* Determine if &#039;&#039;P&#039;&#039; is is region 5 (realising that coordinate system 2 is the exact opposite of coordinate system 1).&lt;br /&gt;
** Check for a region 5 intersection. Return the result.&lt;br /&gt;
* Calculate tan(2alpha).&lt;br /&gt;
* Determine if &#039;&#039;P&#039;&#039; is is region 1.&lt;br /&gt;
** Check for a region 1 intersection. Return the result.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 3.&lt;br /&gt;
* Determine if &#039;&#039;P&#039;&#039; is is region 6.&lt;br /&gt;
** Check for a region 6 intersection. Return the result.&lt;br /&gt;
&lt;br /&gt;
Any but the first five steps can be moved, if that is found to be more appropriate. The algorithm includes 5 calls to a trigonomic function.&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha), cos(alpha) and tan(2alpha) could be computed on startup of the game-server and stored for use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simplified collision test ==&lt;br /&gt;
By [[User:BjÃ¸rn|BjÃ¸rn]] 00:32, 28 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
Since our enemies aren&#039;t exactly circles anyway, I&#039;m prepared to do away with some of the above complexity. However if the above is efficiently and understandable enough, I&#039;m prepared to go with it. What I would propose is visualized as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Circle-sector hit test.png|frame|none|Overview of a simplified test]]&lt;br /&gt;
&lt;br /&gt;
In essense, the gradiented area is checked for collision instead of the exact circle. It would only require the areas with blue and red dotted lines to be checked on intersection and the circle radii to be checked for proximity. Something like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:blueA = dir - widenessAngle&lt;br /&gt;
:blueB = dir + widenessAngle&lt;br /&gt;
&lt;br /&gt;
:redA = cos(diskY / diskX) - cos(diskRadius / dist)&lt;br /&gt;
:redB = cos(diskY / diskX) + cos(diskRadius / dist)&lt;br /&gt;
&lt;br /&gt;
:diskDist = sqrt(diskX*diskX + diskY*diskY)&lt;br /&gt;
&lt;br /&gt;
:collision = redA &amp;lt; blueB &amp;amp;&amp;amp; redB &amp;gt; blueA &amp;amp;&amp;amp; diskDist - diskRadius &amp;lt; circleRadius&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ok that&#039;s two trigonomic function calls, two divisions and one sqrt (which could be avoided when circleRadius and diskRadius where given in their squared form).&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;The squareroot can be avoided by using:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::diskDist&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (diskRadius + circleRadius)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;However all the trigonomic function calls, contain a distance and are not cacheable (in a meaningfull way).&#039;&#039;&lt;br /&gt;
:&#039;&#039;[[User:Avaniel|Avaniel]] 01:30, 28 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Hmm, or maybe I should just let the pros handle this...&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6185</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6185"/>
		<updated>2007-03-03T00:12:48Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Improved &amp;quot;Circle-Sector with Disk&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&#039;&#039;By [[User:Avaniel|Avaniel]] 20:37, 27 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (CSD-1) for an overview.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-dimensions.png|frame|none|Diagram (CSD-1) - Overview of the Circle-Sector and Disk]]&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divided in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (CSD-2).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi.png|frame|none|Diagram (CSD-2) - The x-y plane divide in 6 &#039;Voronoi&#039; regions]]&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (CSD-3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (CSD-4)). [[:Image:Collision-circlesecor-disk-example1.png|An example of a region 1 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi1.png|frame|none|Diagram (CSD-3) - &#039;Voronoi&#039; region 1 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis1.png|frame|none|Diagram (CSD-4) - Coordinate system 1]]&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha) = P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; {2sin(alpha)cos(alpha) / (cos&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha) - sin&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha))}&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (CSD-5). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example2.png|An example of a region 2 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi2.png|frame|none|Diagram (CSD-5) - &#039;Voronoi&#039; region 2 highlighted]]&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (CSD-6). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example3.png|An example of a region 3 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi3.png|frame|none|Diagram (CSD-6) - &#039;Voronoi&#039; region 3 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (CSD-7). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example4.png|An example of a region 4 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi4.png|frame|none|Diagram (CSD-7) - &#039;Voronoi&#039; region 4 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (CSD-8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (CSD-9)). [[:Image:Collision-circlesecor-disk-example5.png|An example of a region 5 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi5.png|frame|none|Diagram (CSD-8) - &#039;Voronoi&#039; region 5 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis2.png|frame|none|Diagram (CSD-9) - Coordinate system 2]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (CSD-10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (CSD-11)). [[:Image:Collision-circlesecor-disk-example6.png|An example of a region 6 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi6.png|frame|none|Diagram (CSD-10) - &#039;Voronoi&#039; region 6 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis3.png|frame|none|Diagram (CSD-11) - Coordinate system 3]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Bounding Circle ===&lt;br /&gt;
&lt;br /&gt;
The above laid out method is mathematically accurate and sufficient. However, it is not very fast. By applying a bounding circle and checking if the disk intersects with that, a lot of the work above can be simplified to just a few equations. An overview of the bounding circle is given in diagram (CSD-12). For these calculations coordinate system 4 will be used, which is shown in diagram (CSD-13).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-boundingcircle.png|frame|none|Diagram (CSD-12) - Overview of the bounding circle]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis4.png|frame|none|Diagram (CSD-13) - Coordinate system 4]]&lt;br /&gt;
&lt;br /&gt;
The radius of the bounding circle &#039;&#039;R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;&#039;&#039; is given by:&lt;br /&gt;
&lt;br /&gt;
:R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt; = R / (2*cos(alpha))&lt;br /&gt;
&lt;br /&gt;
The coordinates of the center point in coordinate system 4 are then given by:&lt;br /&gt;
&lt;br /&gt;
:C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt; = R / (2*cos(alpha))&lt;br /&gt;
&lt;br /&gt;
:C&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt; = 0&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 4 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(beta)&lt;br /&gt;
&lt;br /&gt;
The condition for the disk intersecting the bounding circle is then given by:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt; - C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt; - C&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt; + R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Inserting the values for &#039;&#039;C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;&#039;&#039;, &#039;&#039;C&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;&#039;&#039; and &#039;&#039;R&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;&#039;&#039;, into the condition yields:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y4&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;)*cos(alpha) - P&amp;lt;sub&amp;gt;x4&amp;lt;/sub&amp;gt;*R &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;*cos(alpha) + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;*R&lt;br /&gt;
&lt;br /&gt;
To achieve this result, both sides where multiplied by &#039;&#039;(2*cos(alpha))&#039;&#039;, which means that an extra condition is imposed.:&lt;br /&gt;
&lt;br /&gt;
:cos(alpha) &amp;gt; 0; alpha &amp;lt; 90&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Together with the observation that the bounding circle becomes infinitly large at a value for &#039;&#039;alpha&#039;&#039; of 90&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;, we have to limit &#039;&#039;alpha&#039;&#039; to a maximum of 85&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt;, for practical reasons.&lt;br /&gt;
&lt;br /&gt;
The condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &#039;&#039;R&#039;&#039;, the half-top-angle &#039;&#039;alpha&#039;&#039;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &#039;&#039;P&#039;&#039; and the radius of the disk &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;, thereby obtaining the coordinates of &#039;&#039;P&#039;&#039; in the primary coordinate system.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 4.&lt;br /&gt;
* Check for an intersection with the bounding circle. &lt;br /&gt;
** Return false if there is no intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 1.&lt;br /&gt;
* Check if &#039;&#039;P&#039;&#039; is is region 5 (realising that coordinate system 2 is the exact opposite of coordinate system 1).&lt;br /&gt;
** Check for a region 5 intersection. Return the result.&lt;br /&gt;
* Calculate tan(2alpha).&lt;br /&gt;
* Check if &#039;&#039;P&#039;&#039; is is region 1.&lt;br /&gt;
** Check for a region 1 intersection. Return the result.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 3.&lt;br /&gt;
* Check if &#039;&#039;P&#039;&#039; is is region 6.&lt;br /&gt;
** Check for a region 6 intersection. Return the result.&lt;br /&gt;
* If &#039;&#039;P&#039;&#039; is not in region 1, region 5 or region 6, but the disk does intersect the bounding circle, then the intersection must be in region 2, region 3, or region 4.&lt;br /&gt;
&lt;br /&gt;
Any but the first five steps can be moved, if that is found to be more appropriate. The algorithm includes 5 calls to a trigonomic function.&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha), cos(alpha) and tan(2alpha) could be computed on startup of the game-server and stored for use.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Simplified collision test ==&lt;br /&gt;
By [[User:BjÃ¸rn|BjÃ¸rn]] 00:32, 28 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
Since our enemies aren&#039;t exactly circles anyway, I&#039;m prepared to do away with some of the above complexity. However if the above is efficiently and understandable enough, I&#039;m prepared to go with it. What I would propose is visualized as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Circle-sector hit test.png|frame|none|Overview of a simplified test]]&lt;br /&gt;
&lt;br /&gt;
In essense, the gradiented area is checked for collision instead of the exact circle. It would only require the areas with blue and red dotted lines to be checked on intersection and the circle radii to be checked for proximity. Something like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:blueA = dir - widenessAngle&lt;br /&gt;
:blueB = dir + widenessAngle&lt;br /&gt;
&lt;br /&gt;
:redA = cos(diskY / diskX) - cos(diskRadius / dist)&lt;br /&gt;
:redB = cos(diskY / diskX) + cos(diskRadius / dist)&lt;br /&gt;
&lt;br /&gt;
:diskDist = sqrt(diskX*diskX + diskY*diskY)&lt;br /&gt;
&lt;br /&gt;
:collision = redA &amp;lt; blueB &amp;amp;&amp;amp; redB &amp;gt; blueA &amp;amp;&amp;amp; diskDist - diskRadius &amp;lt; circleRadius&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ok that&#039;s two trigonomic function calls, two divisions and one sqrt (which could be avoided when circleRadius and diskRadius where given in their squared form).&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;The squareroot can be avoided by using:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::diskDist&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (diskRadius + circleRadius)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;However all the trigonomic function calls, contain a distance and are not cacheable (in a meaningfull way).&#039;&#039;&lt;br /&gt;
:&#039;&#039;[[User:Avaniel|Avaniel]] 01:30, 28 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Hmm, or maybe I should just let the pros handle this...&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis4.png&amp;diff=6184</id>
		<title>File:Collision-circlesecor-disk-axis4.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis4.png&amp;diff=6184"/>
		<updated>2007-03-02T21:30:34Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-boundingcircle.png&amp;diff=6183</id>
		<title>File:Collision-circlesecor-disk-boundingcircle.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-boundingcircle.png&amp;diff=6183"/>
		<updated>2007-03-02T21:30:20Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Development:Developers&amp;diff=6166</id>
		<title>Development:Developers</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Development:Developers&amp;diff=6166"/>
		<updated>2007-03-01T14:29:29Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Modified the Avaniel entry&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Active ==&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;border-bottom: 2px solid #efdead&amp;quot;&lt;br /&gt;
! style=&amp;quot;background:#efdead;&amp;quot; width=&amp;quot;150px&amp;quot; align=&amp;quot;left&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;background:#efdead;&amp;quot; width=&amp;quot;200px&amp;quot; align=&amp;quot;left&amp;quot; | Occupation&lt;br /&gt;
! style=&amp;quot;background:#efdead;&amp;quot; width=&amp;quot;150px&amp;quot; align=&amp;quot;left&amp;quot; | Location&lt;br /&gt;
&lt;br /&gt;
{{dev1| [[User:Bertram|Bertram]]                 | Programmer, Debian package maintainer | France}}&lt;br /&gt;
{{dev2| [[User:BjÃ¸rn|BjÃ¸rn Lindeijer]]           | Lead Programmer | The Netherlands}}&lt;br /&gt;
{{dev1| [[User:Crush|Crush]]                     | Pixel artist, mapper, programmer | Germany}}&lt;br /&gt;
{{dev2| [[User:Dabe|Dabe]]                       | Story and Geography writer | }}&lt;br /&gt;
{{dev1| [[User:Doener|Doener]]                   | Programmer | Germany}}&lt;br /&gt;
{{dev2| [[User:ElvenProgrammer|ElvenProgrammer]] | Project leader, programmer | Italy}}&lt;br /&gt;
{{dev1| [[User:Silene|Guillaume Melquiond (Silene)]] | Programmer | France}}&lt;br /&gt;
{{dev2| [[User:Irukard|Irukard]]                 | Pixel artist | Poland}}&lt;br /&gt;
{{dev1| [[User:maci|maci]]                       | User support | Germany}}&lt;br /&gt;
{{dev2| [[User:hackgrid|Matt]]                   | Blabbering idiot | Germany}}&lt;br /&gt;
{{dev1| [[User:Modanung|Modanung]]               | Pixel artist, concept artist | The Netherlands}}&lt;br /&gt;
{{dev2| [[User:Pajarico|Pajarico]]               | Art, writer | Spain}}&lt;br /&gt;
{{dev1| [[User:Pauan|Pauan]]                     | Graphics artist | USA}}&lt;br /&gt;
{{dev2| [[User:Platyna|Platyna]]                 | Slackware package maintainer | Poland}}&lt;br /&gt;
{{dev1| [[User:Avaniel|Rogier Polak (Avaniel)]]  | Programmer | The Netherlands}}&lt;br /&gt;
{{dev2| [[User:Rotonen|Rotonen]]                 | Head of art, story and music | Finland}}&lt;br /&gt;
{{dev1| [[User:Trapdoor|trapdoor]]               | Programmer |}}&lt;br /&gt;
{{dev2| [[User:Tuxtgz|Tuxtgz]]                   | Webinterface-Programmer | Germany}}&lt;br /&gt;
{{dev1| [[User:VictorSan|VictorSan]]             | Programmer | Spain}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Retired ==&lt;br /&gt;
{| border=&amp;quot;0&amp;quot; cellspacing=&amp;quot;0&amp;quot; cellpadding=&amp;quot;5&amp;quot; width=&amp;quot;100%&amp;quot; style=&amp;quot;border-bottom: 2px solid #efdead&amp;quot;&lt;br /&gt;
! style=&amp;quot;background:#efdead;&amp;quot; width=&amp;quot;150px&amp;quot; align=&amp;quot;left&amp;quot; | Name&lt;br /&gt;
! style=&amp;quot;background:#efdead;&amp;quot; width=&amp;quot;200px&amp;quot; align=&amp;quot;left&amp;quot; | Occupation&lt;br /&gt;
! style=&amp;quot;background:#efdead;&amp;quot; width=&amp;quot;150px&amp;quot; align=&amp;quot;left&amp;quot; | Location&lt;br /&gt;
&lt;br /&gt;
{{dev1| [[User:Gagaofdeath|Andrej Sinicyn]]      | Programmer | Germany}}&lt;br /&gt;
{{dev2| [[User:Bear|Bear]]                       | Scripter | USA}}&lt;br /&gt;
{{dev1| [[User:Catfish_Man|Catfish_Man]]         | Mac port | USA}}&lt;br /&gt;
{{dev2| Chetic                                   | Mapper | }}&lt;br /&gt;
{{dev1| [[User:Clef|Clef]]                       | Pixel artist | }}&lt;br /&gt;
{{dev2| [[User:Demon|Demon]]                     | Pixel artist | }}&lt;br /&gt;
{{dev1| [[User:deviexx|deviexx]]                 | Content manager | }}&lt;br /&gt;
{{dev2| [[User:Golgo|Golgo]]                     | Pixel artist | }}&lt;br /&gt;
{{dev1| Gnulia                                   | Concept artist | }}&lt;br /&gt;
{{dev2| Igor Morgado (imorgado)                  | Tester | }}&lt;br /&gt;
{{dev1| [[User:Javila|Javila]]                   | Programmer | Brazil}}&lt;br /&gt;
{{dev2| [[User:kindjal|kindjal]]                 | Programmer | France, currently Italy}}&lt;br /&gt;
{{dev1| [[User:Kinetic|Kinetic]]                 | Pixel artist | USA}}&lt;br /&gt;
{{dev2| kth5 (Shura)                             | Programmer | }}&lt;br /&gt;
{{dev1| [[User:Kyokai|Kyokai]]                   | Game systems designer | }}&lt;br /&gt;
{{dev2| [[User:Maester Pixel|Maester Pixel]]     | Pixel artist | USA}}&lt;br /&gt;
{{dev1| [[User:Magick|Magick]]                   | Musician | }}&lt;br /&gt;
{{dev2| [[User:Mkael|Mkael]]                     | Concept artist | Finland}}&lt;br /&gt;
{{dev1| [[User:Mra|Mra]]                         | Programmer | Germany}}&lt;br /&gt;
{{dev2| [[User:Neko-mon|Neko-mon]]               | Pixel artist | Brazil}}&lt;br /&gt;
{{dev1| Neorice                                  | Pixel artist | }}&lt;br /&gt;
{{dev2| [[User:Nym|nym]]                         | Programmer | Australia}}&lt;br /&gt;
{{dev1| Rodney Dawes (dobey)                     | Packager (install process) | }}&lt;br /&gt;
{{dev2| Romulo Fernandes (razor85)               | Artist | }}&lt;br /&gt;
{{dev1| Simon Edwardsson (simonedw/simedw)       | Packager (Mac) | }}&lt;br /&gt;
{{dev2| [[User:Sora|Sora]]                       | Pixel artist | Poland}}&lt;br /&gt;
{{dev1| [[User:Sull|Sull]]                       | Pixel artist and hosting | Canada}}&lt;br /&gt;
{{dev2| [[User:Talaroc|Talaroc]]                 | Pixel artist | }}&lt;br /&gt;
{{dev1| Ti Sing Hao                              | Musician | }}&lt;br /&gt;
{{dev2| Ultramichy                               | Hosting | }}&lt;br /&gt;
{{dev1| [[User:Usiu|Mateusz Kaduk (Usiu)]]              | Programmer | Poland}}&lt;br /&gt;
{{dev2| Vlady                                    | Artist | }}&lt;br /&gt;
{{dev1| zenogais (bitshift2002)                  | Programmer | }}&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6162</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6162"/>
		<updated>2007-02-28T00:30:15Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Comments @BjÃ¸rn:Simplified collision test&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&#039;&#039;By [[User:Avaniel|Avaniel]] 20:37, 27 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (CSD-1) for an overview.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-dimensions.png|frame|none|Diagram (CSD-1) - Overview of the Circle-Sector and Disk]]&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divided in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (CSD-2).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi.png|frame|none|Diagram (CSD-2) - The x-y plane divide in 6 &#039;Voronoi&#039; regions]]&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (CSD-3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (CSD-4)). [[:Image:Collision-circlesecor-disk-example1.png|An example of a region 1 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi1.png|frame|none|Diagram (CSD-3) - &#039;Voronoi&#039; region 1 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis1.png|frame|none|Diagram (CSD-4) - Coordinate system 1]]&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha) = P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; {2sin(alpha)cos(alpha) / (cos&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha) - sin&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha))}&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (CSD-5). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example2.png|An example of a region 2 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi2.png|frame|none|Diagram (CSD-5) - &#039;Voronoi&#039; region 2 highlighted]]&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (CSD-6). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example3.png|An example of a region 3 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi3.png|frame|none|Diagram (CSD-6) - &#039;Voronoi&#039; region 3 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (CSD-7). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example4.png|An example of a region 4 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi4.png|frame|none|Diagram (CSD-7) - &#039;Voronoi&#039; region 4 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (CSD-8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (CSD-9)). [[:Image:Collision-circlesecor-disk-example5.png|An example of a region 5 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi5.png|frame|none|Diagram (CSD-8) - &#039;Voronoi&#039; region 5 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis2.png|frame|none|Diagram (CSD-9) - Coordinate system 2]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (CSD-10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (CSD-11)). [[:Image:Collision-circlesecor-disk-example6.png|An example of a region 6 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi6.png|frame|none|Diagram (CSD-10) - &#039;Voronoi&#039; region 6 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis3.png|frame|none|Diagram (CSD-11) - Coordinate system 3]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &#039;&#039;R&#039;&#039;, the half-top-angle &#039;&#039;alpha&#039;&#039;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &#039;&#039;P&#039;&#039; and the radius of the disk &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;.&lt;br /&gt;
* Check for a region 4 intersection.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;A&#039;&#039;.&lt;br /&gt;
* Check for a region 3 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;B&#039;&#039;.&lt;br /&gt;
* Check for a region 2 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 2.&lt;br /&gt;
* Check for a region 5 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 3.&lt;br /&gt;
* Check for a region 6 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 1 and tan(2alpha).&lt;br /&gt;
* Check for a region 1 intersection.&lt;br /&gt;
&lt;br /&gt;
Any but the first three steps can be moved, if that is found to be more appropriate. The algorithm includes 4 calls to a trigonomic function and just 1 division.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha), cos(alpha) and tan(2alpha) could be computed on startup of the game-server and stored for use.&lt;br /&gt;
&lt;br /&gt;
== Simplified collision test ==&lt;br /&gt;
By [[User:BjÃ¸rn|BjÃ¸rn]] 00:32, 28 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
Since our enemies aren&#039;t exactly circles anyway, I&#039;m prepared to do away with some of the above complexity. However if the above is efficiently and understandable enough, I&#039;m prepared to go with it. What I would propose is visualized as follows:&lt;br /&gt;
&lt;br /&gt;
[[Image:Circle-sector hit test.png|frame|none|Overview of a simplified test]]&lt;br /&gt;
&lt;br /&gt;
In essense, the gradiented area is checked for collision instead of the exact circle. It would only require the areas with blue and red dotted lines to be checked on intersection and the circle radii to be checked for proximity. Something like:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
:blueA = dir - widenessAngle&lt;br /&gt;
:blueB = dir + widenessAngle&lt;br /&gt;
&lt;br /&gt;
:redA = cos(diskY / diskX) - cos(diskRadius / dist)&lt;br /&gt;
:redB = cos(diskY / diskX) + cos(diskRadius / dist)&lt;br /&gt;
&lt;br /&gt;
:diskDist = sqrt(diskX*diskX + diskY*diskY)&lt;br /&gt;
&lt;br /&gt;
:collision = redA &amp;lt; blueB &amp;amp;&amp;amp; redB &amp;gt; blueA &amp;amp;&amp;amp; diskDist - diskRadius &amp;lt; circleRadius&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Ok that&#039;s two trigonomic function calls, two divisions and one sqrt (which could be avoided when circleRadius and diskRadius where given in their squared form).&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;The squareroot can be avoided by using:&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
::diskDist&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (diskRadius + circleRadius)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;However all the trigonomic function calls, contain a distance and are not cacheable (in a meaningfull way).&#039;&#039;&lt;br /&gt;
:&#039;&#039;[[User:Avaniel|Avaniel]] 01:30, 28 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Hmm, or maybe I should just let the pros handle this...&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6158</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6158"/>
		<updated>2007-02-27T21:33:58Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Fixed typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&#039;&#039;By [[User:Avaniel|Avaniel]] 20:37, 27 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (CSD-1) for an overview.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-dimensions.png|frame|none|Diagram (CSD-1) - Overview of the Circle-Sector and Disk]]&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divided in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (CSD-2).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi.png|frame|none|Diagram (CSD-2) - The x-y plane divide in 6 &#039;Voronoi&#039; regions]]&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (CSD-3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (CSD-4)). [[:Image:Collision-circlesecor-disk-example1.png|An example of a region 1 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi1.png|frame|none|Diagram (CSD-3) - &#039;Voronoi&#039; region 1 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis1.png|frame|none|Diagram (CSD-4) - Coordinate system 1]]&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha) = P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; {2sin(alpha)cos(alpha) / (cos&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha) - sin&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha))}&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (CSD-5). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example2.png|An example of a region 2 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi2.png|frame|none|Diagram (CSD-5) - &#039;Voronoi&#039; region 2 highlighted]]&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (CSD-6). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example3.png|An example of a region 3 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi3.png|frame|none|Diagram (CSD-6) - &#039;Voronoi&#039; region 3 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (CSD-7). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example4.png|An example of a region 4 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi4.png|frame|none|Diagram (CSD-7) - &#039;Voronoi&#039; region 4 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (CSD-8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (CSD-9)). [[:Image:Collision-circlesecor-disk-example5.png|An example of a region 5 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi5.png|frame|none|Diagram (CSD-8) - &#039;Voronoi&#039; region 5 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis2.png|frame|none|Diagram (CSD-9) - Coordinate system 2]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (CSD-10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (CSD-11)). [[:Image:Collision-circlesecor-disk-example6.png|An example of a region 6 collision is given here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi6.png|frame|none|Diagram (CSD-10) - &#039;Voronoi&#039; region 6 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis3.png|frame|none|Diagram (CSD-11) - Coordinate system 3]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &#039;&#039;R&#039;&#039;, the half-top-angle &#039;&#039;alpha&#039;&#039;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &#039;&#039;P&#039;&#039; and the radius of the disk &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;.&lt;br /&gt;
* Check for a region 4 intersection.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;A&#039;&#039;.&lt;br /&gt;
* Check for a region 3 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;B&#039;&#039;.&lt;br /&gt;
* Check for a region 2 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 2.&lt;br /&gt;
* Check for a region 5 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 3.&lt;br /&gt;
* Check for a region 6 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 1 and tan(2alpha).&lt;br /&gt;
* Check for a region 1 intersection.&lt;br /&gt;
&lt;br /&gt;
Any but the first three steps can be moved, if that is found to be more appropriate. The algorithm includes 4 calls to a trigonomic function and just 1 division.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha), cos(alpha) and tan(2alpha) could be computed on startup of the game-server and stored for use.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6157</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6157"/>
		<updated>2007-02-27T19:37:37Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Final touch...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&#039;&#039;By [[User:Avaniel|Avaniel]] 20:37, 27 February 2007 (CET)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (CSD-1) for an overview.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-dimensions.png|frame|none|Diagram (CSD-1) - Overview of the Circle-Sector and Disk]]&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divided in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (CSD-2).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi.png|frame|none|Diagram (CSD-2) - The x-y plane divide in 6 &#039;Voronoi&#039; regions]]&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (CSD-3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (CSD-4)). [[:Image:Collision-circlesecor-disk-example1.png|An example of a region 1 collision is give here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi1.png|frame|none|Diagram (CSD-3) - &#039;Voronoi&#039; region 1 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis1.png|frame|none|Diagram (CSD-4) - Coordinate system 1]]&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha) = P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; {2sin(alpha)cos(alpha) / (cos&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha) - sin&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;(alpha))}&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (CSD-5). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example2.png|An example of a region 2 collision is give here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi2.png|frame|none|Diagram (CSD-5) - &#039;Voronoi&#039; region 2 highlighted]]&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (CSD-6). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example3.png|An example of a region 3 collision is give here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi3.png|frame|none|Diagram (CSD-6) - &#039;Voronoi&#039; region 3 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (CSD-7). For this region no coordinate transformations are necessary. [[:Image:Collision-circlesecor-disk-example4.png|An example of a region 4 collision is give here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi4.png|frame|none|Diagram (CSD-7) - &#039;Voronoi&#039; region 4 highlighted]]&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (CSD-8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (CSD-9)). [[:Image:Collision-circlesecor-disk-example5.png|An example of a region 5 collision is give here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi5.png|frame|none|Diagram (CSD-8) - &#039;Voronoi&#039; region 5 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis2.png|frame|none|Diagram (CSD-9) - Coordinate system 2]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (CSD-10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (CSD-11)). [[:Image:Collision-circlesecor-disk-example6.png|An example of a region 6 collision is give here.]]&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi6.png|frame|none|Diagram (CSD-10) - &#039;Voronoi&#039; region 6 highlighted]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis3.png|frame|none|Diagram (CSD-11) - Coordinate system 3]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &#039;&#039;R&#039;&#039;, the half-top-angle &#039;&#039;alpha&#039;&#039;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &#039;&#039;P&#039;&#039; and the radius of the disk &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;.&lt;br /&gt;
* Check for a region 4 intersection.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;A&#039;&#039;.&lt;br /&gt;
* Check for a region 3 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;B&#039;&#039;.&lt;br /&gt;
* Check for a region 2 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 2.&lt;br /&gt;
* Check for a region 5 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 3.&lt;br /&gt;
* Check for a region 6 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;P&#039;&#039; in coordinate system 1.&lt;br /&gt;
* Check for a region 1 intersection.&lt;br /&gt;
&lt;br /&gt;
Any but the first three steps can be moved, if that is found to be more appropriate. The algorithm includes 4 calls to a trigonomic function and just 1 division.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha), cos(alpha) and tan(2alpha) could be computed on startup of the game-server and stored for use.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6156</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6156"/>
		<updated>2007-02-27T04:43:46Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Added the Circle-Sector with Disk collision&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (CSD-1) for an overview.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-dimensions.png|frame|none|Diagram (CSD-1)]]&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divide in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (CSD-2).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi.png|frame|none|Diagram (CSD-2)]]&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (CSD-3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (CSD-4)). &lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi1.png|frame|none|Diagram (CSD-3)]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis1.png|frame|none|Diagram (CSD-4)]]&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha)&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (CSD-5). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi2.png|frame|none|Diagram (CSD-5)]]&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (CSD-6). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi3.png|frame|none|Diagram (CSD-6)]]&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (CSD-7). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi4.png|frame|none|Diagram (CSD-7)]]&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (CSD-8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (CSD-9)).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi5.png|frame|none|Diagram (CSD-8)]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis2.png|frame|none|Diagram (CSD-9)]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (CSD-10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (CSD-11)).&lt;br /&gt;
&lt;br /&gt;
[[Image:Collision-circlesecor-disk-voronoi6.png|frame|none|Diagram (CSD-10)]]&lt;br /&gt;
[[Image:Collision-circlesecor-disk-axis3.png|frame|none|Diagram (CSD-11)]]&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &amp;quot;R&amp;quot;, the half-top-angle &amp;quot;alpha&amp;quot;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &amp;quot;P&amp;quot; and the radius of the disk &amp;quot;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;quot;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;.&lt;br /&gt;
* Check for a region 4 intersection.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;A&#039;&#039;.&lt;br /&gt;
* Check for a region 3 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;B&#039;&#039;.&lt;br /&gt;
* Check for a region 2 intersection.&lt;br /&gt;
* Calculate the coordinates of point &amp;quot;P&amp;quot; in coordinate system 2.&lt;br /&gt;
* Check for a region 5 intersection.&lt;br /&gt;
* Calculate the coordinates of point &amp;quot;P&amp;quot; in coordinate system 3.&lt;br /&gt;
* Check for a region 6 intersection.&lt;br /&gt;
* Calculate the coordinates of point &amp;quot;P&amp;quot; in coordinate system 1.&lt;br /&gt;
* Check for a region 1 intersection.&lt;br /&gt;
&lt;br /&gt;
Any but the first three steps can be moved, if that is found to be more appropriate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha) and cos(alpha) could be computed on startup of the game-server and stored for use.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;There is a trick for tan(2alpha), but I&#039;m done for today.&#039;&#039;[[User:Avaniel|Avaniel]] 05:43, 27 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi6.png&amp;diff=6155</id>
		<title>File:Collision-circlesecor-disk-voronoi6.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi6.png&amp;diff=6155"/>
		<updated>2007-02-27T04:21:32Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi5.png&amp;diff=6154</id>
		<title>File:Collision-circlesecor-disk-voronoi5.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi5.png&amp;diff=6154"/>
		<updated>2007-02-27T04:21:14Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi4.png&amp;diff=6153</id>
		<title>File:Collision-circlesecor-disk-voronoi4.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi4.png&amp;diff=6153"/>
		<updated>2007-02-27T04:18:38Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi3.png&amp;diff=6152</id>
		<title>File:Collision-circlesecor-disk-voronoi3.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi3.png&amp;diff=6152"/>
		<updated>2007-02-27T04:18:20Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi2.png&amp;diff=6151</id>
		<title>File:Collision-circlesecor-disk-voronoi2.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi2.png&amp;diff=6151"/>
		<updated>2007-02-27T04:18:07Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi1.png&amp;diff=6150</id>
		<title>File:Collision-circlesecor-disk-voronoi1.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi1.png&amp;diff=6150"/>
		<updated>2007-02-27T04:17:49Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi.png&amp;diff=6149</id>
		<title>File:Collision-circlesecor-disk-voronoi.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-voronoi.png&amp;diff=6149"/>
		<updated>2007-02-27T04:17:30Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example6.png&amp;diff=6148</id>
		<title>File:Collision-circlesecor-disk-example6.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example6.png&amp;diff=6148"/>
		<updated>2007-02-27T04:17:16Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example5.png&amp;diff=6147</id>
		<title>File:Collision-circlesecor-disk-example5.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example5.png&amp;diff=6147"/>
		<updated>2007-02-27T04:16:46Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example4.png&amp;diff=6146</id>
		<title>File:Collision-circlesecor-disk-example4.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example4.png&amp;diff=6146"/>
		<updated>2007-02-27T04:16:31Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example3.png&amp;diff=6145</id>
		<title>File:Collision-circlesecor-disk-example3.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example3.png&amp;diff=6145"/>
		<updated>2007-02-27T04:16:17Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example2.png&amp;diff=6144</id>
		<title>File:Collision-circlesecor-disk-example2.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example2.png&amp;diff=6144"/>
		<updated>2007-02-27T04:15:51Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example1.png&amp;diff=6143</id>
		<title>File:Collision-circlesecor-disk-example1.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-example1.png&amp;diff=6143"/>
		<updated>2007-02-27T04:15:06Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-dimensions.png&amp;diff=6142</id>
		<title>File:Collision-circlesecor-disk-dimensions.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-dimensions.png&amp;diff=6142"/>
		<updated>2007-02-27T04:14:38Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis3.png&amp;diff=6141</id>
		<title>File:Collision-circlesecor-disk-axis3.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis3.png&amp;diff=6141"/>
		<updated>2007-02-27T04:14:18Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis2.png&amp;diff=6140</id>
		<title>File:Collision-circlesecor-disk-axis2.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis2.png&amp;diff=6140"/>
		<updated>2007-02-27T04:14:03Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis1.png&amp;diff=6139</id>
		<title>File:Collision-circlesecor-disk-axis1.png</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=File:Collision-circlesecor-disk-axis1.png&amp;diff=6139"/>
		<updated>2007-02-27T04:13:47Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6138</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6138"/>
		<updated>2007-02-27T02:34:57Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Just saving changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used, is given below. Of course any improvements or clarifications can allso be added and discussed on this page.&lt;br /&gt;
&lt;br /&gt;
Strictly speaking, the algorithms discussed here, compute if two geometric figures intersect. However, the result is then used in a dynamic game. In the game world two objects will collide if their movement areas intersect.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Sector with Disk ==&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-sector and a disk collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-sector is located at the origin. The circle-sector can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top-angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The disk can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (1) for an overview.&lt;br /&gt;
&lt;br /&gt;
Diagram (1)&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-sector and the circle intersect, the x-y plane is divide in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the arc &#039;&#039;A-B&#039;&#039;. They are shown in diagram (2).&lt;br /&gt;
&lt;br /&gt;
Diagram (2)&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (3), it includes the interior of the Circle-sector. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (4)). &lt;br /&gt;
&lt;br /&gt;
Diagram(3) and (4)&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha)&lt;br /&gt;
&lt;br /&gt;
The Circle-sector and the disc then intersect if&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (5). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (5)&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-sector and the disk can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (6). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (6)&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-sector and the disk can only intersect if point &#039;&#039;A&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (7). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (7)&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-sector and the disk can only intersect if point &#039;&#039;O&#039;&#039; is inside the disk. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (9)).&lt;br /&gt;
&lt;br /&gt;
Diagrams (8) and (9)&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= -R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta + pi) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (11)).&lt;br /&gt;
&lt;br /&gt;
Diagrams (10) and (11)&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-sector and the disk intersecting is:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
:P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The Algorithm ===&lt;br /&gt;
&lt;br /&gt;
The following values need to be given; the radius of the circle-sector &amp;quot;R&amp;quot;, the half-top-angle &amp;quot;alpha&amp;quot;, the placement angle &#039;&#039;beta&#039;&#039;, the coordinates of the center of the circle-sector, the coordinates of the center of the disk &amp;quot;P&amp;quot; and the radius of the disk &amp;quot;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;quot;.&lt;br /&gt;
* Subtract the coordinates of the center of the circle sector from the coordinates of point &#039;&#039;P&#039;&#039;.&lt;br /&gt;
* Check for a region 4 intersection.&lt;br /&gt;
* Calculate sin(alpha), cos(alpha), sin(beta) and cos(beta) and store them in temporary variables.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;A&#039;&#039;.&lt;br /&gt;
* Check for a region 3 intersection.&lt;br /&gt;
* Calculate the coordinates of point &#039;&#039;B&#039;&#039;.&lt;br /&gt;
* Check for a region 2 intersection.&lt;br /&gt;
* Calculate the coordinates of point &amp;quot;P&amp;quot; in coordinate system 2.&lt;br /&gt;
* Check for a region 5 intersection.&lt;br /&gt;
* Calculate the coordinates of point &amp;quot;P&amp;quot; in coordinate system 3.&lt;br /&gt;
* Check for a region 6 intersection.&lt;br /&gt;
* Calculate the coordinates of point &amp;quot;P&amp;quot; in coordinate system 1.&lt;br /&gt;
* Check for a region 1 intersection.&lt;br /&gt;
&lt;br /&gt;
Any but the first three steps can be moved, if that is found to be more appropriate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the current combat implementation sin(beta) and cos(beta) do not need to be calculated at runtime. &#039;&#039;Beta&#039;&#039; is determined by the direction the attacker is facing. There are only four possible values for &#039;&#039;beta&#039;&#039;; 0, pi/2, pi and pi*3/2. Because the half-top-angle is a property of the weapon used, sin(alpha) and cos(alpha) could be computed on startup of the game-server and stored for use.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6137</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6137"/>
		<updated>2007-02-27T01:32:17Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Just saving changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used is given below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Segment with Circle ==&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-segment and a circle collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-segment is located at the origin. The circle segment can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The circle can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (1) for an overview.&lt;br /&gt;
&lt;br /&gt;
Diagram (1)&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-segment and the circle overlap, the x-y plane is divide in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the circular vertex &#039;&#039;A-B&#039;&#039;. They are shown in diagram (2).&lt;br /&gt;
&lt;br /&gt;
Diagram (2)&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (3), it includes the interior of the Circle-segment. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (4)). &lt;br /&gt;
&lt;br /&gt;
Diagram(3) and (4)&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha)&lt;br /&gt;
&lt;br /&gt;
The Circle-segment and the circle then intersect if&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (5). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (5)&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-segment and the circle can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (6). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (6)&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-segment and the circle can only intersect if point &#039;&#039;A&#039;&#039; is inside the circle. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (7). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (7)&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-segment and the circle can only intersect if point &#039;&#039;O&#039;&#039; is inside the circle. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (9)).&lt;br /&gt;
&lt;br /&gt;
Diagrams (8) and (9)&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-segment and the circle intersecting is:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)cos(alpha + beta + pi) + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)cos(alpha + beta + pi) - (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)cos(alpha + beta) + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -(P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)cos(alpha + beta) - (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;){cos(alpha)cos(beta) - sin(alpha)sin(beta)} + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;){sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -(P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;){cos(alpha)cos(beta) - sin(alpha)sin(beta)} - (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;){sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039;, calculated for region 3, the conditions can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 6 ===&lt;br /&gt;
&lt;br /&gt;
Region 6 is highlighted in diagram (10). For region 6, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 3 (shown in diagram (11)).&lt;br /&gt;
&lt;br /&gt;
Diagrams (10) and (11)&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 6, can be formulated:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;gt;= 0 &lt;br /&gt;
&lt;br /&gt;
The condition for the circle-segment and the circle intersecting is:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 3 are given by:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;cos(alpha + beta) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y3&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;cos(alpha + beta) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;sin(alpha + beta)&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;{cos(alpha)cos(beta) - sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;{sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
The conditions can now be evaluated.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6136</id>
		<title>Archive:Collision determination</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive:Collision_determination&amp;diff=6136"/>
		<updated>2007-02-26T23:04:12Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Just saving changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Status_red}}&lt;br /&gt;
&lt;br /&gt;
This page was created to document the collision detection algorithms used in The Mana World. After the algorithms are converted to C++ and added to the code base it is very difficult to verify the assumptions and math of the author. Therefore an explanation of the algorithms used is given below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Circle-Segment with Circle ==&lt;br /&gt;
&lt;br /&gt;
In order to determine if a circle-segment and a circle collide, we start with transforming the coordinates of the 2d space in such a way that the center of the circle-segment is located at the origin. The circle segment can then be defined by a radius &#039;&#039;R&#039;&#039;, a half-top angle &#039;&#039;alpha&#039;&#039; and a placement angle &#039;&#039;beta&#039;&#039;, as shown in diagram (1).&lt;br /&gt;
&lt;br /&gt;
The circle can simply be defined by its center-point &#039;&#039;P&#039;&#039; and its radius &#039;&#039;R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&#039;&#039;, where point &#039;&#039;P&#039;&#039; can be anywhere in the 2d space. See diagram (1) for an overview.&lt;br /&gt;
&lt;br /&gt;
Diagram (1)&lt;br /&gt;
&lt;br /&gt;
In order to determine if the circle-segment and the circle overlap, the x-y plane is divide in 6 &#039;&#039;Voronoi&#039;&#039; like regions. The regions are based on the vertexes &#039;&#039;O-A&#039;&#039;, &#039;&#039;O-B&#039;&#039; and the circular vertex &#039;&#039;A-B&#039;&#039;. They are shown in diagram (2).&lt;br /&gt;
&lt;br /&gt;
Diagram (2)&lt;br /&gt;
&lt;br /&gt;
For each region it is now determined what the pre-conditions for an overlap are, if &#039;&#039;P&#039;&#039; is in that region. If necessary, the pre-conditions for point &#039;&#039;P&#039;&#039; being in the region will be derived as well.&lt;br /&gt;
&lt;br /&gt;
In the following text, a subscript &#039;&#039;x&#039;&#039; and &#039;&#039;y&#039;&#039; are used to indicate x and y coordinate of a point. If the coordinates considered are in a tranformed coordinate system, an extra indicator will be added. For example the x-coordinate of point A in the x&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt;-y&amp;lt;sub&amp;gt;1&amp;lt;/sub&amp;gt; coordinate system is denoted as: A&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 1 ===&lt;br /&gt;
&lt;br /&gt;
Region 1 is highlighted in diagram (3), it includes the interior of the Circle-segment. For region 1, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 1 (shown in diagram (4)). &lt;br /&gt;
&lt;br /&gt;
Diagram(3) and (4)&lt;br /&gt;
&lt;br /&gt;
The coordinates for point &#039;&#039;P&#039;&#039; in coordinate system 1 are:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; cos(beta-alpha) + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; cos(beta-alpha) - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; sin(beta-alpha)&lt;br /&gt;
&lt;br /&gt;
Using goniometric relations this can be simplified to:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; = P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; {cos(alpha)cos(beta) + sin(alpha)sin(beta)} - P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
Point &#039;&#039;P&#039;&#039; is inside region 1 if&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; &amp;gt;= 0  , P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;gt;= 0 and P&amp;lt;sub&amp;gt;y1&amp;lt;/sub&amp;gt; &amp;lt;= P&amp;lt;sub&amp;gt;x1&amp;lt;/sub&amp;gt; tan(2alpha)&lt;br /&gt;
&lt;br /&gt;
The Circle-segment and the circle then intersect if&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= (R + R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 2 ===&lt;br /&gt;
&lt;br /&gt;
Region 2 is highlighted in diagram (5). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (5)&lt;br /&gt;
&lt;br /&gt;
If point &#039;&#039;P&#039;&#039; is inside region 2, the circle-segment and the circle can only intersect if point &#039;&#039;B&#039;&#039;  is inside the circle. &lt;br /&gt;
&lt;br /&gt;
(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;B&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
B&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(alpha + beta) = R {cos(alpha)cos(beta) - sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
B&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(alpha + beta) = R {sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;B&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 3 ===&lt;br /&gt;
&lt;br /&gt;
Region 3 is highlighted in diagram (6). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (6)&lt;br /&gt;
&lt;br /&gt;
Analogous to region 2, the circle-segment and the circle can only intersect if point &#039;&#039;A&#039;&#039; is inside the circle. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates of point &#039;&#039;A&#039;&#039; are:&lt;br /&gt;
&lt;br /&gt;
A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; = R cos(-alpha + beta) = R {cos(alpha)cos(beta) + sin(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; = R sin(-alpha + beta) = R {-sin(alpha)cos(beta) + cos(alpha)sin(beta)}&lt;br /&gt;
&lt;br /&gt;
With the coordinates for &#039;&#039;A&#039;&#039; the condition can now be evaluated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 4 ===&lt;br /&gt;
&lt;br /&gt;
Region 4 is highlighted in diagram (7). For this region no coordinate transformations are necessary.&lt;br /&gt;
&lt;br /&gt;
Diagram (7)&lt;br /&gt;
&lt;br /&gt;
Analogous to regions 2 and 3, the circle-segment and the circle can only intersect if point &#039;&#039;O&#039;&#039; is inside the circle. The  condition for this is:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; + P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Region 5 ===&lt;br /&gt;
&lt;br /&gt;
Region 5 is highlighted in diagram (8). For region 5, the coordinates for point &#039;&#039;P&#039;&#039; are transformed to coordinate system 2 (shown in diagram (9)).&lt;br /&gt;
&lt;br /&gt;
Diagrams (8) and (9)&lt;br /&gt;
&lt;br /&gt;
In the local coordinates the following conditions for &#039;&#039;P&#039;&#039; being in region 5, can be formulated:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;gt;= 0, P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; &amp;lt;= R and P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; &amp;lt;= R&amp;lt;sub&amp;gt;P&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The coordinates for &#039;&#039;P&#039;&#039; in coordinate system 2 are given by:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)cos(alpha + beta + pi) + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)cos(alpha + beta + pi) - (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)sin(alpha + beta + pi)&lt;br /&gt;
&lt;br /&gt;
Using the goniometric relations to handle the &#039;&#039;pi&#039;&#039; term first, the coordinates become:&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;x2&amp;lt;/sub&amp;gt; = -(P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)cos(alpha + beta) + (P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
P&amp;lt;sub&amp;gt;y2&amp;lt;/sub&amp;gt; = -(P&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;y&amp;lt;/sub&amp;gt;)cos(alpha + beta) - (P&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt; - A&amp;lt;sub&amp;gt;x&amp;lt;/sub&amp;gt;)sin(alpha + beta )&lt;br /&gt;
&lt;br /&gt;
Now using the goniometric relations to seperate &#039;&#039;alpha&#039;&#039; and &#039;&#039;beta&#039;&#039;:&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=User:Avaniel&amp;diff=6135</id>
		<title>User:Avaniel</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=User:Avaniel&amp;diff=6135"/>
		<updated>2007-02-26T19:17:04Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Real name: Rogier Polak&lt;br /&gt;
&lt;br /&gt;
Avaniel on IRC, the forum and (offcoarse) this wiki.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Pages created by me===&lt;br /&gt;
(just an easy way for me to keep track of them all :-) )&lt;br /&gt;
*[[Collision determination]]&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6126</id>
		<title>Archive talk:Skill system 2</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6126"/>
		<updated>2007-02-26T00:31:14Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: another set of comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;Eeiya, I think this is a good proposal, however I offer some minor suggestions. As others have stated, we should NOT just give the EXP/items to the first person to hit it, because that would encourage players attacking every monster on a map. Instead, it should either be time, or distance based, possibly a mixture of both. For instance, move 15 tiles away from the monster and it returns to &amp;quot;everybody mode.&amp;quot; Or, after you have not attacked for a certain amount of time, it will once again return to &amp;quot;everybody mode.&amp;quot; We should NOT have it party based (meaning the ENTIRE party has to move away from the monster). Why? Because then there would be large parties dedicated to attacking monsters, and as long as at least one person in the party is close enough to the monster(s), everybody gets EXP. No, that won&#039;t work at all. Instead, if even ONE person in the party leaves the area, I think the monster should go back to being a free kill. BUT! Let&#039;s say that one player in the party left to go buy an item, but the rest of the party (let&#039;s say 4 people) stayed behind. The instant the player leaves, the monster goes back into free mode. However, since the rest of the party is still around, and still attacking it, the monster only stays in free mode for less than a second. Thus, the balance is maintained. I also think that only those within a certain radius of the monster should get EXP (in other words, if you go AFK and don&#039;t move, you shouldn&#039;t be able to leech off your party which is three maps away.) So yeah, just some minor suggestions, but I approve of it overall.&lt;br /&gt;
:::::::::::::::::::::::::::::[[User:Pauan|Pauan]] 04:03, 1 January 2007 (CET)&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== @Direct Combat Skills - 1 ===&lt;br /&gt;
Why not base the exp gained on the work done directly?&lt;br /&gt;
For fighters this would mean exp is calculated based on the hp loss of the enemy after each of the fighter&#039;s hits. Healers would gain exp which based on the amount of hp gained by the wounded. Combined with the &#039;&#039;challenge rating&#039;&#039;, this could balance out group attacks quite nicely. Healers would be able to heal more if a group is damaged more and so profit from attacking stronger mobs as much as the rest of the team.&lt;br /&gt;
In this way the game server doesn&#039;t need to store a play-by-play of the fight to calculate exp. It could just be stored in a buffer, ready for use when the fight ends (allthough I would not be opposed to levelling during a fight).&lt;br /&gt;
This would work in the following manner:&lt;br /&gt;
* Player attacks with short sword equiped&lt;br /&gt;
* Damage to mob is calculated&lt;br /&gt;
* Exp for that player is calculated based on the damage done&lt;br /&gt;
* Exp is added to Player&#039;s sword-skill-exp-buffer (or something like that)&lt;br /&gt;
* Rinse, repeat&lt;br /&gt;
* Mob dies, exp is added OR Player dies, bye bye exp (if a buffer is used)&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::This concept was in fact my first idea. But there were a lot of problems I found when I thought about it thoroughly.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;1st:&#039;&#039;&#039; When you calculate exp based on enemies hp loss, what happens when the mob is healed? Players could heal mobs intentionally again and again to harvest tons of exp.&lt;br /&gt;
:::&#039;&#039;Actually, I would consider this a good tactic. We just have to calculate the numbers so that a player couldn&#039;t do it by himself after a certain level. Frankly, I would encourage this form of cooperation.&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
::::I just see here a lot of potential for abuse. It would also encourage irrational behavior. Monsters are for getting defeated. Players should be encouraged to fight them as efficient as possible. --[[User:Crush|Crush]] 00:49, 26 February 2007 (CET)&lt;br /&gt;
:::::&#039;&#039;Think of it as a cat playing with a mouse, or a lioness bringing small live prey to her cubs, to teach them hunting. As I said, it should only be a viable option for weak players.&#039;&#039;--[[User:Avaniel|Avaniel]] 01:31, 26 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;2nd:&#039;&#039;&#039; i) To calculate the exp of healers based on the challenge rating of the mob is also very complicate. ii) What challenge rating should apply when a fighter is attacked by multiple enemies with different challenge ratings? iii) And what is when the combat is over and the healer heals? Which attackers challenge rating does apply then? iv) And what about support spells? How should these be awarded?&lt;br /&gt;
:::&#039;&#039;i,iii) I wouldn&#039;t apply a &#039;&#039;challenge rating&#039;&#039; to healing spells. Just the hp gained should be efficient. If you are the healer in a group of tanks, you won&#039;t get very far if they insist on fighting bunnies.&#039;&#039;&lt;br /&gt;
:::&#039;&#039;ii) If a fighter hits three enemies with one slash of his sword, he&#039;ll recieve exp based on the individual enemies he hits, and their respective &#039;&#039;challenge ratings&#039;&#039;.&#039;&#039;&lt;br /&gt;
:::&#039;&#039;iv) For support spells we&#039;ll find a solution eventually (maybe based on magic defense of the mob).&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;3rd:&#039;&#039;&#039; Exp based on damage done is favoring offensive characters (damage dealers) while defensive characters (tanks) are very unprivileged and receive almost no exp although they are doing a very important job, too. Of course it would be possible to give exp for received damage. But this would encourage people to get hurt as much as possible and not avoiding damage as you would expect them. This would result in very unrealistic behavior.&lt;br /&gt;
:::&#039;&#039;We could base this on natural (sans magic) healing. I&#039;ll just add a quote:&#039;&#039; &#039;&#039;&#039;What doesn&#039;t kill me, makes me stronger&#039;&#039;&#039; &#039;&#039;But at this point I don&#039;t see much difference between &#039;&#039;tanks&#039;&#039; and &#039;&#039;fighters&#039;&#039;. &#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
::::There is a reason why I don&#039;t want any exp gain for losing hit points. People will stand around and let mobs attack them without striking back to build up hp. Maybe even while being afk. I want to reward the players for fighting efficient and not for letting the mobs beat them up. --[[User:Crush|Crush]] 00:49, 26 February 2007 (CET)&lt;br /&gt;
:::::&#039;&#039;Or we could let &#039;defense&#039; be an actual skill, which gaines exp if the character blocks an attack (exp based on mob lvl). We would then need to implement a &#039;block&#039; action, which may only be used with certain weapons. For example you could block a sword attack with another sword but it would be much more effective with a shield. Vitality could then be based on the total exp gained on (allmost) all skills.&#039;&#039;--[[User:Avaniel|Avaniel]] 01:31, 26 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;4th:&#039;&#039;&#039; The reason why I decided to distribute exp evenly between the skills is that it allows the player to train new skills while still doing the most work with the main skill. This doesn&#039;t force the player to use weak skills over and over again while they have much stronger skills. Instead it allows them to still be effective and advance in the game while the training of a new skill is a secondary task.&lt;br /&gt;
:::&#039;&#039;If you&#039;d rather be an archer after 4 weeks of being a warrior, you&#039;d beter do the work like the rest of the n00bs :) On a more serious note, I think it will promote character diversity, and multiple characters per player.&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::I hope you see now why i decided to do things like i did. --[[User:Crush|Crush]] 14:04, 16 February 2007 (CET)&lt;br /&gt;
:::&#039;&#039;Yes and no :)&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @&amp;quot;Forgetting&amp;quot; of unused skills ===&lt;br /&gt;
As a side note, I wouldn&#039;t decrease a random skill, I would much prefer it if a set of incompatible skills are defined. For instance if a player learns a new spell or gains a level in a magic related skill, weapon skills decrease. This would work in the following scenario: lets define that weapon skills and magic skills are incompatible; A player could be training his sword skill, gain a level in that, after which his magic skill decreases. Eventually his magic skill will decrease past the minimum level required to use that healing spell he favors. He would then need to make a decision if he really wants to train magic to regain the healing spell. Only to loose the spell once more after the next increase of his weapon skill. &lt;br /&gt;
&lt;br /&gt;
The (gained exp / lost exp) quotient would have to be calculated to allow only for low level multi-purpose-characters. I would combine this with some exponential exp requirements, which depend on total exp instead of current skill level. This would mean that you could actually ruin a character completely. When the characters exp requirements for a next level of skill are very high and the skill level itself is very low. &lt;br /&gt;
&lt;br /&gt;
In this way a set of compatible skills could also be defined, which will not decrease. An example which comes to mind is smithing and sword fighting.&lt;br /&gt;
&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
:i like the idea of the counterbalancing of lost skills, as magic increases then weapon skills decrease ... i think there should be other ones though to, like if you chose to start using an axe as opposed to a sword, your sword skills decrease as your axe skills increase.&lt;br /&gt;
:[[User:zick|zick]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @New enemy spawning/exp generating proposal === by [[User:zick|zick]]&lt;br /&gt;
&lt;br /&gt;
i think this proposal would work best with a SoM/Zelda-ish battle engine, as opposed to the one that is currently implemented ...&lt;br /&gt;
&lt;br /&gt;
everytime an enemy is respawned, the server determines its HP by the following equation (subject to change, shown in psuedocode):&lt;br /&gt;
&lt;br /&gt;
((enemyBaseHP +/- randomNumZeroToFive) * randLVL) +/- randNumZeroToEleven)&lt;br /&gt;
&lt;br /&gt;
description of this equation:&lt;br /&gt;
&amp;quot;enemyBaseHP&amp;quot; is a static value (doesn&#039;t change) defined in an enemies config file&lt;br /&gt;
&amp;quot;randLVL&amp;quot; is a dynamic value generated by using the equation (avgLvlOfPlayersOnMap +/- randNumZeroToFive) and is the level of the enemy, which determines how strong the enemy is, its drop tables, how much experience it will give, etc.&lt;br /&gt;
&amp;quot;randomNumZeroToFive&amp;quot; and &amp;quot;randNumZeroToEleven&amp;quot; are values generated from a dice-rolling function (6 &amp;amp; 12-sided respectively)&lt;br /&gt;
the &amp;quot;+/-&amp;quot; operator randomly chooses whether to add or subtract values&lt;br /&gt;
&lt;br /&gt;
in other words, every enemy levels in the same manner as players do, gaining abilities and getting stronger with every level. You may even find level 99 maggots! Also two enemies with the same levels may actually have differing amounts of HP and give out differing amounts of exp.&lt;br /&gt;
&lt;br /&gt;
: Ok, I like the variation principle, but only within a well defined boundary. I dislike the idea of having monster strength based on average player strength. I think exploration should be promoted and that the starting area&#039;s really shouldn&#039;t have anything of interest for higher level players.[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
:: as far as exploration there should be some other reasons to explore than just gaining experience, such as quests.  maybe even since you want add more races at some point, you always start a new character as a human, but when you make your way from the human towns to say the fish-peoples town, you gain the ability to start a new character as a fish-person (which opens new weapons (shops sell items based on sex and race), skills, and places you can go (humans can&#039;t travel everywhere that say a fish-person can and vice versa)) --[[User:zick|zick]] 16:09, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
also something interesting that i want to add is that this makes it easier to create enemies ... just create a base species and allow it level on it own, no more trying to come up with different names for red slimes and green slimes (what happens when you run out of colors, hmmm!)  ever notice how old school rpgs like ff on snes, would use the same spriteset for all of its imps and just call them imps or imp generals or imp captain, what happens when you run out of ranks.  plus then i think it makes the enemies be more like the creatures of this world you&#039;ve created.  if we were to make a rpg of our planet, and cougars were one of the enemies, we wouldn&#039;t have blue cougars and red cougars, we&#039;d just have cougars ... but not every cougar looks quite the same, so why not allow the enemy spriteset include variations of an enemy (check out the following image: [http://www.bottledtalent.com/images/productspuddlebunnies.gif bunnies] and check out all the different bunnies some are white some are spotted some are brown, etc.)&lt;br /&gt;
&lt;br /&gt;
: I believe that, the green/red/white/yellow slimes are just an easy way to get started, the endgoal will most definetly be a diverse world, with different species of mobs. Basically, this stuff is waiting on well defined view of the game world, after which concept artists can get started developing a whole range of mobs. The system described here just makes it easier to be lazy.[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
while talking about enemies, the EXP system should be mentioned and explained. First off every enemy has a base EXP value, stored in its config file. This value has the following equation applied to it:&lt;br /&gt;
&lt;br /&gt;
((enemyBaseEXP +/- randomNumZeroToFive) * enemyLVL) +/- randNumZeroToEleven)&lt;br /&gt;
&lt;br /&gt;
this value is the total amount of distrubitable EXP that the enemy can give. each player that contributed to the death of said enemy (who is still on the current map when death occurs) is awarded a percentage (rounded to the nearest whole number) of these EXP based on the overall percentage damage that they did. also there are two bonuses that can be applied to the EXP you are awarded. the first is called the &amp;quot;kill bonus&amp;quot; and is granted to the person who actually kills the enemy, this encourages kill stealing (part of the friendly-fire free for all system that i would like explain later). this bonus is equivalent to the &amp;quot;baseEXP&amp;quot; value. the second bonus is an &amp;quot;overkill bonus&amp;quot; and is granted when your final killing hit is more than the remaining HP of the enemy (the system knows how much damage you have to do to kill the enemy and usually won&#039;t overkill by much, unless you kill with a critical hit, a limit break, or a special move) and is generated by dividing the amount of damage over the remaining HP by the baseEXP (and of course rounding to a whole number)&lt;br /&gt;
&lt;br /&gt;
:So, basically you agree with the proposal I posted above. I like the overkill idea, though I&#039;m not sure of it&#039;s usefulness and I&#039;m unsure if this would work against the effort to steer higher level players to higher level areas.[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
:: see above on &amp;quot;steering&amp;quot; ... the bonuses are only gonna be a couple of extra exp, nothing drastic. --[[User:zick|zick]] 16:10, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
even lowly maggots can be powerful enemies, if someone with a level 99 enters a map with a lot of other noobs and throws off the curve. enemies level with players and each enemy has different attacks at different levels (as well as strength and defense). enemies dont gain level until respawn. enemies generate exp, gold and have different drop tables based on their level also.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;even lowly maggots can be powerful enemies...&#039;&#039; No, just no...[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
:: okay i think you need to keep in mind that a maggot will only have a base exp of 1 or 2, so no matter how you calculate it your still not getting a lot of exp as compared to a creature with say a base exp of 10 or 100, that&#039;ll be when you&#039;ll start getting major exp.  and i&#039;m guessing there will be a more grinder approach to how much exp you will need to gain to reach the next level, like in games like &amp;quot;maple story&amp;quot; ... --[[User:zick|zick]] 16:11, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::Haha, reminds me of the [http://prblog.typepad.com/photos/uncategorized/killer20rabbit_1.jpg killer rabbit]. Anyway I don&#039;t think it&#039;s a good idea to scale monster toughness depending on the level of the players on the map. Instead I think we should use a rather [http://forums.themanaworld.org/viewtopic.php?p=16372#16372 flat leveling curve] to make sure a good amount of monsters are interesting to fight and if maggots are no longer your taste, it&#039;s simply time to move on. --[[User:BjÃ¸rn|BjÃ¸rn]] 14:21, 25 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6082</id>
		<title>Archive talk:Skill system 2</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6082"/>
		<updated>2007-02-17T20:40:11Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: comments @zick, formatting for comments @Crush&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;Eeiya, I think this is a good proposal, however I offer some minor suggestions. As others have stated, we should NOT just give the EXP/items to the first person to hit it, because that would encourage players attacking every monster on a map. Instead, it should either be time, or distance based, possibly a mixture of both. For instance, move 15 tiles away from the monster and it returns to &amp;quot;everybody mode.&amp;quot; Or, after you have not attacked for a certain amount of time, it will once again return to &amp;quot;everybody mode.&amp;quot; We should NOT have it party based (meaning the ENTIRE party has to move away from the monster). Why? Because then there would be large parties dedicated to attacking monsters, and as long as at least one person in the party is close enough to the monster(s), everybody gets EXP. No, that won&#039;t work at all. Instead, if even ONE person in the party leaves the area, I think the monster should go back to being a free kill. BUT! Let&#039;s say that one player in the party left to go buy an item, but the rest of the party (let&#039;s say 4 people) stayed behind. The instant the player leaves, the monster goes back into free mode. However, since the rest of the party is still around, and still attacking it, the monster only stays in free mode for less than a second. Thus, the balance is maintained. I also think that only those within a certain radius of the monster should get EXP (in other words, if you go AFK and don&#039;t move, you shouldn&#039;t be able to leech off your party which is three maps away.) So yeah, just some minor suggestions, but I approve of it overall.&lt;br /&gt;
:::::::::::::::::::::::::::::[[User:Pauan|Pauan]] 04:03, 1 January 2007 (CET)&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== @Direct Combat Skills - 1 ===&lt;br /&gt;
Why not base the exp gained on the work done directly?&lt;br /&gt;
For fighters this would mean exp is calculated based on the hp loss of the enemy after each of the fighter&#039;s hits. Healers would gain exp which based on the amount of hp gained by the wounded. Combined with the &#039;&#039;challenge rating&#039;&#039;, this could balance out group attacks quite nicely. Healers would be able to heal more if a group is damaged more and so profit from attacking stronger mobs as much as the rest of the team.&lt;br /&gt;
In this way the game server doesn&#039;t need to store a play-by-play of the fight to calculate exp. It could just be stored in a buffer, ready for use when the fight ends (allthough I would not be opposed to levelling during a fight).&lt;br /&gt;
This would work in the following manner:&lt;br /&gt;
* Player attacks with short sword equiped&lt;br /&gt;
* Damage to mob is calculated&lt;br /&gt;
* Exp for that player is calculated based on the damage done&lt;br /&gt;
* Exp is added to Player&#039;s sword-skill-exp-buffer (or something like that)&lt;br /&gt;
* Rinse, repeat&lt;br /&gt;
* Mob dies, exp is added OR Player dies, bye bye exp (if a buffer is used)&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::This concept was in fact my first idea. But there were a lot of problems I found when I thought about it thoroughly.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;1st:&#039;&#039;&#039; When you calculate exp based on enemies hp loss, what happens when the mob is healed? Players could heal mobs intentionally again and again to harvest tons of exp.&lt;br /&gt;
:::&#039;&#039;Actually, I would consider this a good tactic. We just have to calculate the numbers so that a player couldn&#039;t do it by himself after a certain level. Frankly, I would encourage this form of cooperation.&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
::&#039;&#039;&#039;2nd:&#039;&#039;&#039; i) To calculate the exp of healers based on the challenge rating of the mob is also very complicate. ii) What challenge rating should apply when a fighter is attacked by multiple enemies with different challenge ratings? iii) And what is when the combat is over and the healer heals? Which attackers challenge rating does apply then? iv) And what about support spells? How should these be awarded?&lt;br /&gt;
:::&#039;&#039;i,iii) I wouldn&#039;t apply a &#039;&#039;challenge rating&#039;&#039; to healing spells. Just the hp gained should be efficient. If you are the healer in a group of tanks, you won&#039;t get very far if they insist on fighting bunnies.&#039;&#039;&lt;br /&gt;
:::&#039;&#039;ii) If a fighter hits three enemies with one slash of his sword, he&#039;ll recieve exp based on the individual enemies he hits, and their respective &#039;&#039;challenge ratings&#039;&#039;.&#039;&#039;&lt;br /&gt;
:::&#039;&#039;iv) For support spells we&#039;ll find a solution eventually (maybe based on magic defense of the mob).&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;3rd:&#039;&#039;&#039; Exp based on damage done is favoring offensive characters (damage dealers) while defensive characters (tanks) are very unprivileged and receive almost no exp although they are doing a very important job, too. Of course it would be possible to give exp for received damage. But this would encourage people to get hurt as much as possible and not avoiding damage as you would expect them. This would result in very unrealistic behavior.&lt;br /&gt;
:::&#039;&#039;We could base this on natural (sans magic) healing. I&#039;ll just add a quote:&#039;&#039; &#039;&#039;&#039;What doesn&#039;t kill me, makes me stronger&#039;&#039;&#039; &#039;&#039;But at this point I don&#039;t see much difference between &#039;&#039;tanks&#039;&#039; and &#039;&#039;fighters&#039;&#039;. &#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;4th:&#039;&#039;&#039; The reason why I decided to distribute exp evenly between the skills is that it allows the player to train new skills while still doing the most work with the main skill. This doesn&#039;t force the player to use weak skills over and over again while they have much stronger skills. Instead it allows them to still be effective and advance in the game while the training of a new skill is a secondary task.&lt;br /&gt;
:::&#039;&#039;If you&#039;d rather be an archer after 4 weeks of being a warrior, you&#039;d beter do the work like the rest of the n00bs :) On a more serious note, I think it will promote character diversity, and multiple characters per player.&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::I hope you see now why i decided to do things like i did. --[[User:Crush|Crush]] 14:04, 16 February 2007 (CET)&lt;br /&gt;
:::&#039;&#039;Yes and no :)&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @&amp;quot;Forgetting&amp;quot; of unused skills ===&lt;br /&gt;
As a side note, I wouldn&#039;t decrease a random skill, I would much prefer it if a set of incompatible skills are defined. For instance if a player learns a new spell or gains a level in a magic related skill, weapon skills decrease. This would work in the following scenario: lets define that weapon skills and magic skills are incompatible; A player could be training his sword skill, gain a level in that, after which his magic skill decreases. Eventually his magic skill will decrease past the minimum level required to use that healing spell he favors. He would then need to make a decision if he really wants to train magic to regain the healing spell. Only to loose the spell once more after the next increase of his weapon skill. &lt;br /&gt;
&lt;br /&gt;
The (gained exp / lost exp) quotient would have to be calculated to allow only for low level multi-purpose-characters. I would combine this with some exponential exp requirements, which depend on total exp instead of current skill level. This would mean that you could actually ruin a character completely. When the characters exp requirements for a next level of skill are very high and the skill level itself is very low. &lt;br /&gt;
&lt;br /&gt;
In this way a set of compatible skills could also be defined, which will not decrease. An example which comes to mind is smithing and sword fighting.&lt;br /&gt;
&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
:i like the idea of the counterbalancing of lost skills, as magic increases then weapon skills decrease ... i think there should be other ones though to, like if you chose to start using an axe as opposed to a sword, your sword skills decrease as your axe skills increase.&lt;br /&gt;
:[[User:zick|zick]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @New enemy spawning/exp generating proposal ===&lt;br /&gt;
&lt;br /&gt;
i think this proposal would work best with a SoM/Zelda-ish battle engine, as opposed to the one that is currently implemented ...&lt;br /&gt;
&lt;br /&gt;
everytime an enemy is respawned, the server determines its HP by the following equation (subject to change, shown in psuedocode):&lt;br /&gt;
&lt;br /&gt;
((enemyBaseHP +/- randomNumZeroToFive) * randLVL) +/- randNumZeroToEleven)&lt;br /&gt;
&lt;br /&gt;
description of this equation:&lt;br /&gt;
&amp;quot;enemyBaseHP&amp;quot; is a static value (doesn&#039;t change) defined in an enemies config file&lt;br /&gt;
&amp;quot;randLVL&amp;quot; is a dynamic value generated by using the equation (avgLvlOfPlayersOnMap +/- randNumZeroToFive) and is the level of the enemy, which determines how strong the enemy is, its drop tables, how much experience it will give, etc.&lt;br /&gt;
&amp;quot;randomNumZeroToFive&amp;quot; and &amp;quot;randNumZeroToEleven&amp;quot; are values generated from a dice-rolling function (6 &amp;amp; 12-sided respectively)&lt;br /&gt;
the &amp;quot;+/-&amp;quot; operator randomly chooses whether to add or subtract values&lt;br /&gt;
&lt;br /&gt;
in other words, every enemy levels in the same manner as players do, gaining abilities and getting stronger with every level. You may even find level 99 maggots! Also two enemies with the same levels may actually have differing amounts of HP and give out differing amounts of exp.&lt;br /&gt;
: Ok, I like the variation principle, but only within a well defined boundry. I dislike the idea of having monster strength based on average player strength. I think exploration should be promoted and that the starting area&#039;s really shouldn&#039;t have anything of interest for higher level players.[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
also something interesting that i want to add is that this makes it easier to create enemies ... just create a base species and allow it level on it own, no more trying to come up with different names for red slimes and green slimes (what happens when you run out of colors, hmmm!)  ever notice how old school rpgs like ff on snes, would use the same spriteset for all of its imps and just call them imps or imp generals or imp captain, what happens when you run out of ranks.  plus then i think it makes the enemies be more like the creatures of this world you&#039;ve created.  if we were to make a rpg of our planet, and cougars were one of the enemies, we wouldn&#039;t have blue cougars and red cougars, we&#039;d just have cougars ... but not every cougar looks quite the same, so why not allow the enemy spriteset include variations of an enemy (check out the following image: [http://www.bottledtalent.com/images/productspuddlebunnies.gif link bunnies] and check out all the different bunnies some are white some are spotted some are brown, etc.)&lt;br /&gt;
:I believe that, the green/red/white/yellow slimes are just an easy way to get started, the endgoal will most definetly be a diverse world, with different species of mobs. Basically, this stuff is waiting on well defined view of the game world, after which concept artists can get started develloping a whole range of mobs. The system described here just makes it easier to be lazy.[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
while talking about enemies, the EXP system should be mentioned and explained. First off every enemy has a base EXP value, stored in its config file. This value has the following equation applied to it:&lt;br /&gt;
&lt;br /&gt;
((enemyBaseEXP +/- randomNumZeroToFive) * enemyLVL) +/- randNumZeroToEleven)&lt;br /&gt;
&lt;br /&gt;
this value is the total amount of distrubitable EXP that the enemy can give. each player that contributed to the death of said enemy (who is still on the current map when death occurs) is awarded a percentage (rounded to the nearest whole number) of these EXP based on the overall percentage damage that they did. also there are two bonuses that can be applied to the EXP you are awarded. the first is called the &amp;quot;kill bonus&amp;quot; and is granted to the person who actually kills the enemy, this encourages kill stealing (part of the friendly-fire free for all system that i would like explain later). this bonus is equivalent to the &amp;quot;baseEXP&amp;quot; value. the second bonus is an &amp;quot;overkill bonus&amp;quot; and is granted when your final killing hit is more than the remaining HP of the enemy (the system knows how much damage you have to do to kill the enemy and usually won&#039;t overkill by much, unless you kill with a critical hit, a limit break, or a special move) and is generated by dividing the amount of damage over the remaining HP by the baseEXP (and of course rounding to a whole number)&lt;br /&gt;
:So, basically you agree with the proposal I posted above. I like the overkill idea, though I&#039;m not sure of it&#039;s usefullness and I&#039;m unsure if this would work against the effort to stear higher level players to higher level areas.[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
even lowly maggots can be powerful enemies, if someone with a level 99 enters a map with a lot of other noobs and throws off the curve. enemies level with players and each enemy has different attacks at different levels (as well as strength and defense). enemies dont gain level until respawn. enemies generate exp, gold and have different drop tables based on their level also.&lt;br /&gt;
:&#039;&#039;even lowly maggots can be powerful enemies...&#039;&#039; No, just no...[[User:Avaniel|Avaniel]] 21:40, 17 February 2007 (CET)&lt;br /&gt;
[[User:zick|zick]] 12:09, 16 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6067</id>
		<title>Archive talk:Skill system 2</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6067"/>
		<updated>2007-02-16T14:51:47Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;Eeiya, I think this is a good proposal, however I offer some minor suggestions. As others have stated, we should NOT just give the EXP/items to the first person to hit it, because that would encourage players attacking every monster on a map. Instead, it should either be time, or distance based, possibly a mixture of both. For instance, move 15 tiles away from the monster and it returns to &amp;quot;everybody mode.&amp;quot; Or, after you have not attacked for a certain amount of time, it will once again return to &amp;quot;everybody mode.&amp;quot; We should NOT have it party based (meaning the ENTIRE party has to move away from the monster). Why? Because then there would be large parties dedicated to attacking monsters, and as long as at least one person in the party is close enough to the monster(s), everybody gets EXP. No, that won&#039;t work at all. Instead, if even ONE person in the party leaves the area, I think the monster should go back to being a free kill. BUT! Let&#039;s say that one player in the party left to go buy an item, but the rest of the party (let&#039;s say 4 people) stayed behind. The instant the player leaves, the monster goes back into free mode. However, since the rest of the party is still around, and still attacking it, the monster only stays in free mode for less than a second. Thus, the balance is maintained. I also think that only those within a certain radius of the monster should get EXP (in other words, if you go AFK and don&#039;t move, you shouldn&#039;t be able to leech off your party which is three maps away.) So yeah, just some minor suggestions, but I approve of it overall.&lt;br /&gt;
:::::::::::::::::::::::::::::[[User:Pauan|Pauan]] 04:03, 1 January 2007 (CET)&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== @Direct Combat Skills - 1 ===&lt;br /&gt;
Why not base the exp gained on the work done directly?&lt;br /&gt;
For fighters this would mean exp is calculated based on the hp loss of the enemy after each of the fighter&#039;s hits. Healers would gain exp which based on the amount of hp gained by the wounded. Combined with the &#039;&#039;challenge rating&#039;&#039;, this could balance out group attacks quite nicely. Healers would be able to heal more if a group is damaged more and so profit from attacking stronger mobs as much as the rest of the team.&lt;br /&gt;
In this way the game server doesn&#039;t need to store a play-by-play of the fight to calculate exp. It could just be stored in a buffer, ready for use when the fight ends (allthough I would not be opposed to levelling during a fight).&lt;br /&gt;
This would work in the following manner:&lt;br /&gt;
* Player attacks with short sword equiped&lt;br /&gt;
* Damage to mob is calculated&lt;br /&gt;
* Exp for that player is calculated based on the damage done&lt;br /&gt;
* Exp is added to Player&#039;s sword-skill-exp-buffer (or something like that)&lt;br /&gt;
* Rinse, repeat&lt;br /&gt;
* Mob dies, exp is added OR Player dies, bye bye exp (if a buffer is used)&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::This concept was in fact my first idea. But there were a lot of problems I found when I thought about it thoroughly.&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;1st:&#039;&#039;&#039; When you calculate exp based on enemies hp loss, what happens when the mob is healed? Players could heal mobs intentionally again and again to harvest tons of exp.&lt;br /&gt;
:::&#039;&#039;Actually, I would consider this a good tactic. We just have to calculate the numbers so that a player couldn&#039;t do it by himself after a certain level. Frankly, I would encourage this form of cooperation.&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
::&#039;&#039;&#039;2nd:&#039;&#039;&#039; To calculate the exp of healers based on the challenge rating of the mob is also very complicate. What challenge rating should apply when a fighter is attacked by multiple enemies with different challenge ratings? And what is when the combat is over and the healer heals? Which attackers challenge rating does apply then? And what about support spells? How should these be awarded?&lt;br /&gt;
:::&#039;&#039;I wouldn&#039;t apply a &#039;&#039;challenge rating&#039;&#039; to healing spells. Just the hp gained should be efficient. If you are the healer in a group of tanks, you won&#039;t get very far if they insist on fighting bunnies. For support spells we&#039;ll find a solution eventually (maybe based on magic defense of the mob).&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;3rd:&#039;&#039;&#039; Exp based on damage done is favoring offensive characters (damage dealers) while defensive characters (tanks) are very unprivileged and receive almost no exp although they are doing a very important job, too. Of course it would be possible to give exp for received damage. But this would encourage people to get hurt as much as possible and not avoiding damage as you would expect them. This would result in very unrealistic behavior.&lt;br /&gt;
:::&#039;&#039;We could base this on natural (sans magic) healing. I&#039;ll just add a quote:&#039;&#039; &#039;&#039;&#039;What doesn&#039;t kill me, makes me stronger&#039;&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::&#039;&#039;&#039;4th:&#039;&#039;&#039; The reason why I decided to distribute exp evenly between the skills is that it allows the player to train new skills while still doing the most work with the main skill. This doesn&#039;t force the player to use weak skills over and over again while they have much stronger skills. Instead it allows them to still be effective and advance in the game while the training of a new skill is a secondary task.&lt;br /&gt;
:::&#039;&#039;If you&#039;d rather be an archer after 4 weeks of being a warrior, you&#039;d beter do the work like the rest of the n00bs :) On a more serious note, I think it will promote character diversity, and multiple characters per player.&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
::I hope you see now why i decided to do things like i did. --[[User:Crush|Crush]] 14:04, 16 February 2007 (CET)&lt;br /&gt;
:::&#039;&#039;Yes and no :)&#039;&#039; [[User:Avaniel|Avaniel]] 15:51, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @&amp;quot;Forgetting&amp;quot; of unused skills ===&lt;br /&gt;
As a side note, I wouldn&#039;t decrease a random skill, I would much prefer it if a set of incompatible skills are defined. For instance if a player learns a new spell or gaines a level in a magic related skill, weapon skills decrease. This would work in the following scenario: lets define that weapon skills and magic skills are incompatible; A player could be training his sword skill, gain a level in that, after which his magic skill decreases. Eventually his magic skill will decrease past the minimum level required to use that healing spell he favors. He would then need to make a decision if he really wants to train magic to regain the healing spell. Only to loose the spell once more after the next increase of his weapon skill. &lt;br /&gt;
&lt;br /&gt;
The (gained exp / lossed exp) quotient would have to be calculated to allow only for low level multi-purpose-characters. I would combine this with some exponential exp requirements, which depend on total exp instead of current skill level. This would mean that you could actually ruin a character completely. When the characters exp requirements for a next level of skill are very high and the skill level itself is very low. &lt;br /&gt;
&lt;br /&gt;
In this way a set of compatible skills could allso be defined, which will not decrease. An example which comes to mind is smithing and sword fighting.&lt;br /&gt;
&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6063</id>
		<title>Archive talk:Skill system 2</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6063"/>
		<updated>2007-02-16T11:09:27Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Some comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;Eeiya, I think this is a good proposal, however I offer some minor suggestions. As others have stated, we should NOT just give the EXP/items to the first person to hit it, because that would encourage players attacking every monster on a map. Instead, it should either be time, or distance based, possibly a mixture of both. For instance, move 15 tiles away from the monster and it returns to &amp;quot;everybody mode.&amp;quot; Or, after you have not attacked for a certain amount of time, it will once again return to &amp;quot;everybody mode.&amp;quot; We should NOT have it party based (meaning the ENTIRE party has to move away from the monster). Why? Because then there would be large parties dedicated to attacking monsters, and as long as at least one person in the party is close enough to the monster(s), everybody gets EXP. No, that won&#039;t work at all. Instead, if even ONE person in the party leaves the area, I think the monster should go back to being a free kill. BUT! Let&#039;s say that one player in the party left to go buy an item, but the rest of the party (let&#039;s say 4 people) stayed behind. The instant the player leaves, the monster goes back into free mode. However, since the rest of the party is still around, and still attacking it, the monster only stays in free mode for less than a second. Thus, the balance is maintained. I also think that only those within a certain radius of the monster should get EXP (in other words, if you go AFK and don&#039;t move, you shouldn&#039;t be able to leech off your party which is three maps away.) So yeah, just some minor suggestions, but I approve of it overall.&lt;br /&gt;
:::::::::::::::::::::::::::::[[User:Pauan|Pauan]] 04:03, 1 January 2007 (CET)&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== @Direct Combat Skills - 1 ===&lt;br /&gt;
Why not base the exp gained on the work done directly?&lt;br /&gt;
For fighters this would mean exp is calculated based on the hp loss of the enemy after each of the fighter&#039;s hits. Healers would gain exp which based on the amount of hp gained by the wounded. Combined with the &#039;&#039;challenge rating&#039;&#039;, this could balance out group attacks quite nicely. Healers would be able to heal more if a group is damaged more and so profit from attacking stronger mobs as much as the rest of the team.&lt;br /&gt;
In this way the game server doesn&#039;t need to store a play-by-play of the fight to calculate exp. It could just be stored in a buffer, ready for use when the fight ends (allthough I would not be opposed to levelling during a fight).&lt;br /&gt;
This would work in the following manner:&lt;br /&gt;
* Player attacks with short sword equiped&lt;br /&gt;
* Damage to mob is calculated&lt;br /&gt;
* Exp for that player is calculated based on the damage done&lt;br /&gt;
* Exp is added to Player&#039;s sword-skill-exp-buffer (or something like that)&lt;br /&gt;
* Rinse, repeat&lt;br /&gt;
* Mob dies, exp is added OR Player dies, bye bye exp (if a buffer is used)&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;br /&gt;
&lt;br /&gt;
=== @&amp;quot;Forgetting&amp;quot; of unused skills ===&lt;br /&gt;
As a side note, I wouldn&#039;t decrease a random skill, I would much prefer it if a set of incompatible skills are defined. For instance if a player learns a new spell or gaines a level in a magic related skill, weapon skills decrease. This would work in the following scenario: lets define that weapon skills and magic skills are incompatible; A player could be training his sword skill, gain a level in that, after which his magic skill decreases. Eventually his magic skill will decrease past the minimum level required to use that healing spell he favors. He would then need to make a decision if he really wants to train magic to regain the healing spell. Only to loose the spell once more after the next increase of his weapon skill. &lt;br /&gt;
&lt;br /&gt;
The (gained exp / lossed exp) quotient would have to be calculated to allow only for low level multi-purpose-characters. I would combine this with some exponential exp requirements, which depend on total exp instead of current skill level. This would mean that you could actually ruin a character completely. When the characters exp requirements for a next level of skill are very high and the skill level itself is very low. &lt;br /&gt;
&lt;br /&gt;
In this way a set of compatible skills could allso be defined, which will not decrease. An example which comes to mind is smithing and sword fighting.&lt;br /&gt;
&lt;br /&gt;
[[User:Avaniel|Avaniel]] 12:09, 16 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6062</id>
		<title>Archive talk:Skill system 2</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Archive_talk:Skill_system_2&amp;diff=6062"/>
		<updated>2007-02-16T11:07:21Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p&amp;gt;Eeiya, I think this is a good proposal, however I offer some minor suggestions. As others have stated, we should NOT just give the EXP/items to the first person to hit it, because that would encourage players attacking every monster on a map. Instead, it should either be time, or distance based, possibly a mixture of both. For instance, move 15 tiles away from the monster and it returns to &amp;quot;everybody mode.&amp;quot; Or, after you have not attacked for a certain amount of time, it will once again return to &amp;quot;everybody mode.&amp;quot; We should NOT have it party based (meaning the ENTIRE party has to move away from the monster). Why? Because then there would be large parties dedicated to attacking monsters, and as long as at least one person in the party is close enough to the monster(s), everybody gets EXP. No, that won&#039;t work at all. Instead, if even ONE person in the party leaves the area, I think the monster should go back to being a free kill. BUT! Let&#039;s say that one player in the party left to go buy an item, but the rest of the party (let&#039;s say 4 people) stayed behind. The instant the player leaves, the monster goes back into free mode. However, since the rest of the party is still around, and still attacking it, the monster only stays in free mode for less than a second. Thus, the balance is maintained. I also think that only those within a certain radius of the monster should get EXP (in other words, if you go AFK and don&#039;t move, you shouldn&#039;t be able to leech off your party which is three maps away.) So yeah, just some minor suggestions, but I approve of it overall.&lt;br /&gt;
:::::::::::::::::::::::::::::[[User:Pauan|Pauan]] 04:03, 1 January 2007 (CET)&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== @Direct Combat Skills - 1 ===&lt;br /&gt;
Why not base the exp gained on the work done directly?&lt;br /&gt;
For fighters this would mean exp is calculated based on the hp loss of the enemy after each of the fighter&#039;s hits. Healers would gain exp which based on the amount of hp gained by the wounded. Combined with the &#039;&#039;challenge rating&#039;&#039;, this could balance out group attacks quite nicely. Healers would be able to heal more if a group is damaged more and so profit from attacking stronger mobs as much as the rest of the team.&lt;br /&gt;
In this way the game server doesn&#039;t need to store a play-by-play of the fight to calculate exp. It could just be stored in a buffer, ready for use when the fight ends (allthough I would not be opposed to levelling during a fight).&lt;br /&gt;
This would work in the following manner:&lt;br /&gt;
* Player attacks with short sword equiped&lt;br /&gt;
* Damage to mob is calculated&lt;br /&gt;
* Exp for that player is calculated based on the damage done&lt;br /&gt;
* Exp is added to Player&#039;s sword-skill-exp-buffer (or something like that)&lt;br /&gt;
* Rinse, repeat&lt;br /&gt;
* Mob dies, exp is added OR Player dies, bye bye exp (if a buffer is used)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== @&amp;quot;Forgetting&amp;quot; of unused skills ===&lt;br /&gt;
As a side note, I wouldn&#039;t decrease a random skill, I would much prefer it if a set of incompatible skills are defined. For instance if a player learns a new spell or gaines a level in a magic related skill, weapon skills decrease. This would work in the following scenario: lets define that weapon skills and magic skills are incompatible; A player could be training his sword skill, gain a level in that, after which his magic skill decreases. Eventually his magic skill will decrease past the minimum level required to use that healing spell he favors. He would then need to make a decision if he really wants to train magic to regain the healing spell. Only to loose the spell once more after the next increase of his weapon skill. &lt;br /&gt;
&lt;br /&gt;
The (gained exp / lossed exp) quotient would have to be calculated to allow only for low level multi-purpose-characters. I would combine this with some exponential exp requirements, which depend on total exp instead of current skill level. This would mean that you could actually ruin a character completely. When the characters exp requirements for a next level of skill are very high and the skill level itself is very low. &lt;br /&gt;
&lt;br /&gt;
In this way a set of compatible skills could allso be defined, which will not decrease. An example which comes to mind is smithing and sword fighting.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=User:Avaniel&amp;diff=6053</id>
		<title>User:Avaniel</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=User:Avaniel&amp;diff=6053"/>
		<updated>2007-02-13T00:18:44Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Real name: Rogier Polak&lt;br /&gt;
&lt;br /&gt;
Avaniel on IRC, the forum and (offcoarse) this wiki.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=User:Avaniel&amp;diff=6052</id>
		<title>User:Avaniel</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=User:Avaniel&amp;diff=6052"/>
		<updated>2007-02-13T00:18:29Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: nothing much ...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Real name: Rogier Polak&lt;br /&gt;
Avaniel on IRC, the forum and (offcoarse) this wiki.&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=User_talk:Avaniel&amp;diff=6051</id>
		<title>User talk:Avaniel</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=User_talk:Avaniel&amp;diff=6051"/>
		<updated>2007-02-13T00:13:57Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Some minor clarification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I have been working / thinking on how an inventory system might be implemented in the new server. While doing this, I came across some problems with naming conventions. To resolve these issues I would like to propose the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renaming stats to attributes ===&lt;br /&gt;
&lt;br /&gt;
The current use of these in the code are:&lt;br /&gt;
* Rawstats, defined during character creation and increased after level up. The rawstats are; strength, agility, vitality, intelligence, dexterity and luck.&lt;br /&gt;
* Statistics or calculated stats. These are calclated from the rawstats. The statistics are; heat, attack, defence,     magic, accuracy and speed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;My problem with the current use of stats or statistics&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First of lets start with the word itself, [http://www.thefreedictionary.com/statistics The Free Dictionary] defines statistics as:&lt;br /&gt;
#  (used with a sing. verb) The mathematics of the collection, organization, and interpretation of numerical data, especially the analysis of population characteristics by inference from sampling.&lt;br /&gt;
# (used with a pl. verb) Numerical data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So basically statistics would mean &#039;&#039;numerical data&#039;&#039;, I expect there will be a lot of that in the code base, as it nears completion. Especially &#039;&#039;statistics&#039;&#039; spring to mind, as in number_of_attacks, monsters_killed or beers_drunken to name a few. My point being: it is not precise enough.&lt;br /&gt;
&lt;br /&gt;
Secondly, my work on equipment and attribute modifying items, has let me to conclude that four lists of attributes are needed to describe the characteristics of a single being:  &lt;br /&gt;
* Base attributes - the character without equipment or items.&lt;br /&gt;
* Base modifiers - additions to or subtractions from the base, both time based and permanent (for example &#039;&#039;Gloin&#039;s Axe Of Glory And Increased Strength&#039;&#039; or &#039;&#039;Wicked Potion Of Double Intelligence For Two Minutes&#039;&#039;).&lt;br /&gt;
* Derived attribute modifiers - the bonuses or maluses to the derived (calculated) attributes of the character. Originating from equipment and items (for example; simple weaponry, which increases attack; or quid-pro-quo items like an &#039;&#039;Amulet Of The Barbarian&#039;&#039; increasing attack and speed at the cost of defence an accuracy).&lt;br /&gt;
* Compound attributes - a list of all base and derived attributes after the modifiers have been applied.&lt;br /&gt;
&lt;br /&gt;
And, quite frankly, I ran out of adjectives which could be used with statistics in a meaningfull way.&lt;br /&gt;
&lt;br /&gt;
For additional information on naming conventions in RPG games I would like to direct you to [http://en.wikipedia.org/wiki/Attribute_(role-playing_games) A comprehensive Wikipedia page on the subject].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renaming Player to Character on the account server ===&lt;br /&gt;
&lt;br /&gt;
In my view &#039;&#039;Player&#039;&#039; should allways be the interpretation or representation of the physical human who&#039;s playing the game. &lt;br /&gt;
On the account server that would be the person owning an account, which has several characters. On the game-server that would be the playable character.&lt;br /&gt;
The main reason for my renaming proposal is the current PlayerData class. The game server&#039;s Player class inherits from both Being and PlayerData, these classes do not fit together. The base attributes of a being, for example, are reimplemented in the PlayerData class to be available to the account server. The implementation of inventory is simplistic, as it should be on the account server, which would cause multiple calls to ItemManager for every action of a Player on the game server. Concluding, the Player class needs specialisation which PlayerData can not provide. &lt;br /&gt;
&lt;br /&gt;
I would therefore propose moving PlayerData to the account-server directory and renaming it to CharacterData, after which it can be modified to fit the specific needs of the account server. The Player class, or it&#039;s members, can then be modified to fit better and perform faster on the game server. I would propose (based on BjÃ¸rn&#039;s suggestion) renaming the Player class to Character for the sake of consistency.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
I would welcome your thought and comments on both subjects. As a side note, I&#039;ve completed the account server side of the Player to Character renaming in my working copy allready. [[User:Avaniel|Avaniel]] 19:06, 12 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=User_talk:Avaniel&amp;diff=6048</id>
		<title>User talk:Avaniel</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=User_talk:Avaniel&amp;diff=6048"/>
		<updated>2007-02-12T18:06:15Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Proposal for renaming stats-&amp;gt;attributes and (on the account server) player-&amp;gt;character&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I have been working / thinking on how an inventory system might be implemented in the new server. While doing this, I came across some problems with naming conventions. To resolve these issues I would like to propose the following:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renaming stats to attributes ===&lt;br /&gt;
&lt;br /&gt;
The current use of these in the code are:&lt;br /&gt;
* Rawstats, defined during character creation and increased after level up. The rawstats are; strength, agility, vitality, intelligence, dexterity and luck.&lt;br /&gt;
* Statistics or calculated stats. These are calclated from the rawstats. The statistics are; heat, attack, defence,     magic, accuracy and speed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;My problem with the current use of stats or statistics&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
First of lets start with the word itself, [http://www.thefreedictionary.com/statistics The Free Dictionary] defines statistics as:&lt;br /&gt;
#  (used with a sing. verb) The mathematics of the collection, organization, and interpretation of numerical data, especially the analysis of population characteristics by inference from sampling.&lt;br /&gt;
# (used with a pl. verb) Numerical data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So basically statistics would mean &#039;&#039;numerical data&#039;&#039;, I expect there will be a lot of that in the code base, as it nears completion. Especially &#039;&#039;statistics&#039;&#039; spring to mind, as in number_of_attacks, monsters_killed or beers_drunken to name a few. My point being: it is not precise enough.&lt;br /&gt;
&lt;br /&gt;
Secondly, my work on equipment and attribute modifying items, has let me to conclude that four lists of attributes are needed to describe the characteristics of a single being:  &lt;br /&gt;
* Base attributes - the character without equipment or items.&lt;br /&gt;
* Base modifiers - additions to or subtractions from the base, both time based and permanent (for example &#039;&#039;Gloin&#039;s Axe Of Glory And Increased Strength&#039;&#039; or &#039;&#039;Wicked Potion Of Double Intelligence For Two Minutes&#039;&#039;).&lt;br /&gt;
* Derived attribute modifiers - the bonuses or maluses to the derived (calculated) attributes of the character. Originating from equipment and items (for example; simple weaponry, which increases attack; or quid-pro-quo items like an &#039;&#039;Amulet Of The Barbarian&#039;&#039; increasing attack and speed at the cost of defence an accuracy).&lt;br /&gt;
* Compound attributes - a list of all base and derived attributes after the modifiers have been applied.&lt;br /&gt;
&lt;br /&gt;
And, quite frankly, I ran out of adjectives which could be used with statistics in a meaningfull way.&lt;br /&gt;
&lt;br /&gt;
For additional information on naming conventions in RPG games I would like to direct you to [http://en.wikipedia.org/wiki/Attribute_(role-playing_games) A comprehensive Wikipedia page on the subject].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Renaming Player to Character on the account server ===&lt;br /&gt;
&lt;br /&gt;
In my view &#039;&#039;Player&#039;&#039; should allways be the interpretation or representation of the physical human who&#039;s playing the game. &lt;br /&gt;
On the account server that would be the person owning an account, which has several characters. On the game-server that would be the playable character.&lt;br /&gt;
The main reason for my renaming proposal is the current PlayerData class. The game server&#039;s Player class inherits from both Being and PlayerData, these classes do not fit together. The base attributes of a being, for example, are reimplemented in the PlayerData class to be available to the account server. The implementation of inventory is simplistic, as it should be on the account server, which would cause multiple calls to ItemManager for every action of a Player on the game server. Concluding, the Player class needs specialisation which PlayerData can not provide. I would therefore propose copying PlayerData to the account server and renaming it to CharacterData, after which it can be modified to fit the specific needs of the account server. The Player class, or it&#039;s members, can then be modified to fit better and perform faster on the game server.&lt;br /&gt;
&lt;br /&gt;
I would welcome your thought and comments on both subjects. As a side note, I&#039;ve completed the account server side of the Player to Character renaming in my working copy allready. [[User:Avaniel|Avaniel]] 19:06, 12 February 2007 (CET)&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=Servers&amp;diff=5886</id>
		<title>Servers</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=Servers&amp;diff=5886"/>
		<updated>2007-01-19T18:58:50Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: Changed server address to server.themanaworld.org&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Please add tmw servers here. To play on them you have to open the config.xml file in your The Mana World Directory and search for the line&lt;br /&gt;
&lt;br /&gt;
 &amp;amp;lt;option name=&amp;quot;host&amp;quot; value=&amp;quot;animesites.de&amp;quot;/&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
Replace animesites.de with the hostname of the server you want to play on. Save the file, start TMW and it should connect you to the server. Note that every server uses its own Database. So you have to register a new account on every server. For security reasons you should not use the same username+password combination on two different servers.&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Uhm, I think it&#039;s much easier just to type the server into the server textfield of the login dialog.&#039;&#039; --[[User:BjÃ¸rn|BjÃ¸rn]] 15:09, 27 February 2006 (CET)&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;Yes, it would be, when it wouldn&#039;t be totally buggy&#039;&#039; --[[User:Crush|Crush]] 23:03, 3 March 2006 (CET)&lt;br /&gt;
&lt;br /&gt;
== Official Server ==&lt;br /&gt;
&lt;br /&gt;
*Hostname: server.themanaworld.org&lt;br /&gt;
*Homepage: http://themanaworld.org&lt;br /&gt;
*Admin Contact: platyna at platinum.linux.pl&lt;br /&gt;
&lt;br /&gt;
The official public test server of the Mana World project.&lt;br /&gt;
&lt;br /&gt;
== Matts Test Server ==&lt;br /&gt;
&lt;br /&gt;
*Hostname: hackgrid.ath.cx&lt;br /&gt;
*Homepage: &lt;br /&gt;
*Admin Contact:&lt;br /&gt;
&lt;br /&gt;
The testserver of Matt, isn&#039;t always running.&lt;br /&gt;
&lt;br /&gt;
== Bears Server ==&lt;br /&gt;
&lt;br /&gt;
*Hostname: bear8.no-ip.org&lt;br /&gt;
*Homepage:&lt;br /&gt;
*Admin Contact:&lt;br /&gt;
&lt;br /&gt;
== Platyna&#039;s Test Server ==&lt;br /&gt;
*Hostname: platinum.linux.pl&lt;br /&gt;
*Homepage:&lt;br /&gt;
*Admin Contact: platyna at platinum.linux.pl&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
	<entry>
		<id>https://oldwiki.devbox.themanaworld.org/index.php?title=FAQ&amp;diff=5885</id>
		<title>FAQ</title>
		<link rel="alternate" type="text/html" href="https://oldwiki.devbox.themanaworld.org/index.php?title=FAQ&amp;diff=5885"/>
		<updated>2007-01-19T18:52:24Z</updated>

		<summary type="html">&lt;p&gt;Avaniel: /* When I try to login using the account that usually works, I get following message: Unable to connect to Login Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This is the FAQ for The Mana World. If you have a question, search for it in the Table of Contents. If you cannot find it, please post it on the forums, previously having searched for similar threads.&lt;br /&gt;
&lt;br /&gt;
== Support questions ==&lt;br /&gt;
=== Does TMW have an IRC channel? ===&lt;br /&gt;
Yes it does.&lt;br /&gt;
* &#039;&#039;&#039;Server&#039;&#039;&#039;: &#039;&#039;irc.freenode.net&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Channel&#039;&#039;&#039;: &#039;&#039;#themanaworld&#039;&#039;&lt;br /&gt;
For a direct link: [irc://irc.freenode.net:6667/themanaworld]&lt;br /&gt;
&lt;br /&gt;
=== Is my platform supported? ===&lt;br /&gt;
Look in [[Ports]].&lt;br /&gt;
&lt;br /&gt;
=== Where can I look for help? ===&lt;br /&gt;
The IRC channel is a good start for solving small problems or doubts. Is usually habited by sane people, ignore everything m[a]tt says. As most people are from Europe (GMT or GMT+1 timezones) you will have more success if you try to contact at a reasonable hour in the day.&lt;br /&gt;
&lt;br /&gt;
For more complex problems (compilations problems, crashes...) is advisable to use the forums as it is a non-volatile way of storing your claims. If you do in IRC some people won&#039;t have the oportunity to read them and your oportunity of getting further help will be narrowed. At the same time posting long logs or reports on IRC is not polite.&lt;br /&gt;
&lt;br /&gt;
=== When is this game updated? ===&lt;br /&gt;
This has several aswers. The general politics in the dev team is &amp;quot;When it&#039;s doneâ„¢&amp;quot;. Expect new version to be released in a span of one to two months since the previous release.&lt;br /&gt;
&lt;br /&gt;
Nevertheless, you can use SVN to fetch latest code from sourceforge&#039;s repository. That code usually has all of the bleeding-edge additions but it could also be broken and don&#039;t even compile. Althought usually it does work, is a fair warning to be done. Anyways, it doesn&#039;t imply any risk of breaking your system in any way or form.&lt;br /&gt;
&lt;br /&gt;
A third update way are the automated updates. As the name says, the user doesn&#039;t have to do anything, just start the game and in the log-in screen the updates will be fetch. As a general rule it is advisable to fetch them but if you don&#039;t want to or you feel that such updates are conflicting with the (more up-to-date) data taken from SVN (like display of old maps or graphics when you&#039;re sure the ones in SVN has been already updated), you can parse the &#039;-u&#039; switch to the tmw executable. This will avoid any automatic update.&lt;br /&gt;
&lt;br /&gt;
=== I want to help, how do I join the team? ===&lt;br /&gt;
First, if you are a developer read this: [[Joining the project]].&lt;br /&gt;
&lt;br /&gt;
If you&#039;re a graphic artist is suggested you read the [[Guidelines]] and take a look at the &#039;&#039;&#039;Graphics&#039;&#039;&#039; section on the front page.&lt;br /&gt;
&lt;br /&gt;
If you want to help coding some scripts or managing server content, read [http://forums.themanaworld.org/viewforum.php?f=9 this].&lt;br /&gt;
&lt;br /&gt;
If you just want to suggest something, use the &#039;&#039;&#039;Suggestions/Feedback&#039;&#039;&#039; subforum.&lt;br /&gt;
&lt;br /&gt;
=== I don&#039;t want to be rude but... I&#039;m fed up with maggots!!! ===&lt;br /&gt;
One thing you&#039;ll notice if you invest hours every day into the game, is that you&#039;ll eventually run out of things to do. While we&#039;re constantly adding to the game with maps, quests, NPCs... we really can&#039;t keep up with demand.&lt;br /&gt;
&lt;br /&gt;
If you&#039;d like to help this though, just join the project! It&#039;s as simple as that; you play the games, not us, so we don&#039;t know what you&#039;d like to see and your opinion matters to us.&lt;br /&gt;
&lt;br /&gt;
== Game-related questions ==&lt;br /&gt;
=== I&#039;m a bit lost... How do I start? ===&lt;br /&gt;
There is an article specifically about this: [[Getting started]].&lt;br /&gt;
&lt;br /&gt;
=== What are the keyboard shortcuts in The Mana World? ===&lt;br /&gt;
See the README file that came with your install for the list or press F1 while in game to see the help. The keys are currently non-configurable.&lt;br /&gt;
&lt;br /&gt;
=== How do skills work? ===&lt;br /&gt;
* Strength: Makes you hit harder with melee weapons.&lt;br /&gt;
* Agility: Makes your enemies hit you less often and increases your attack speed.&lt;br /&gt;
* Vitality: Increases your maximum HP and your HP recovery rate. Decreases the amount of damage you receive from hits.&lt;br /&gt;
* Intelligence: Increases your maximum MP and your MP recovery rate. this stat isn&#039;t that important yet because there isn&#039;t a way to spend your MP yet.&lt;br /&gt;
* Dexterity: Makes you hit harder with bows. Makes you miss your enemies less often with both melee and bow weapons.&lt;br /&gt;
* Luck: Makes you do critical hits from time to time.&lt;br /&gt;
For further reading see [[Stats]].&lt;br /&gt;
&lt;br /&gt;
=== What are MP for? ===&lt;br /&gt;
MP stands for &amp;quot;Magic Points&amp;quot;, thus are points used in magic spells. Currently they can&#039;t be used in the game, this is because we will be moving to our own server with its own protocol and coding stuff for our current server (eAthena) would be a waste of time.&lt;br /&gt;
&lt;br /&gt;
== Common problems ==&lt;br /&gt;
=== When I try to login using the account that usually works, I get following message: Unable to connect to Login Server ===&lt;br /&gt;
This means that the game server is not online at the moment you try to login. Try again later.&lt;br /&gt;
&lt;br /&gt;
If you really want to make sure, look for &amp;quot;host&amp;quot; to be equal some host (&#039;&#039;host=server.themanaworld.org&#039;&#039;) and &amp;quot;port&amp;quot; to be filled (&#039;&#039;port=6901&#039;&#039;) in config.xml. If that is the case and you still are not convinced it really is down, run &amp;quot;ping -c1 &amp;lt;host&amp;gt;&amp;quot; to check if the server&#039;s machine is up at or run &amp;quot;telnet &amp;lt;host&amp;gt; &amp;lt;port&amp;gt;&amp;quot; to also check if the server software is listening on the port you specified. Telnet should timeout after a while if it cannot connect to the specific port on the host. or (for the official server) just use the server link on the home page ;)&lt;br /&gt;
&lt;br /&gt;
=== When installing under Debian GNU/Linux, I get the following libguichan error, and I can&#039;t find libguichan in the repositories. What can I do? ===&lt;br /&gt;
&lt;br /&gt;
 Package libguichan is not available, but is referred to &lt;br /&gt;
  by another package&lt;br /&gt;
 This may mean that the package is missing, has been obsoleted, &lt;br /&gt;
  or is only available from another source&lt;br /&gt;
 Package libguichan has no installation candidate&lt;br /&gt;
&lt;br /&gt;
Download the Debian package [http://guichan.sourceforge.net/downloads.shtml here].&lt;/div&gt;</summary>
		<author><name>Avaniel</name></author>
	</entry>
</feed>