Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411414 Posts in 69360 Topics- by 58415 Members - Latest Member: sophi_26

April 16, 2024, 08:35:56 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsDevader - swarms of enemies - made in HTML5
Pages: 1 ... 19 20 [21] 22
Print
Author Topic: Devader - swarms of enemies - made in HTML5  (Read 52844 times)
Alain
Level 10
*****



View Profile WWW
« Reply #400 on: August 15, 2023, 02:33:32 AM »

Dmg is a hard one to visualize, as some dmg is dealt with explosions. Explosions have a radius + falloff to zero on the edge of the radius.

I had the same problem when making damage icons. One of the thing that I always tell people is that in my game you don't have a sword or a shield, just potions. But I ended up with the icon for damage being a sword and for armor a shield Wink
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #401 on: August 23, 2023, 01:09:26 PM »

I too use sword(dmg), shield(armor), heart(lives). I changed this from the original release, it's just much easier to understand. But my issue is more with visualizing the dmg in numbers. Explosions can damage opponents in a larger area, so the radius is important too.

Progress.


I completed a new boss. At least for now. It's a big black invincible slug and an annoying spider. You have to kill the spider, but it tries to run and hide behind the slug. The image is from testing and I think there are two spiders hiding. The lines are debug info, the yellow line is pointing to a position away from the robot.


Attachments were placed in the same distance around the Devader no matter how many there were. This could look quite ridiculous. With very few adaptations of the code, they are now distributed a lot better. But it's never that easy, the change made it obvious that the attachments were clipping right throw everything else...


It took some work, but I think it's a lot more believable. Not perfect, but good enough I think.


An issue I've been avoiding for a long time is the screen edge. The world simply ends there. It feels a bit cheap, so I decided to try to find a solution (You can never see the brown edge, this was an early test). I wanted something rocky, but my experiments in 3D just never made it very far. I was trying to work with particles/emitters but could not achieve what I was thinking of. I did not feel like I had the right tools.


To avoid getting stuck and doing nothing, I ended up programming what I was imagining in Devader directly. Just using red dots. It doesnt look like much, but it gave me a good idea of what I wanted. I was thinking of transfering this to blender in some way, or even Unreal (I installed it, but my PC is too slow I think).


In a sleep-less night I came up with another idea. Why render, if you can use other tech... I was really happy with this result that I came up within about 2 hours.


First visualization came out really nicely too, but placement and scaling was still off.


This is where my trouble started and why writing your own engine can be a bad idea... at least when the engine is a one trick pony built for exactly what I wanted at the time. I just could not figure out how to get my output offset and scaled in the right was. Took ages of digging and understanging old code, but I did eventually figure it out. Not a clean solution, I must shamefully admit, but I will never tough it again. Right?


Pretty happy with the result Smiley


As the edge is no longer straight, I created a minimalist editor controlled with shift+key and the mouse cursor. I added hidden objects to resemble the shapes of the rocks approximately.


Building in the top can now be seen at full height and are no longer just chopped off.


Still some visual issues at the bottom I will need to solve...
« Last Edit: August 23, 2023, 01:18:08 PM by marcgfx » Logged

JobLeonard
Level 10
*****



View Profile
« Reply #402 on: August 24, 2023, 12:34:46 AM »

That murderswarm is glorious

"I am the bullet hell" Cheesy
Logged
marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #403 on: August 24, 2023, 05:27:58 AM »

Thank you JobLeonard, might be a good elevator pitch Cheesy


First version of overlapping stones. I messed up the scaling in Photoshop, only modified the x-scale... redo!


Second version: As I was doing it all over again, I decided to optimize space usage. Whoooops. I can see the robot and ring below... oh more stuff is shining threw. Damn, this won't work.

The robot needs to remain behind the stones, the cursor and nuke should be above. As they are all in one draw call, the rocks need to be within the same call. I will need the full width for the rock image and this will overflow my current texture atlas (4k x 4k). I would have to upgrade to 8k x 4k ... I really wanted to stay on 4k. Damn.


I alredy have two 4k x 4k textues. The background rocks still have some space at the bottom, so this is the other option. But I am not a fan.


Is 8k too much?
Logged

JobLeonard
Level 10
*****



View Profile
« Reply #404 on: August 25, 2023, 02:22:31 AM »

> might be a good elevator pitch

Heh, that does sound catchy doesn't it? It sounds like the kind of thing already been used though
Logged
marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #405 on: August 26, 2023, 06:03:07 AM »

Bullet Heaven & Hell? Bullet Purgatory? Considering both player and enemies can be blasting a lot of bullets.

---

So I was a little stuck. But not for long. I had been using 8k all along, but my older mini PC is really only capable of 2k. That used to be my benchmark. Cuphead runs fine, so I felt it must be possible to handle more assets. I found out WebGL2 has something called sampler2DArray. It's something like a 3D texture. Instead of just two coordinates x & y, you can also specify a z value. Something like layered textures and you can select the layer with the z-value.

