Normally when we render images, sprites or anything, we do that to a buffer that gets drawn to the screen at the end of the frame.
NUCLEAR THRONE DAILY FULL
When the bug happened again, we noticed two things: the game suddenly forced itself back to full screen, and the player ID value had reset to -1.įiguring out why the game goes fullscreen.Ĭonfused, we moved on to see if maybe the surfaces were broken or uneven: that might force the game back to fullscreen. We set up a realtime log so we could see the value change while we played, and we started playing in windowed mode. In other words, it would be a good idea to keep track of the value of that player ID in the main controller. Each frame, we check if the value for each player is 0 or higher – if it is, the player was created, so the game has started, and we draw the HUD. If the game is over and the player returns to the main menu, we reset the ‘main controller’ and the value gets set back to -1. If the ID number was higher than 0, we could expect the object to have been created (and thus gameplay to have started properly). Game Maker assigns objects and instances an ID in chronological order (the first created object is ID 0, the 2nd is ID 1, and so on). Our ‘main controller’ object holds all sorts of important information about the player, including what the ID of the player instance is.
NUCLEAR THRONE DAILY CODE
The code that calls scrDrawPlayerHUD first checks with the ‘main controller’ if the player exists.
![nuclear throne daily nuclear throne daily](https://i.ytimg.com/vi/bmnR_-wsWMY/maxresdefault.jpg)
![nuclear throne daily nuclear throne daily](https://i.ytimg.com/vi/v2k1FKl8bV0/maxresdefault.jpg)
If we had just been more specific, logging scrDrawPlayerHUD instead of scrDrawHUD, we would’ve noticed that right away. We shifted focus: what if, despite the HUD being drawn, the player HUD was not being drawn? We went back, logged gameplay and realised that this was indeed the case. We checked in scrDrawHUD, and realised quickly that the HUD was still being drawn. scrDrawPlayerHUD then draws the HUD for the player with the player number provided – number 1 for player 1 and 2 for player 2. In Nuclear Throne, the HUD is drawn by two functions: scrDrawHUD, which draws popup text and pickup prompts, which then also calls scrDrawPlayerHUD for each active player. So we focused on was figuring out whether the code that draws the HUD was still being executed after the bug. That was a clue – from what we could tell, the bug would only occur while transitioning between levels. We concluded that one of the ways the bug could be triggered was by pausing the game during the end of the level transition. Not only does it bring you to the next world, it spawns a lot of radiation, a big weapon chest and some other stuff – so you immediately look badass for the trailer recording. It was originally created for our trailer creator, Kert Gartner, who needed a way to record video while not being quite amazing at Nuclear Throne. The only way we could get the bug to happen frequently was the ‘trailer cheat’. Using the developer cheats, we’d try walking around in different worlds and the like. When we started hunting the bug, the first thing we focused on was trying to create a reproducable method of triggering the bug.
![nuclear throne daily nuclear throne daily](https://i.ytimg.com/vi/v80rpUG_B_A/maxresdefault.jpg)
The core issue was that the HUD was disappearing at random moments, without any clear indication as to why that happened. was mostly busy today, I decided to take a shot at hotfixing the issue. I am obviously not the main programmer on Nuclear Throne, so for me a lot of the code, structure and specifics are not as natural as they are to J.W. That doesn’t make for fair competition.įor all of you that think of going into programming, the lesson today is *never make assumptions*.
![nuclear throne daily nuclear throne daily](https://img.youtube.com/vi/7LSs1bj41P4/0.jpg)
Sadly, there was a problem: for many players, the HUD just kind of disappeared halfway through the game. Obviously, this adds a lot of replayability and challenge to the game for those who enjoy that kind of challenge, without changing the game for those that don’t like to compete with others. This way, players can compete with players around the world on the same level, but only get one shot at getting a high score.
NUCLEAR THRONE DAILY UPDATE
In Update #55, we introduced Daily Runs, a challenge every player can take once a day in a pre-generated level. Yesterday, we launched one of the most important Nuclear Throne updates yet.