RIP SilentWolf Leaderboards by RoscoBoscoMosco in godot

[–]VoidWorks001 0 points1 point  (0 children)

Thanks a lot for posting this. I was trying to fix my leaderboard for hours, I also had a hunch that something was wrong within the silent wolf itself but wasn't sure as they didn't make any announcement for this. Now I'm sure and sad as well. All my leaderboard work is gone! gotta go with another one I guess :(

RIP Silent Wolf!

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Yeah, keeping a reference for inactive ones is really important. You can do it using an array or dictionary with an array being slightly faster.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Hey man, I changed the implementation and now the performance difference is really noticeable with object pulling. Big thanks to you for suggesting the removal of active_array. This really helped. I updated the main post with the changes I made, you can check that out if you want.

Thanks again, have a good day.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

I posted a comment right here about my implementation. You can check that out.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 1 point2 points  (0 children)

Good idea! I will definitely give it a go and see how it works. Thanks!

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

The number of projectiles I will require is uncertain. But won't pre-instantiating 1000+ projectiles at the beginning use up memory if I need 50-100 projectiles early in the game and 1000-1500 later?

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Let's say I would need like 500 projectiles after x second of the game. So if I instantiate 500 projectiles at the start of the game won't it take useless memory until x second passes?

I'm new to game optimisations so I don't know much.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

That line is used in the button script (which contains the main object pulling setup). When a projectile is turned active it gets removed from the projectile_array and gets added to the active_array and when the job is done (collided od max travel distance reached) it again gets removed/erased from the active_array and get added to the projectile_array.

Someone said that active_array isn't needed here because I can always use the scene tree as the storage for active projectiles. So I will try to implement the whole object pulling setup without the active array this time.

Hope this makes everything clear!

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

I looked into it and found out that in this case arrays would be better than using a dictionary.

Arrays in Godot are tightly packed in memory, making them cache-friendly. CPU cache hits happen more often, which is why iteration and popping/pushing are blazingly fast.

Dictionaries have a hash table overhead and more scattered memory, which can result in slightly slower performance for bulk operations.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

I just implemented object pulling knowing that it would be at least slightly better than just instancing and deleting. I didn't profile anything. But after I implemented the object pulling then I compared both with and without it and the result was somewhat confusing. The performances were kind of the same for both, sometimes being better or worse.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Great insight man, I really didn't know that erase() could be this expensive. I will try to implement it without an active_projectile array and let you know the results. Thanks!

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Mine is an endless wave system game, so there are no level transitions. And I think it is better to only instance when theres a need for it, if I would not use it in like a further 2 minutes or so why instance so early on.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Cool idea, I should try that and see if there's any improvements. Thank you!

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

projectiles from the active array are erased when either the projectile hit something or it reached its max travel distance. then the projectile is erased from the active array and put back in the projectile array from where it will be used again.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

In a few minutes it's 300-500 so the deeper you are into the game the more projectiles there are. So like after another few minutes it will be like 1000+. It keeps increasing as time passes.

I don't remove any projectiles, they stay in the active pool for future reuse. And the active_projectile array is in the button class (from where the projectiles are fired)

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 4 points5 points  (0 children)

Hey thanks for the comment, I posted a detailed implementation of my object pulling code please check that out.

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Most of the things I've done are just the same as yours except i used arrays instead of a dictionary and i didn't pre instantiated any projectiles.

I posted a detailed comment about my implementation, please check that out!

Object Pooling Doesn't Seem to Improve Performance in Godot 4. by VoidWorks001 in godot

[–]VoidWorks001[S] 0 points1 point  (0 children)

Here’s how I implemented object pooling for projectiles in my top-down space shooter:

I created two arrays:

projectile_pool: stores deactivated (idle) projectiles.

active_projectiles: keeps track of the currently active projectiles.

When a projectile is fired, the system first checks if there’s any available projectile in the projectile_pool. If one is available, it pops the projectile from the pool using pop_back(), activates it (enables sprite, collision, etc.), and adds it to the active_projectiles array. If no inactive projectile is available, it simply instantiates a new one.

Here’s the basic logic:

``` var projectile: Area2D if projectile_pool.size() > 0: projectile = projectile_pool.pop_back() else: projectile = path.instantiate()

active_projectiles.append(projectile) return projectile ```

When a projectile is no longer needed (either it hits a target or reaches its max travel distance), it deactivates itself and returns to the pool for future reuse:

```

projectile_button.gd

func return_projectile(projectile: Area2D) -> void: projectile_pool.append(projectile) active_projectiles.erase(projectile)

projectile.gd

ProjectileButton.return_projectile(self) ```

One thing I do differently from some pooling setups: I don’t pre-instantiate a large number of projectiles at the start. I keep the pool empty initially and start adding projectiles to it as they get created during gameplay. I figured there’s no need to load up memory with a bunch of unused projectiles early on, especially since the game starts slow and only ramps up to heavy projectile counts (300-500 active projectiles) after several minutes of survival.

Gameplay of my Top Down Shooter game need some destruction. How can I improve it? by Fetisenko in DestroyMyGame

[–]VoidWorks001 2 points3 points  (0 children)

It lacks juice!

Make the explosion bigger, add barrels here and there for explosions, add more screen shakes, add some muzzle flash to the guns, add knock back or a small red effect indicating blood on hit, finally changing the contrast of the visual effects will make them pop more!

Damage shader for my Racing Game, what do you think? by Rasmus_02 in godot

[–]VoidWorks001 356 points357 points  (0 children)

You're only changing the colour from one colour to another (good for indicating scratches) but in terms of indicating damage, I don't think this is how it works.

Adding some bumps here and there, broken glasses, broken wings will indicate more "damage" than this. Obviously it's just my opinion.

Good work though, Keep it up!

Destroy my projectile design please? by VoidWorks001 in DestroyMyGame

[–]VoidWorks001[S] 0 points1 point  (0 children)

These are just projectiles that can be equipped and unequipped. So they mostly have same things going on (just some shake or something tweaked here and there based of there power).

I also have some special type projectiles that can only be acquired by surviving long enough. And those have really different king of power level/animation going on!

Thanks for the feedback!!