So with hope in my heart I rewrote my texture-atlas generator to split the data into 20 2k Textures. On the right (scroll) you can see the original 8k texture.


Getting this all to work in WebGL was another challenge. I was mostly looking at a black screen and error messages, but I finally got something other than black to see.


Made progress with getting things working, but the 3D texture just wasnt binding correctly.
ppt weDie 3D Textur klaiterhin nicht Sad .... Es war ein kleiner Fehler beim Binding der Texturen. Ich habe ChatGPT Code generieren lassen als Vorlage. Am Ende vom Code wurde die Textur auf null gesetzt. Beim durchschauen des Codes wusste ich nicht genau was die Zeile sollte und hab sie gelöscht.


I had asked for some code from chatGPT on how to bind the sample2DArray. I was looking through the code and deleted a weird line, as I did not understand what it was for. Turns out the code reset the binding to null at the end. Finally back to the starting point, but this time with a 3D texture! As you can see, the robot is standing on the rocks.


Now I started working on what I really wanted to achieve. Placing the rocks. For some reason the robot was missing, turns out there was an issue in generating the atlas for some of the images. Some stuff is now behind the rocks.


I did not understand the required scaling for the rocks at all, so I simply adjusted the numbers to match what I wanted. Was pretty easy to do, thanks to edit and continue in Javascript. One of the things I am very very thankfull for. I am slightly overlapping the edges of the 4 rock textures to prevent visible seems. To make the visuals match the background, some adjustments to shader also needed to be made. Pretty smooth sailing. Current goal achieved.


The best thing about this whole change is that I am no longer limited to a single texture. I could also just add more when I need them. This means more space for animations, finally! Additionally the game should be able to run on more GPU's as I now only require support for 2k textures. VRAM is probably not going to be an issue. But I am a little out of my depth here, just an educated guess.

Logged

JobLeonard
Level 10
*****



View Profile
« Reply #406 on: August 27, 2023, 01:48:38 AM »

Nice! Does it also come with a perf boost?
Logged
marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #407 on: August 27, 2023, 02:26:36 AM »

Nice! Does it also come with a perf boost?
Have not noticed any difference, but my PC does support 16k textures. GPU is not really my bottle neck anyway, it's mostly collision detection and my sorting/rendering preparation on the CPU. I am still thinking of ways to optimize my collision and rendering code, as I am worried all the new stuff could slow down older computers. But I should probably test first and see before I go and mess up working code.
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #408 on: September 01, 2023, 04:49:14 AM »

Lot's of playtesting again and bug fixing... I noticed my framerate was considerable lower than what chrome was reporting. Chrome reports the frames itself is rendering, but not how fast the content it is showing is being rendered. So my framerate was around 30 what was a total mystery to me. Turns out I had a bug that registered the new rocks in pretty much every grid, so 1200 cells were doing 40*(40-1)/2 (handshake) collision tests... got that fixed and now I am back up to 60.


I had to add some more joy and enhanced one of my weapons with additional upgrades. It's possible to upgrade it past any sensible limit, but it seems that's something people enjoy. I found out my CPU has been around for 12 years, so it works for me... it should be ok.
Logged

Alain
Level 10
*****



View Profile WWW
« Reply #409 on: September 01, 2023, 05:40:25 AM »

Great to hear you got framerate back under control :D
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #410 on: September 08, 2023, 01:48:49 PM »

It's kind of great that I am no longer so limited in my use of images. This has opened up a lot of new avenues and it's hard not to go exploring. One thing I have been wanting to do for ages was create new environments. In a way this was possible before, but by adding a surrounding area it has become a lot more interesting.

Of course I didn't just start using what I have made to the full extent. Instead I decided to create an oval arena, requiring a whole new batch of code. The red box shows the actual game area where collisions can occur. The blue lines kind of show the outline of the ellipse. Green lines are where I calculated the normals (fatter green line). Yellow and red are how an object would bounce off at that position.

It was not that easy to get working with my visuals, as I had not accounted for the wall height. I ended up using a weird y-scale of 0.7325 (I think) instead of the intended 0.75 not that anyone would care or notice. It was not hard, just a bit fiddly to get right.
Logged

Alain
Level 10
*****



View Profile WWW
« Reply #411 on: September 12, 2023, 11:41:05 AM »

The magic of eyeballing is an essential tool for all of us, I guess Wink
Logged

vdapps
Level 5
*****


Head against wall since 2013


View Profile WWW
« Reply #412 on: September 15, 2023, 09:28:51 AM »

Hey nice progress!  Gentleman

For xy-th time kudos to you for having such good looking game running in browser, moreover at 60fps. I know everything's accelerated now but I still it consider it quite an achievement.

