However, it can be difficult to interpret the results. The quickest way to profile is to use in-browser tools like Chrome’s profile tab. It’s hard to detect without profiling because the program still behaves correctly. Small mistakes (like forgetting to swap out some test code), can totally murder you.You damn well better get something good in return. You lose debuggability, readability, and valuable development time. Remember that optimizations are tradeoffs.It feels good to come up with some clever trick and move on, but sometimes you’ve actually made the program slower. Always verify that your optimization worked.It’s too easy to focus on the wrong parts, the parts that will never help you. Always determine where you need optimizations.But I’m happy with the end result and I learned some things along the way: Tuning the performance of my game was a slow process filled with confusion, frustration, and self doubt. I went as long as possible without obsessing over performance, but at some point I realized I simply can’t ship a game this slow. Woops! The solution is find the maximum Y coordinate a monster reaches in an animation and draw in that row instead. When I tried it initially, monsters moving vertically would get hidden behind floor tiles. When you add in the 2.5D perspective, you can no longer draw a monster in the row where it ends up.To fix that, you’ll need arrays of offsets that decay one at a time. In the naive approach, monsters going around corners appear to take diagonal shortcuts.The player’s offset needs to be added to the camera itself, so the camera isn’t jerky.Decaying the offsets to 0 automatically slides the monster around. For example, moving 1 tile to the right produces a (-1,0) offset. When a monster moves to a tile, you assign them to the new tile, but you also draw them with a corresponding (x,y) offset. Instead you must group objects (walls, monsters, spells) into rows and draw the rows in order. That wouldn’t allow walls to be in front of monsters, defeating the purpose of 2.5D. You can’t just draw all of your floor/wall tiles and then draw all of your monsters on top. Not a big deal, right? Then things get dicey. The primary thing required for 2.5D is to render your objects in order from back to front (top of screen to bottom of screen). Even on my gaming desktop, the performance wasn’t great and I knew it’d be much worse on older computers.įirst let’s talk about how the new features work. To make matters worse, I was relying on some costly composite modes. I also needed to do it 60 times per second. I now had to render over 3 times as many tiles. The 2015 version was much more complex and slooow. I only had 121 tiles on screen and they only needed to be rendered when the player moved. For reasons I don’t quite understand, executables that come out of NW.js take a noticeable performance penalty compared to the same app running in Chrome. To make matters worse, I’m distributing the game with a library called NW.js. It runs in JavaScript and is rendered in the canvas, which is known for being…. To reiterate, Golden Krone Hotel is an HTML5 game. Increased visibility radius and fullscreen display.Previously seen tiles, which appear desaturated (common in roguelikes but I didn’t have it originally).Game objects that can obscure other objects behind them, producing an illusion of depth. To appeal to a wider audience (one not content with ASCII graphics), I felt that the following features were needed: This year, I decided to turn Golden Krone Hotel into a polished, commercial game. What can I say? The roguelike community doesn’t expect much when it comes to visuals. It was well received, despite being completely 2D and having lo-fi pixel art and no animation. Last year, I entered the Seven Day Roguelike challenge with Golden Krone Hotel, a game about killing vampires with sunlight. If you’ve ever written a 2.5D game engine, you probably know exactly how to do this. But more importantly it’s about how I optimized the performance of said graphics. I did so by, among other things, adding a 2.5D perspective. ![]() The goal of this game is to guess the amount of tricks you would win in a round, and to win exactly that many tricks.This post is about how I improved the graphical features in a simple HTML5 game. I was really scared to go public with this game, but now I am confident enough to slowly share it around. So for on-and-off 3 years, I have been working on this online multiplayer card game called Lisko (Finnish for "Lizard"). EDIT: Lizard is now called Lisko (can't change post title, since it's archived)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |