Trying to figure out (and fix) the tram

So it’s always irked me that both Deeprun Tram trains don’t work at the same time. When you enter through Stormwind only the far train works and when you enter through Ironforge only the front triain works.

I’ve tried all kinds of things from forcing grids to load to not letting the map unload and nothing seems to work. Part of the problem is the train itself is not a spawned object. There’s a single entry for it in gameobject_template but there’s nothing in gameobject.

One thing I did notice is if you set two tele points: tram_sw and tram_if, you can see a train loaded in each end if you pop back and forth but it doesn’t seem like two distinct trains…

If you stand at IF until the front train shows up and then “.tele tram_sw”, you will see a train pop into view in the back of the station. When it leaves if you stand there long enough, the back train will show up but the one in the front never arrives, even though it was on the IF side before you teleported.

Conversely, if you start in the SW side and “.tele tram_if” the same thing happens except the front train comes and goes but the back one never shows up.

What really should happen is when the map loads one train should be on the IF side and the other on the SW side. They should both travel back and forth at the same time / speed so they’re never at the same side at the same time. This map should stay loaded at all times to ensure constant and timely arrival of each train.

So my questions:

[ol][li]How is this thing spawned?[/li]
[li]It’s a GAMEOBJECT_TYPE_MAP_OBJECT but this isn’t used anywhere in the core?[/li]
[li]Is it a single object that’s moved from track to track depending on where you are?[/li]
[li]How is this object told to move?[/li]
[li]Can we duplicate it instead of magically bumping it to the other track?[/li]
[li]Why does this irk me? (I don’t know, pet peeve I guess)[/li]

1 - It is spawned by the core just like any other Taxi

2 - I don’t understand this question.

3 - No. There are two taxi nodes, one for each tram. The core spawns a copy of that GO for each node.

4 - Waypoints in TaxiPath or TaxiPathNode just like any other taxi / transport. (see if you don’t use this shit you lose it).

5 - See answer 3

If I remember correctly, MaNGOS solved this issue, so you can take a look at their Taxi code. However, it is just a better hack than what we currently have. The true fix will only happen if Shauren ever finishes his transport re-write.

– Brian

@ Brian

What I meant by GAMEOBJECT_TYPE_MAP_OBJECT is that it is defined but never used so I didn’t understand what it’s purpose was. I figured it would be used as criteria when loading or spawning the object.


What I don’t understand is if you enter the tram at SW you’re on grid [32,36] which activates the far tram and entering at IF you’re on grid [32,32] activates the front tram, why doesn’t forcing the grids to load cause both trams to activate?

In theory this should force load both sides and activate the trams but it doesn’t:

Map:AddPlayerToMap(Player *)


// ....Stuff....

Cell cell(cellCoord);

EnsureGridLoadedForActiveObject(cell, player);

AddToGrid(player, cell);

// After loading the grid, check if we're in the Tram

// and load opposite side grid if necessary so both trams work

// Once loaded, grids will stay loaded until server shutdown

if (GetId() == 369)


	 // Stormwind entrance is grid[32,36]

	 // Ironforge entrance is grid[32,32]

	 // Player enters at Stormwind, need to load Ironforge

	 if (cell.CellY() == 36 && !IsGridLoaded(32,32))

		 EnsureGridLoadedForActiveObject(Cell(32,32), player);

	 // Player enters at Ironforge, need to load Stormwind

	 if (cell.CellY() == 32 && !IsGridLoaded(32,36))

		 EnsureGridLoadedForActiveObject(Cell(32,36), player);


That code above has the same anomally. If you stay on the SW side the front tram never arrives and if you stay on the IF side the back tram never arrives.

Could you give me a hint as to where this spawning happens? I followed the core from AddPlayerToMap() and it never even indicated there was any taxi in the tram at all.

Boy was I way wrong. Don’t use it ya lose it … blah blah blah…

mysql> select entry, name, type from gameobject_template where entry between 176080 and 176085;
| entry | name | type |
| 176080 | Subway | 11 |
| 176081 | Subway | 11 |
| 176082 | Subway | 11 |
| 176083 | Subway | 11 |
| 176084 | Subway | 11 |
| 176085 | Subway | 11 |
6 rows in set (0.00 sec)

mysql> select guid, id, position_x, position_y, position_z, map from gameobject where id between 176080 and 176085;
| guid | id | position_x | position_y | position_z | map |
| 18802 | 176080 | 4.58065 | 28.2097 | 7.01107 | 369 |
| 18803 | 176081 | 4.52807 | 8.43529 | 7.01107 | 369 |
| 18804 | 176082 | -45.4005 | 2492.79 | 6.9886 | 369 |
| 18805 | 176083 | -45.4007 | 2512.15 | 6.9886 | 369 |
| 18806 | 176084 | -45.3934 | 2472.93 | 6.9886 | 369 |
| 18807 | 176085 | 4.49883 | -11.3475 | 7.01107 | 369 |
6 rows in set (0.02 sec)

It is spawned 6 times, 3 at each end. How it works at all is beyond me. What should happen is there should be two spawns (one at each end), the trick is that you have to spawn them exactly on the two start nodes of the deep run tram taxi path (just like flight masters have to be spawned perfectly or you get “TAXI ERROR”). Again I was wrong here, there is only one taxi path, that runs in a circle.

If you want to know where the movement code is, just search the core for GAMEOBJECT_TYPE_TRANSPORT there are hacks and kludges all over the place. Not GAMEOBJECT_TYPE_MO_TRANSPORT … those are boats and zeplins, and handled differently.

I am still trying to wrap my brain around how this is working at all. We need spawn data from offy – but Cata or MoP data would more than likely be useless.

Again, I was correct that the MaNGOS variants fixed this problem and the MaNGOS DBs have good spawn data. As to whether it is a hack or something that is worth porting – that requires more research.

– Brian

EDIT: I give up on trying to fix the formatting of this post. The forums just want to mangle the crap out of it.

What first confused me in the beginning was that it doesn’t register as a GO in the game. If you get on it and type .go near it will return no results or subway benches depending where you are when you type.

Now what I don’t understand is in theory you should be able to trick the core into spawning both sides by simply putting a dummy on the opposite end. If you enter through SW and it spawns the back train, putting a dummy or a “visitor” on the IF end should spawn the front train. Strangely though, this does not work. It only spawns the train where the player is.

I remember in the early days of Trinity it was spawned half way down the tunnel but didn’t move. Now it moves but doesn’t seem to spawn correctly.

Easy, each tram is 3 objects, not a single one.

@Aokromes, after actually looking at the models I know that now. They are still spawned incorrectly.

@MrSmite, even if we get good spawn data, we still need to port over the fix from one of the many cores out there that has implemented this correctly.

– Brian

Yeah, that’s true. I’ll probably just set this aside since at least it partially works.