Game Dev Secrets: Increase your FPS by ten thousand percent! #indiegamedev #gamedev

preview_player
Показать описание

(you can have a global queue that controls which frames the algorithm runs on, that way you avoid big spikes if multiple enemies just happen to line up and recalculate their pathfinding on the same frame! but honestly this trick is such a lifesaver man, you can write sloppy messy unoptimized code, then just have it only run every, like, 2 or 3 frames and it makes development way faster for prototyping. plus, then if you do optimize the code later on, you'll already be all time sliced up, so you'll be able to absolute COOK those framerates lmao)

The game that I'm developing as an indie game dev is called Isadora's Edge! A 2D Pixel Art platformer game, that I'm developing in the Godot Game Engine! If you're new to Godot or have any questions about Godot or game dev in general, feel free to ask me! #indiegame #gamedesign #godot #godotengine #gaming #gamedevelopment #pixelart #gameengine
Рекомендации по теме
Комментарии
Автор

Wishlist Isadora's Edge on Steam!

Thank you!

InboundShovel
Автор

Fun fact: Celeste uses this method for spikes hit boxes, and you can use a glitch or external tool to ignore 2/3rds of spikes. Don't forget failsafes!

hamzamotara
Автор

The much bigger optimization is to choose a completely different approach, on a low end machine you should be having hundreds of enemies pathfinding at once without dropping below 60 fps, especially in a 2d game, so the problem here is the algorithm itself and not the frequency, but i understand this is just an example

jeghamjegham
Автор

This is a very good example of code that should never be related to framerate but rather a fixed-time update function like the ones physics also ought to use.

Nemofication
Автор

I've been seeing these shorts for the past few days and I very much looking forward to your game. Great way to advertise it❤

lenderjun
Автор

Another youtuber (blargis) also added random offset for each enemy path calculation in his game to spread out the load

להבצור
Автор

My game has about 500 enemies pathfinding on screen at a time. The pathfinder updates every 6 frames and I use multithreading and ECS to lessen the load on the main thread and reference the data more efficiently.

I still have some optimizing to do, currently creating and destroying enemies and I saw your video about instantiating all objects on start then disable and renable when needed but I feel like that takes the same amount if not more processing than creating and destroying.

God optimization is a real puzzle sometimes

TheKevDev
Автор

SO CUTE my god i LOVE your art!!! the owl looks like a combo with a cat!

sepiasmith
Автор

You reminded me to limit my player stat bar updates to once every 30 frames

TidanOfc
Автор

your game art style is such an eye candy 🥺❤️

dipperdomes
Автор

This is a good technique (though as others have pointed out, it should be done in a fixed time step), but it isn't time slicing. Time slicing involves doing work over multiple frames, normally using threading / jobs.

nokkturnaldev
Автор

This is one thing that I recommend everyone whenever I see someone put everything in their update/process

TaksharyaSinghJasrotia
Автор

Another optimization you can do is have a dedicated pathfinder thread. That way you can queue up as many pathfinding requests as you want and it won't hurt FPS. Instead the mobs will react slower if the pathfinder is overwhelmed.

This is something oxygen not included does for example.


Another thing you can also do is for the second pathfinding is not start at the position you are at but like halfway through it or 2-3 tiles of movement that way you also support that players can fakeout the AI and it isn't magically going to see what you do before you do it.

Edit: another thing you could do is a reverse search with dystars Algorithm. That way you only have 1 pathfinding check no matter the enemies and they all can just ask the player where they need to go :)
(Its a floodfill search that gets crazy efficient if you have multiple targets)

Speiger
Автор

I keep seeing discussions around potential features in games, even features removed from games, and they often seem to forget you can do this.

MrQuantumInc
Автор

Kind of unrelated to the actual topic but i finally figured out what your game reminds me off. it's the Megaman Z series! hyped to see more of it eventually

allegro
Автор

I can’t wait for this game to come out. Wishlisted and watch all of these shorts that come to my feed-it looks great, super excited to play it. Keep up the great work!

jarankennedy
Автор

It also makes sense to run things more frequently when closer to the player, and less frequently when further away.

MechMK
Автор

This is such good advice. I came up with a solution like this to pathfinding performance issues I was having recently, and I wish I knew about this going into the project! I might have tried it sooner.

LoveMakeShareTV
Автор

I know this about time slicing and not pathfinding, but it this case you can probably use steering behaviours without any pathfinding at all! Fliers are usually found in big open spaces rather than tight mazes. So simply casting a shape towards the player and avoiding obstacles that intersect it can often do the trick. If it doesn't, try combining it with portal based waypoints or very course grid DFA. Remember to use string tightening on the result!

keldencowan
Автор

Just make sure to have each one checking on different frames so that you don't have a lag spike every 15 frames. You also only need to check the ones that are in frame or close enough to be relevant. You can also use 2D voxel pathfinding which may be more performant depending on the size of those voxels. There's probably some other methods too, but that's off the top of my head.

MightyDantheman