godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.9k stars 21.14k forks source link

Avoid performance discrepancies in the running project depending on the currently opened scene and tab in the editor #29531

Open owstetra opened 5 years ago

owstetra commented 5 years ago

Godot version: Godot Engine 3.1.1

OS/device including version: Windows 7 x64bit 8 GB Ram GTX 980

Issue description: Godot Editor can't handle complex level as you can see in this video : https://youtu.be/gWLli5CBhCQ

Here is a small level for our Game , almost everything in this level is a scripted scene , Trees are scenes , Rocks are scenes , Floor are scenes ... etc , this will give is the full control of everything for example making the Trees Destroyable or Light poles turn the lights off if they get Hit .. etc


1- Running the game when i'm in 3D mode in the Editor in the same level that contain many instances you will see that the FPS is about 160 FPS 2- Running the game when i'm in Script mode in the Editor in the same level that contain many instances you will see that the FPS is about 193 FPS 3- Running the game when i create an Empty scene that contain nothing and switch to Script mode in the Editor you will see that the FPS is about 243 FPS

and Godot Editor will get Laggy after running the game several times.. make the FPS Drop more and more ... in this case i need to Export the game , Close Godot and Run the Game to get the Full FPS - About 260 FPS

groud commented 5 years ago

Regarding the first part of the issue, I assume the editor is still refreshing while the game is running. Maybe we could add an option to stop the editor processing when the game runs, but that would disable the possibility to modify the game while it's running. It's likely to be discussed.

The other part is likely a bug, but without more information it will be hard to solve. But it belongs to another issue.

owstetra commented 5 years ago

@groud yes i the Editor is like still refreshing and updating in the Background , i think this option will be a good solution , like adding a check box on the Top right corner of the Editor to Enable/Disable the Editor updating ? if someone want to modify the Game while it's running , he need first to uncheck that Check box

atsuzaki commented 5 years ago

What @owstetra mentioned sounds like a potential usability problem, i.e. newbies getting confused on why they suddenly can't edit their stuff. If it were to be implemented, the UX should be considered thoroughly first 😄 I'm open to help out on this, if it's being done.

Wanna affirm the lag after multiple runs part though, had the same problem of having to restart the editor often. Initially thought it was either GDNative's/my codebase's own memory leaks, but I guess this makes it apparent that it's a Godot-wide problem.

Calinou commented 5 years ago

The slowdown should be less apparent as of https://github.com/godotengine/godot/pull/29297/commits/ac14efcdfb22575fc49a75201492955e723d04c3, which will be in 3.2. Still, it makes sense to have an option that makes the editor stop redrawing completely while the project is running and the editor window is unfocused.

Anutrix commented 5 years ago

Maybe create a checkbox called "Disable/Lock Live Editor to boost performance" which is set to false by default.