Sign in to follow this  

Moving Platforms


Description

Basics of creating moving platforms

Basic platform animations

So, you are building a platform game and you want to spice things up a trifle? Or maybe you just want an elevator for your custom map? You just hit the right tutorial then!

WoWScrnShot_011416_173741.thumb.jpg.059a

A. Requirements

  • DBCUtil ( or any DBC<->CSV tool) (I think MyDBCEditor sucks here because it uses hexa for some columns which tends to complicate things a lot)
  • Ladik's MPQ Editor
  • A TrinityCore server
  • A kebab skewer

B. Table of Contents

  1. Creating the GameObject
  2. Getting TransportAnimation.dbc
  3. Editing TransportAnimation.dbc.csv
  4. BPAG release

C. Tutorial

1.Creating the GameObject

Open your favorite SQL Editor and head to the gameobject_template table.

Once you get there create an entry for your custom gameobject, set the type as 11 (GAMEOBJECT_TYPE_TRANSPORT)and use whatever displayID you want to use.  SET THE FLAGS TO 40 (without that, your character will not move with the platform)

Note down its Guid.

N.B.I Modifying the size will NOT have any effect as animated gameobjects always have their standard size in-game ( that is to say 1 ).

2.Getting TransportAnimation.dbc

If you built TrinityCore in the "C:\Build" directory for instance, you should find the dbc files in "C:\Build\bin\Release\dbc". Copy TransportAnimation.dbc and paste it where you are going to use DBCUtil.

3.Editing TransportAnimation.dbc.csv

After you have converted TransportAnimation.dbc to csv (simple drag and drop on DBCUtil will do), let us open it with your favorite text / csv editor. The columns of the TransportAnimation are 

1 	ID 			Integer 	
2 	TransportID 		Integer		
3 	TimeIndex 		Integer
4 	PosX 		Float 	
5 	PosY 		Float 	
6 	PosZ 		Float 	
7 	iRefID_SequenceID 	Integer 	

(from http://pxr.dk/wowdev/wiki/).

Foremost, once the server notified your client that it is encountering a transport gameobject(GAMEOBJECT_TYPE_TRANSPORT), your client plays the transport animation which he reads from TransportAnimation.dbc. He will find the animation in the dbc using the Guid of the gameobject (TransportID). The animation is then sequenced through time using the TimeIndex which is expressed in milliseconds.

The 4th, 5th and 6th columns express the relative displacement of the gameobject along the Y, X and Z axis respectively (careful here, the wiki states that it rather is X, Y, Z but it's actually not the case).

Eventually, the last column is the animation played by the gameobject. It is NOT compulsory but when the model you are using as moving platform has animations, why not take advantage of it?

Here an example :

179710, 301034, 0, 0, 0, 0, 148,
179711, 301034, 0, 0, 0, 0, 148,
179712, 301034, 3000, -29.1, -1.6, 0, 148,
179713, 301034, 3000, -29.1, -1.6, 0, 149,
179714, 301034, 3030, -29.1, -1.6, 0, 146,
179715, 301034, 6030, 0, 0, 0, 146,

Once you have done all this, convert the csv file back to dbc and put it in the dbc folder of TrinityCore AS WELL AS in your custom patch using the MPQ Editor.

4.BPAG release

As you create animations, you will soon find out writing these rows is a tedious work. I have therefore written a tiny console tool which will write them for you (christened BPAG, an acronym for Basic Platform Animation Generator (the name is pretty cool but this piece of software is total bullshit )). You can download it here.

You will need to feed the BPAG with several details, let me explain them to you.

First ID : the ID (first column) of the last row of the TransportAnimation.dbc file PLUS one.

gobGUID  : the Guid of the gameobject you are using

Start position  : Coordinates of the starting point of your platform, X, Y, Z in order (E.G. 123 451 154)

End Position : Coordinates of the return point of your platform, X, Y, Z in order (E.G. 123 451 154)

Travel Time (ms) : The time that the platform will take to travel from the the starting point to the return point (in milliseconds).

Pause Time (ms) : If you want your platform to stop at the starting position and at the return position (useful for elevators) (in milliseconds)

Is it a two-speed platform ? (y/n) : Answer by y/Y (yes) or n/N (no). Two-speed platforms will speed up after some time interval.

Speed ratio (if it is a two-speed platform) : If you want the platform to go 5 times faster after the previously mentioned time interval, input 5.

Speed change time (ms) (if it is a two-speed platform) : Is the previously mentioned time interval in milliseconds

Once you have provided the BPAG with all this, you will find the generated animation in output.txt (same directory as the .exe). You only have to paste that at the end of TransportAnimation.dbc.csv then convert it back to dbc.



Recommended Comments

Nice tutorial, did you plane to update it and explain how to rotate ? :D

Edited by Rangorn

Share this comment


Link to comment
Share on other sites

Thank you! :) Yes I surely will update both the tool and the tutorial at some point :D

(E.G. it would be great if the tool could load the last ID from the dbc and append the animation directly to it )

Edited by Roarl

Share this comment


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now