Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Experimental in-editor playback #13354

Closed
wants to merge 1 commit into from

Conversation

SaracenOne
Copy link
Member

@SaracenOne SaracenOne commented Nov 27, 2017

WIP branch, do not merge.

Merely putting this up for advice and feedback. What this PR is intended to do is essentially provide a secondary playback functionality allowing you to play your game from within the editor itself, as well as pause it an fly around the scene while it's playing. I experimented with this a while back to feel out the feasibility of such a feature, but now I made the first effort to actually try bringing this into a usable feature. Since the editor is built onto of the same node tree, there is no real architectural reason why this is not possible; it just requires various hooks to be addressed in order for it to work accurately and stable. At the moment, the thing which is giving me the most trouble is an issue opened here #13353 where the GDScriptDepSort operator does not work as intended, which is required for a safe global script reload on playback. Since this problem is particularly hard to debug, I may return to the branch later, but if anyone has any solutions, please let me know.

These are a list of currently known tasks, but I will add others as needed:

  • In-editor playback mode added to the editor node with physics and non-tool script simulation
  • Game plugin which views the scene from the current camera perspective
  • Singleton/autoload support for in-editor playback
  • Inheritance-dependent script reloading GDScriptDepSort broken. #13353
  • Game plugin input support with sandboxing.
  • Seperate method from 'is_editor_hint' detecting specifically whether the game is in playback mode.
  • Script breakpoint support
  • Cleanup and polish.

@akien-mga akien-mga changed the title Experimental in-editor playback [WIP] Experimental in-editor playback Nov 27, 2017
@akien-mga akien-mga added this to the 3.1 milestone Nov 27, 2017
@@ -5179,6 +5496,8 @@ EditorNode::EditorNode() {

p = debug_menu->get_popup();
p->set_hide_on_item_selection(false);
p->add_check_item(TTR("Run In-Editor (EXPERIMENTAL!)"), RUN_IN_EDITOR);
p->set_item_tooltip(p->get_item_count() - 1, TTR("When running the project, it will be run from within the editor rather than as a seperate application instance."));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(spelling) "separate"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Typo.

@reduz
Copy link
Member

reduz commented Nov 27, 2017 via email

@SaracenOne
Copy link
Member Author

SaracenOne commented Nov 27, 2017

@reduz I'll keep prodding at it. From the looks at it, there isn't that much which needs to change, and it's arguably easier to maintain than the remote system simply as a byproduct of how elegantly designed the node system is. One of the reasons I would like to keep a big (EXPERIMENTAL) warning on the option for the forseeable is this will still likely to require a whole load of testing with different projects of varying levels of complexity, but I reckon I can still get it pretty stable. I'm going to put it aside for a short while though since I'm getting frustrated with script sorting bug, but everything else should be pretty smooth sailing. All in all though, I'm otherwise quite happy this feature is going.

@neikeq
Copy link
Contributor

neikeq commented Nov 28, 2017

Does this allow to view the running game in real time in the canvas/spatial editor? That would be fantastic for debugging.

@SaracenOne
Copy link
Member Author

@neikeq Yes, that was the last thing I just added. It does it by creating its own Viewport but pointing the World2D resource to the one in EditorNode's root, which contains all the nodes. It renders it as you'd expect; first it uses a new camera but which is designed to track the current camera in the scene to render, and then automatically renders the canvas over it.

@SaracenOne
Copy link
Member Author

@neikeq Sorry, I misread your comment and thought you meant something different. But yes, it does allow that too. You'll be able to fly around the scene while it's running.

@NathanWarden
Copy link
Contributor

@SaracenOne That would be super handy! :)

@blurymind
Copy link

this will be amazing for 3d games!!

@toger5
Copy link
Contributor

toger5 commented May 24, 2018

What is the progress an on it.
What are the odds it actually vecomes to be part of the engine?

I think this would be really sweet.
And it would be a shame if the amazing design of the editor/engine would not be usd that way.

@fire fire mentioned this pull request Jul 7, 2018
9 tasks
@akien-mga akien-mga modified the milestones: 3.1, 3.2 Jul 26, 2018
@reduz
Copy link
Member

reduz commented Aug 23, 2018

I will be closing this PR given time passed and the technical infeasibility to do this.

Instead, I suggest the following course of action:

  1. Find a way to optionally embed the game window in the editor. This is pretty difficult to do with OpenGL, but should be considerably easier to do once we port to Vulkan, due to low level access to the swapchain and image data.
  2. Add an option to the editor, to clone an existing 2D or 3D viewport and put the game there, so debugging and moving around the game scene is possible. This needs to be discussed well on how it would work UX wise.

This should eventually solve those who want a bit better debugging into whathever is going on in the 3D side of the game while running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants