Why did you use inline sprites instead of naming them and have them part of the assets (which makes it nice an easy to edit and create).
I see there are 9 āHudSystemā namespaces, was there a reason for this (I donāt use namespaces much in my real job).
Did you have framerate issues between rendering the entire screen or using the sprite system that exists (with on overlap calls)? I realize itās wildly more complex to render each frame as a single image, just wondering if you had any stats or roadblocks you hit when trying to do it as actual sprites.
You have angled sprites for the hero, but then I also see a rotate function (for rotating sprites similar to some of the extensions Iāve seen). Did you find that just rotating and setting to specific degrees resulted in some fragments or strange sprites?
Another issue is actually makecodeās compiler. but I would agree that it is slower. My 3D engine was running very slowly on my computer, but once I used a real js editor (an html + js file, so notepad is the editor and the compiler is chrome) I found out it went 110 times faster. Thatās huge!
Thanks for taking the time to look through the code and ask such detailed questions!
English isnāt my first language, so I translate my answers so I could respond more accurately. I wanted to make sure I understood your questions correctly and explained the technical details clearly.
Also, my development versions do contain comments, but I remove them from the public builds. I ran into an issue where MakeCode share links would sometimes get removed when comments were left in the code, and I still donāt know exactly what triggers it. Since many of my development comments are also written in another language, I usually strip them before publishing.
1. Why do you use inline sprites instead of Assets?
I back up and switch between different versions of the game very often. By keeping the images directly in the code, I only need to save the whole JavaScript / TypeScript text to keep both the code and the matching art together. This also avoids situations where the code and Assets come from different versions.
I have a separate document where I edit and manage the art assets, so Iām not actually drawing them directly inside the img text. Assets are definitely easier to edit in MakeCode, but keeping the images in the code works better for the way I manage versions.
They arenāt actually nine different HUD systems. Itās the same HudSystem split across multiple files.
Iāve been developing the whole project in modules. As the HUD got larger, I split different parts of it into separate files, such as the tutorial, life display, results screen, etc., but those files still use the same namespace HudSystem.
TypeScript merges namespaces with the same name, so to the rest of the game itās still just one HudSystem, and I can keep calling everything through HudSystem.xxx().
I mainly do this because it makes things easier to work on. If I want to change one part of the HUD, I can just go to that file instead of searching through one huge HUD file. The module screenshot is basically how the whole project is organized.
3. How different is the performance between drawing the bullets myself and using the normal Sprite system?
I made my own performance testing tool for this, and the difference is pretty noticeable.
LEFT: Current rendering system: 4,282 bullets, 45 FPS
The RUSH Boss creates a lot of bullets during each dash. With the old approach, those attacks could make the game almost completely freeze. After switching to the current system, it became much better.
I also changed the collision system, not just the rendering. Collision checks are regional instead of running across the entire screen.
So when there are a lot of bullets, they arenāt all constantly doing full collision checks. Only bullets that enter a certain area around the player or shield go through the more precise collision detection. Bullets that are off-screen or far away from the player donāt waste as much performance on collision checks.
The main ideas are:
Only draw bullets that are actually on screen
Draw large numbers of bullets together
Only do precise collision checks for bullets near the player
This works especially well when there are a lot of off-screen bullets. In one stress test, there were more than 15,000 bullets in total, and because most of them were outside the screen, the game could still run at around 25 FPS.
4. Why does the player have pre-drawn angles if you also have a rotate function?
Because rotating small pixel-art sprites sometimes produces images that donāt look very good, even if those bad frames only show up occasionally.
I also found that rotation could sometimes affect the playerās trail effect in strange ways. While rotating, the trail could develop jagged edges.
So for the player, I pre-draw the important directions. I only hand-draw about one quarter of them, and the rest are created by mirroring or rotating those images with tools.
I still use the rotate function for other objects where the exact pixel shape isnāt as important.
Thanks for the questions! I didnāt expect someone to look through the code this closely, so it was really interesting to answer them.
Thank you!! I honestly didnāt expect this much positive feedback on my first post.
My main field is actually art. I focus more on concept design, but personally I lean quite a bit toward technical art. Iām really interested in technology, so Iāve learned a lot of technical and programming-related things along the way. I guess Iām kind of half a technical artist. Iām still in college right now.
I normally wouldnāt make something on a platform like MakeCode, but one of my classes this semester required us to use it, so I decided to give it a try. This game eventually became my personal project because it grew into something that relies heavily on TS, while my group members only know how to read Blocks and arenāt comfortable reading code.
If anyone wants to try some of the more interesting combinations, Iād recommend using Custom Boss mode with Random Bosses. You can refresh it a few times until you get the combination you want.
One combination I really recommend is HYBRID DUCK + RUSH or HYBRID DUCK + WALL. HYBRID DUCK is the only boss that can buff other bosses. When its protection orb ends up around the RUSH/WALL Boss, the visual effect looks really good, especially while RUSH is moving around at high speed.
Iād also recommend trying the Level 30 LASER Boss. Its ultimate attack after it becomes enraged is probably one of my favorite parts of the whole game. It enters the enraged state below 1/3 HP, and the powered-up ultimate after that is one of the attacks Iām happiest with.
In Multi-Boss mode, the selected difficulty is divided across the bosses. So if you choose Level 30 with 2 bosses, both bosses will run at about Level 15 difficulty. With 3 bosses, it would be about Level 10 each.
If you just want to test things quickly, the cheat input is:
Thatās unfortunate. I havenāt performed any memory testing or optimization, as Iāve never encountered this issue myself. Making changes to address it, however, could be quite complex.
How in the world did you make this?! This is crazy, like, holy moly, the bosses are insane, I got jumped by the first boss since im bad lol but the polish is on another level
HAHA, NO??? Do you want us all to lose???
Jokes aside, you should totally give the critter jam a shot, thereās still time and you could make something crazy!
Nope it just switches between the two when one of them either stops or is using the pause() function.
@Elko-Utopia consider using the scene.createRenderable function instead of drawing on a sprite. I donāt know how much of a performance boost it will really give, but it will be better for hardware as it isnāt storing an additional copy of the image. Basically itās the function that sprites use to render to the screen, but sprites carry a bunch of extra data that you donāt need here.
Also consider using multiple files when you code, because scrolling through this⦠17,403 line file to edit things does not sound very fun!
Iām wondering what previous programming experience you have, because youāre clearly taking full advantage of game loops and functions, definitely more than I do, but at the same time nothing is commented and nothing is spaced so that itās easier to read. Do you always program like that, or did you strip comments and format before sharing?
Thanks for the answers! Yes I assumed you had a dev version since this āproductionā version doesnāt have comments and is one massive file.
I love the idea of your development environment. The VSCode stuff works well enough but Iāve run into issues with assets as well.
Knowing that you do have several files and a development environment allows me to see through the code as āfor the human this is actually readableā. Now I have ideas on making a dev environment myself that detached from the VSCode version.
Looks like this answered some of the questions I just asked! Thanks!
Projects get removed if there is bad language in the project, such as slurs or words that arenāt kid friendly. Thatās probably why your project was getting removed when it had comments. The filter for bad words could also be making mistakes.
I want to ask if you would like to collaborate on your next roguelike game, because I have been thinking of making something like this myself, or maybe more like Disfigure on Steam. Unfortunately because it takes so much time to send messages here, collaborations are very difficult and usually fail. There is also the language barrier, so I donāt think it would work out, but goodluck on whatever you make next!
I removed all the comments because I think the text in my comments might have triggered Microsoftās moderation system, causing my share link to stop working. So I had to delete all of them. Also, my comments werenāt in English, since English isnāt my first language.
I developed the project in VS Code and split the code into many separate modules. Thatās also why the assets section of my project is empty.
As for rendering without sprites, the performance improvement is very noticeable, especially when there are a lot of bullets off-screen.
For more details about how I developed the game and handled the rendering, you can check out this reply I posted. It includes a lot of screenshots and more detailed explanations!
Id reccomend adding a special song for the idiots who try level 30 all 5 bosses (hearing tons of deltarune music id reccomend the songthat plays when you fight the titan in deltarune)