Btw, I have question. In your last animation I saw it's animated WEBP, but for that quality it's very compact, just 5MB. What do you use for encoding? I use ffmpeg for my WEBP-s and it produce quite large files. My not so long animations are always north of 10MB and as my game is not so colourfull as yours, compression should be better in my case, but it's not, files are large, and when I lower quality of transcoding, then it looks awful.
Logged

Sustrato
Level 1
*


It's a good day to die.


View Profile
« Reply #413 on: September 17, 2023, 12:39:19 AM »

The fact that your spritesheets aren't grid-aligned is insane to me.

But hey, I can't argue with the results. The game looks great! The backdrop variations and improved botling AI behavior look really good.

Hard to tell just how good the attachment flocking is with them flashing white - I thought at first that they were clipping through each other, and that it did not look good at all, before I realized it was some kind of status effect or powerup making them flash. With all the dust and chaos I think it looks reasonably convincing, but maybe post a gif without the powerups?
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #414 on: September 23, 2023, 10:34:26 AM »

@vdapps: thanks Smiley about the webp, I wrote a post on that in this thread somewhere... this is what I used here:
Code:
//batch file number 1
@ECHO ON
ECHO "%~1"
ECHO "%~nx1"
ffmpeg -y -i %~1 -filter:v scale=800:trunc(ow/a/2)*2 -ss 00:00:02 -to 00:00:10 -c:a copy _s800_%~nx1
cmd

//batch file number 2
@ECHO ON
ECHO "%~1"
ECHO "%~nx1"
ffmpeg -y -i %~1 -vf scale=800:-1 -vcodec libwebp -fs 24000000 -filter:v fps=fps=20 -lossless 0 -compression_level 3 -q:v 70 -vsync 0 -loop 0 webp/%~nx1.webp
cmd

@Sustrato: no reason to grid align, I have all coordinates saved and it makes the spritesheet a lot smaller. flocking: it's not perfect, but happy enough with it for now. I admit the status effect makes it look a little weird. thanks for the feedback!

(original text was in German, I was lazy and got some chatGPT help)
I've crafted approximately 20 weapons by now. Once a weapon is acquired, it can be wielded on both arms. However, during gameplay, I've observed that switching weapons is hardly enticing. Once you've invested in a weapon, you simply don't want to part with it. To inject more intrigue into the arsenal, I'm contemplating a change. If you want the same weapon on both your left and right arms, you'll need to acquire it twice.

This idea, however, clashes with my current design. I can place multiple weapons on one arm, but not the same weapon twice. If I were to enable this, I'd run into a visual issue. All the weapons would fire from the same point, so if two weapons perform exactly the same function, one would become almost invisible.

Here's the solution I'm considering: adding a unique barrel for each weapon.


Currently, it's just a test. However, I'm skeptical that this approach will work. In Devader, all objects are impacted by shots, and these weapons would be an exception. Alternatively, I could make the weapons destructible, but that would introduce additional complexity.
Logged

Alain
Level 10
*****



View Profile WWW
« Reply #415 on: September 25, 2023, 01:24:36 PM »

That's a lot of guns. I like the multiple barrels approach!
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #416 on: September 25, 2023, 09:32:51 PM »

Thanks Alain!

I've decided to give it a shot. After all, it's still a game meant to be fun. Sometimes, I forget that and try to make the world as believable as possible.

Instead of rewriting the code from scratch and making everything clean and neat, I'm simply adjusting the shot offsets. I was worried about running into issues, if I change too much of the code base. I haven't yet tackled the issue of multiple weapons of the same type on the same arm. Let's see how I can work around that... it's a bit at odds with the existing code, which is uniform for all units. I'll probably just create additional weapons with different names. So, Laser becomes Laser1, Laser2, Laser3... if there's a need for it. Currently, each arm is limited to a maximum of 8 weapons (for UI reasons).
Logged

vdapps
Level 5
*****


Head against wall since 2013


View Profile WWW
« Reply #417 on: October 06, 2023, 08:52:30 AM »

Thanks @marcgfx for ffmpeg tips! I'll play with that.

Last animation is brutal. This is what's selling this type of games most, havoc. Wink
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #418 on: October 12, 2023, 11:58:45 PM »

Weapons can now only be placed in a single slot. As I'm already thinking about multiplayer, the mounted weapon will be marked with the color of the robot. Here, the lower right slot is open. The weapon in the slot itself is red, as is shown in the dropdown. On the other arm, there are 3 weapons mounted, which are red and striped in the dropdown.


Last night, I introduced some stats. With all the enemies and weapons, it's difficult to get an overview. The statistics are meant to help me balance the game or, later on, help the player make good decisions. Friendly units are green, and enemies are red. The middle column provides information about absolute damage, while the right column gives a percentage value.
Logged

forest
Level 0
**


View Profile
« Reply #419 on: October 15, 2023, 08:29:03 AM »

i am not a "you"
f*
Logged
Pages: 1 ... 19 20 [21] 22
Print
Jump to:  

Theme orange-lt created by panic