Last weekend, after a lot of bugging from General BlackDragon I finally got around to working on the broken race game mode for 1.3. First I figure I should explain what was wrong with it in the first place so you know why this fix was needed and why it was such a pain.
The race game mode was added around 1.2 to the best of my knowledge. It might have been in existence before that but 1.2 was where it got the most play. That said, the play was not much. The game mode suffered from the issues inherit in 1.2 unit physics. Players would often play as Mortar Bikes and nose down the entire race. This would cause them to warp around on the map and make race more like a single-player game against a ghost than a multi-player experience. Of course in race you can shoot at each other but for the most part race games either boiled down to racing laggy flashes or DMing. This game mode existed in 1.3 for a time, but it was not known when it broke. At some point, it was found that not many players even tried race, and while it worked with no other players, the moment another would join it would break down. GSH removed the only race map in 1.3 thus removing the issue, but the DLL code remained as part of the deathmatch multi-player script. And for the longest time, race took the sideline and was slated to never be fixed.
Recently, somehow, more interest was had in the race game mode for mods such as Battlezone Classic. This is where General BlackDragon came in. After a good few weeks of bugging I finally got to editing the DLL. In the process of recoding it, I found why the issue occurred and ensured my method made it impossible. To better understand this, I will first explain the anatomy of the race game mode before and after my edits.
Originally, the race game mode has a hard limit of 16 checkpoints. This was because of a smart, but ultimately flawed system for checkpoint control: the spawn-points defined the checkpoints. Now, in race, all units spawn around the team zero spawn and have the team 1 spawn objectified. The sync join unlocks and all players rush for the first point. Then, the team two point is objectified. It is important to note that objectification occurs entirely client-side, thus each player only sees his own next checkpoint objectified. Now, all 16 spawns were placed on the only race map, but with only 4 checkpoint markers that meant it took 4 circuits to count as a lap. The DLL code was designed in a way that required all these points to be used as well. This worked quite well till some unknown update in 1.3. The DLL was forced to remember the locations of all spawn points and then set their team to 0. This was to prevent checkpoint objectification from indicating friend or enemy green or red. Somehow, this bit of code no longer operated correctly when run thought the save/load functions and as a result, as soon as someone joined, it went to hell.
Now, for how I fixed it. I ripped out the entire spawn-point system! I made the map only use one spawn point on team 0. I changed the checkpoint markers to use the labels checkpoint1, checkpoint2, checkpoint3, and checkpoint4. The code will count up until it fails to find an object by name, so there can be as many checkpoints as needed within reason. In addition I oriented the checkpoint objects and the spawn point in anticipation of copying their heading into spawned craft. I have yet to implement this however as it is less a stock option and more a mod thing. The race now flows from spawn point 0, to checkpoint 1, to 2, to 3, to 4, to 1, to 2, to 3, to 4, and so on. Also, since the objectives are actual named objects now, the objectification no longer sets the name to “Checkpoint”. Instead it simply uses the name given to the object. As a result, the load/save bugs no longer occur and the race game mode works in multilayer better than it did before. In addition, now when two players cross the finish line within 10 seconds of each other, instead of the second being rewarded with the win, the first player is noted correctly and is listed in in the custom game over string. The player in first receives 100 points for his win as before and players gain 1 point per lead lap per checkpoint (a point when they get to a checkpoint first). In addition to the original behavior, players who manage to cross the finish line after the leader in the 10 seconds till game end will be noted as receiving 2nd place, 3rd place, 4th and so on. The 2nd place winner earns 75 points, the third place 50, and the 4th and on all 25. It is important to note that to earn any finishing bonus points you MUST make it across the finish line before the end of game session. The DLL should work for a 0 lap game, meaning it will end when the timer hits zero, but this has not been tested as currently the only race map does not feature this option.
Now, what most of you are asking, other than possibly “Why did you fix something no one uses?” is “Where is this fix?” Well, I submitted it to the private 1.3 bug tracker. This means it might not get into 1.3’s next patch. HOWEVER, this code is immediately 1.3pb5.1 compatible. This means that, for a mod, I can provide the code. I may include this code into the UEP’s enhanced DM and CTF DLL.
Next on my list is to simulate 100% correctly Battlezone 1’s sky plane system. General BlackDragon has already created some objects to simulate the sky sprites but has to place them manually into the map. I have asked him to avoid this however in preference of a TRN parameter based setting system mirroring BZ1’s sky settings. Ken Miller has provided me with a snippet of Battlezone 1’s cloud code that should allow me to faithfully reproduce BZ1’s sky in BZ2. All I have to do is find where I put it (I think I know) and evaluate how it works (including its flaws).
Anyway, feel free to contact me if you want the race code for your 1.3pb5.1 mod or map! It is best if you PM me rather then comment on this blog post as I often do not check here. I will however try to get more use out of this blog in the coming months. In fact, if you want the code, comment here and PM me. More traffic for the blog can only help.