00:00
00:00
ImmanentDeath
Keeper of the Lunar Lighthouse.

Joined on 12/29/17

Level:
12
Exp Points:
1,445 / 1,600
Exp Rank:
46,325
Vote Power:
5.40 votes
Rank:
Civilian
Global Rank:
> 100,000
Blams:
0
Saves:
24
B/P Bonus:
0%
Whistle:
Normal
Trophies:
1
Medals:
240
Supporter:
2y 5m 19d

HTML5

Posted by ImmanentDeath - June 8th, 2019


Darkhouse was made in Flash, because it has worked well and there were not very many issues with it. One problem that did show up was that Flash doesn't recognize the Enter key as an input. I didn't previously know about this issue, so I released Update 0.0.1 with an alternate attack key, among other control options.


I still expect more bugs to be found over time, but overall, Flash has worked great for Darkhouse. The main problem is that Flash is being discontinued next year. Newgrounds does have a workaround, but HTML5 games are still preferable. But Darkhouse doesn't work in HTML5. It has a lot of issues that make the game unplayable, and I'm not sure how to fix them. I have a couple ideas, which I'll get to later in this post.


One problem with HTML5 Darkhouse is the sound. All music and sound effects seem muffled, as if the quality suddenly got worse. It might have something to do with the fact that, at least in the game engine I'm using (Stencyl), HTML5 requires sounds in both .mp3 and .ogg formats, while Flash only needs .mp3, but I'm not sure if that's the issue.


Another problem is that during levels, the game occasionally lags and freezes for a moment. This might be because in the enemy AI a lot of things are happening, and there are a lot of enemies. I might need to simplify it or optimize it so it doesn't reduce performance. Again, I'm not positive this is what's going on here.


The big issue, though, is that Darkhouse crashes in HTML5 very frequently. It doesn't happen immediately, but after spending too much time in one scene, the browser goes black for a moment, then reverts and the game goes black and can't be interacted with. No error messages pop up. The music still continues to play, and for some reason if you right click and then click on "View page source," the game returns to normal, but it will still crash if you remain in one scene too long. So if you frequently move from scene to scene, either on the menu or in game, it won't crash. Because of this phenomenon, I had previously thought the issue was with the boss, because you remain in that scene longer than other scenes since your fighting the boss. But after further testing, the game will crash in this way on the Home screen, the Settings menu, while the game is paused, and during boss fights. It doesn't look like it will crash in the Scoreboard menu or during an unpaused game.


My best guess is that my drawing code is causing the issues. In the Settings menu, and while the game is paused, I draw boxes for the user interface, a black one on top of a slightly larger grey one. When the game is paused, I also draw a black, transparent box over the whole screen (not including the pause menu) to dim the screen. I also draw a box on top of a slightly larger box to make the player and boss health bars. Stencyl doesn't recommend that you draw shapes on top of each other, though, saying that it wastes processing power. But this hasn't been an issue on Flash, and I don't draw these boxes on the Home screen, where the game still crashes. I have also experimented with more complicated drawing code to avoid drawing shapes on top of each other, but the issue persists. However, I've also tried a boss fight scene with no health bars, and it did not crash, or lag, which leads me to believe that the drawing code is the problem.


The Home screen is the only place where I don't draw shapes and the game still crashes. On that screen I draw text only, and I have a lot of code setting text attributes to make sure everything works. The code in the Settings menu works the same way. They're the only two scenes where you can navigate the menu instead of just pressing "Back to exit," for example.


If these are the issues, then I have a few ideas for how to work around them. For example, in the Scoreboard scene, I use a background for the list of scores instead of drawing boxes, so I could do the same thing for everything else. And for the menu screens that feature navigation, I could simplify them to only operate where a specific key is assigned to each menu item instead of the scrolling and selecting currently in Darkhouse. I don't like the idea of removing that feature, though. For example, I'd have to make it operate with "press Z to start," or "press X to view scores." I can do that, it's just not as cool as a functioning navigation for the menu screens. That being said, the pause menu doesn't feature navigation, because it didn't work. Since the game is paused, attributes don't change in real time, so it wouldn't update what item you have selected on it's menu.


I don't know if this is the whole story, either. HTML5 is different from Flash, and there may be other problems and things that cause problems that I'm still unaware of. I'll continue to experiment with some of the ideas I've stated, and I don't know if they'll fix the issues or not. I'll also post updates on what I find if I discover anything new, especially if it contradicts something I've previously said. I'm still very new to game development, so if you have any questions, ideas, or suggestions, please let me know. I want to make Darkhouse the best game that it can be, a fun, challenging, and bug-free game.




Edit (6/11/19): I've done some more testing, and it seems like the issues have to do with the font when drawing text. I haven't ruled out the box drawing, but on the Home screen where there are no boxes drawn, the game still crashes as long as there is text. If there is no text, the Home screen is fine.


I did some research and discovered that it may be the format that I imported the font into the game in. There are two options for using fonts in Stencyl, one is regular, and the other is bitmap. With regular, you choose the font you want to use from your computer, and you can customize it a little with color, stroke, etc. This is what I was doing. But regular fonts can take up more space. In testing I converted the main font to a Bitmap font, which is based on images of the text, and it seemed to work fine, no crashes. Bitmap fonts take longer to set up, though, and there were a couple other errors with it that I need to fix.


I'm still not sure why the sound is messed up, either. The game works fine with the sound this way, but if I can't fix it, I might recommend Flash over HTML5 since it just sounds better in Flash.




Edit (6/12/19): I tested the game with bitmap fonts. The fonts are blurry, and I can't get them to a better resolution. The game also still crashes in HTML5 with bitmap fonts, so I'll probably still use regular fonts since they look better.


I found an issue on the Stencyl forums that seems similar to mine, where any drawing code causes the memory usage to rapidly increase. The problem has been confirmed, and I might just need to wait until a new build of Stencyl is released with HTML5 fixes. I'm not sure what else to do, since it looks like the issue is with drawing in general.




Edit (8/4/19): I've been running Darkhouse in HTML5 every now and then just to see if it would work any better, once a while ago and again earlier today. I've updated the game a few times, and I'm still waiting to see if Stencyl will release a new build that fixes some HTML5 problems. But somewhere in my Darkhouse updates, or possibly somewhere else, something must have changed, because a lot of the issues I used to have are gone.


The music and sound effects are still the same, an issue that had been noticed before in the Stencyl community. But the game seems to run fine in most areas now. It never crashes anymore (at least while I was testing it), and it only seems to lag and reduce frame rate during boss fights. No drawn text or boxes seem to be causing problems like they were before.


I have no idea why Darkhouse is suddenly working better in HTML5. I couldn't figure out why the game was crashing so much. Now the only issues seem to be the sound and boss fights. I don't yet know what to do about the sound, but there might be a solution or two for the bosses. For example, I could remove the invert effect applied to the boss when it takes damage. But I would need another way to signify that the boss took damage, since bosses don't have damaged animations like normal enemies do.


I'm not going to release an HTML5 version of Darkhouse until all of these issues are solved. Small bugs provide little impact on the player's experience, and can be easily fixed as well, but these ones are very noticeable and noticeably annoying. Hopefully I can figure out not just how to fix Darkhouse for HTML5, but also how to use HTML5 for all my other games that have yet to be developed.


Comments

Comments ain't a thing here.