Hello, I think I'ts time to lay down the real deal when it comes to the map scripts. I've struggled big time trying to learn what each line of code the level editor means. This post is mainly made for programmers(even novice programmers like me).

With this knowledge you're about to learn you can fuse already existing maps, how to rotate maps and move maps, i.e do some repetitive work which lazy people ain't got the time to do.

This is an example of a scipt that describes a stone block.

custom,cuboid,stone1,6,0.45,6,0,1,1,1,1.0,1.0,37.8442,29.22861,-610.459999999999,-0.0001045807,0.9989038,-0.04675767,-0.002234204;Each line of code ends with a ';', and each code segment is seperated by a ','. From here it's pretty easy to understand which segment denotes what information. You can clearly see where the coordinates are and what textures to use. Each line does also contain information about the tiling and color shading but I haven't really bothered finding that out.

The coordinates are arranged in a x,y,z fashion. HOWEVER! NOTE THAT THE Y AND Z AXIS HAVE BEEN SWAPPED IN LEVEL EDITOR! Most of us are usually referencing Z as the coordinate for height, but in level editor it's the Y-value which denotes height.

--------------------------------------------------------------------------------------------------------

---------------------------------Warning here there be maths---------------------------------------

--------------------------------------------------------------------------------------------------------

When trying to understand the Map scripts the most difficult thing to understand is the last four digits. It should be clear for anyone who is trying to tamper with these values, will have varying results in the rotation of an object. The Last four digits is a quartarnion.

In short a quartarnion is a four dimensional number(hence four values) which encodes information about a rotation around a certain vector. The quartarion takes the following form of:

Q = x

*i* + y

*j* + z

*k* + w

where the variables

*i,j,k* has the following relationship

*i^2 = j^2=k^2=ijk=-1*the last four digits in a line of a map script represent variables (x,y,z,w).

w = cos(θ/2)

x,y and z are coordinates in a unitvector V multiplied with a factor of sin(θ/2).

x = V

xsin(θ/2)

y = V

ysin(θ/2)

z = V

zsin(θ/2)

The "w" component essentially tells us how many degrees around our unitvector we're gonna rotate and the rest is information about the direction of the unitvector.

How we actually use a quartarion isn't really what we're interested in, the level editor is going to preform that algorithm. What we're going to do is decide how many degrees of rotation around which unitvector. If we wanted to do a 90 degree rotation around the unitvector

V' =[x,y,z] = [0,1,0]

we just construct the quartarion by simply

w = cos(90/2) = sqrt(1/2)

x = V'

x*sin(90/2) = 0 * sqrt(1/2) = 0

y = V'

y*sin(90/2) = 1 * sqrt(1/2) = sqrt(1/2)

z = V'

z*sin(90/2) = 0* sqrt(1/2) = 0

Q = x

*i* + y

*j* + z

*k* + w = 0 + sqrt(1/2)

j + 0 +sqrt(1/2)

then eventually parse the numbers and feed it into RC mod remove the

i,j,k components and just go for the raw values. in this example the last four digits would be

... 0,0.707,0,0.707;

-------------------------------------------------------------------------------------------------------

------------------------------------------For Programmers------------------------------------------

-------------------------------------------------------------------------------------------------------

The advantages with knowing the rotation and the location every single object in a aottg map, is that you can very simply manipulate it. Once you've managed to figure out to rotate one object, it's not hard to then expand and rotate several objects at once.

who ever has come this far into the post get an internet cookie, GJ!

The next step is trying to build a method that can take an already existing quartarnion rotation and then apply another rotation. Very similar to Matrix multiplication we say that we multiply two Quartarnions. If you have two Quartarnions q and r in the form of

q = q

0 + q

1*i* + q

2*j* + q

3*k* r = r

0 + r

1*i* + r

2*j* + r

3*k*The product of two Quartarnions is

t = q x r = t

0 + t

1*i* + t

2*j* + t

3*k* t

0 = r

0q

0 - r

1q

1 - r

2q

2 - r

3q

3 t

1 = r

0q

1 + r

1q

0 - r

2q

3 + r

3q

2 t

2 = r

0q

2 + r

1q

3 + r

2q

0 - r

3q

1 t

3 = r

0q

3 - r

1q

2 + r

2q

1 + r

3q

0(for better resolution)

https://se.mathworks.com/help/aeroblks/quaternionmultiplication.htmlNote that the order matters!

If you were to combine this knowledge with linear transformations on the coordinate vector, you could easily create a program that can rotate any map. I'm not gonna link my code, the best way to learn this is to try it youself.

If you've made it this far into the post then congratulations! You're awesome!