Are there any prerequisites / precautions I need to take to make "loading" screen work in Godot? - loading

I'm new to Godot and I'm working on my first project in that. The previous game was made on Adobe Flash using AS3. While I coded that, I didn't take the best methods to code the project (used a lot of frames and scripts on the frames instead of using external scripts}). Because of that mistake, I couldn't really code a completely functional loading screen in the end. I don't want the same to happen with my Godot game.
So, what are things I should avoid completely for my loading to work? Also, is setting up a loading screen the last step to game development?
I've seen these instructions to learn how to make a loading screen - https://godotengine.org/qa/41325/how-to-create-a-loading-screen Do you suggest I use the same code for my game? Do I load the loading screen scene the first (making it my main scene)?

To have seamless level transition with loading screens you will need to have a Master scene that loads/unloads your child scenes (mainmenu, loadingscreen, level1, level2 etc) as needed. Flow would be as followings:
Load MasterScene
MasterScene loads mainmenu scene as child of itself
Player selects a level to play
MasterScene shows a loadingscreen scene as child of itself
MasterScene loads a level as a child of itself
When the level is done loading it notifies the MasterScene (parent of the level scene)
MasterScene shows (makes visible) the level scene
MasterScene makes the loadingscreen scene non-visible
Hope this helps as a general guide

Related

what is the recommended way, in three js, to render (mostly) static scene

I have a scene that is mostly static, i.e. without user interaction it doesn't change (animations).
The user interacts with the scene. For example:
when the user clicks on certain location in a map, another image opens in another pane
the user may move the camera by moving the mouse
etc...
Originally I implemented the rendering via animate(), which calls:
function animate() {
requestAnimationFrame( animate );
render();
controls.update();
}
This works fine (in terms of response) except that
the rendering happens constantly, which is not necessary.
for one of the admin pages, which does not show the scene, I'm getting runtime errors when the scene does not exist, but the rendering still goes on...
So I re-implemented the rendering by calling, explicitly, after user action which change the scene
render();
controls.update();
This requires more work, because I have to cover all the cases where the scene changes.
In one of the cases, the behaviour is not as expected (the rendered scene is black and explicit call to render does not fix the problem).
The link here says that if your scene is static, there is no reason for an animation loop.
The link here suggests to use animate().
My questions:
Is explicit render, a good pattern to use in three js for static scenes?
Are there pros to render only when needed, instead of calling animate which renders constantly, when this is not needed?
In terms of resource load in general
The link here says that if your scene is static, there is no reason for an animation loop.
The answer of the respective stackoverflow question is also the correct one. The second link is unrelated to question whether to use on-demand rendering or not.
In general, having an animation loop requires more resources since you constantly render no matter if the scene changes or not. However, certain application like 3D viewers (without animation playback) do not need to do this. It's sufficient to render only when certain events happen (e.g. user interaction).
Is explicit render, a good pattern to use in three js for static scenes?
Yes, it is. It is a good pattern for 3D applications in general.
Are there pros to render only when needed, instead of calling animate which renders constantly, when this is not needed? In terms of resource load in general
The app requires less resources which is always a good thing. E.g. mobile device will save a lot of battery and laptops or desktops will be more quiet.

SFML RenderWindow Views and GUI

I dont know how many people have use SFML, but I basically want to draw my GUI and am unsure of how to do so.
To clarify I know how to draw a GUI but I don't know the 'correct' way to do so.
Currently I am drawing a GUI in the same RenderWindow that is used to draw the Game.
I have started to introduce Views into my game, I have a Game View and a GUI View, which take up 75% and 25% of the screens height (respectively).
Now the question is:
Should I render the GUI in the same RenderWindow but in a portion of the 'map' the player is unable to reach and have the GUI View locked on that location displaying the GUI.
Another idea I have thought of (unsure if it is plausible) is to have a second RenderTarget which renders the GUI and is dispalyed in the GUI View.
If there is a method I have not discovered or one that is recommend I am happy to hear about it, I searched but all I have found is the SFML Documentation in which I couldn't find my answer.
Your question is slightly confusing as I do not know whether you are having a design issue, or a technical issue of implementing the UI. In terms of the design issue:
I have started to introduce Views into my game, I have a Game View and a GUI View, which take up 75% and 25% of the screens height (respectively).
I haven't encountered where using multiple views will be needed for an UI. Take this example:
The UI consists of all the images in the black area. The positions' of those images are always updated relative to the position of the game view that follows the player around, nothing more. A second view isn't needed because the components (images) of the UI follow the view around, just as the view follows the player around.
Now, if you are having a technical issue, then please elaborate on the exact issue that has some accompanying code and I will do everything I can to help out.

animation not playing unity

This appears to be such a common problem, that finding answer to my specific case is near impossible, because of the amount of noise in google or forum searches.
I have imported object to unity from blender. This objects had smaller objects inside it. Those smaller objects have animation on them, which was created in unity. If I open the animation window (Window->Animation) and press play - I can see correct movement of an object. Animation is set to play automatically in inspector, culling type is always animate. If I play the game however, animation does not play. Why?
add the animation to the main object, then animate the smaller object...
you have to put animation component to main object, then animate the small part...
it is important...
it should work
I Could not find any unity inspector based answer. For now, the best option I have is to create new script, and in update() check if the animation is playing. If not, play it. Very inefficient, so to whoever might stumble upon this post in the future, I suggest you try to add this.animation.play() in setting up part of the script.
I know it's kinda late, but this is for others having this same issue.
Animations in Unity have types (2 of which I know).
Type 1 can be attached to an object using the Animation Component.
Type 2 can only be used in Animators (Mechanim).
Animations imported with FBX files are type 2 (and as far as I know, animation type in FBX files can NOT be changed), so they will usually not work when attached directly to an object with "Animation". They should be used with Animators and Animator Controllers. Just create a New Controller and add the animation. It will become the default animation state and play automatically.
If you want it to loop, click on the FBX asset, and in the Animation tab, choose Loop Time and click Apply.

hiding movieclip, rendering performance

I'm developing a rendering engine for a game i am currently building..
I have a main camera (rectangle) that determines what needs to be rendered (thing within it's boundaires)
I am using a bitmap rendering method for the background and that all works fine.
but for the character i am using a movieclip over the top.
when the character goes out of the camera's view is it 100% neccesary to set visible=false?
atm the game is running at 30 FPS (as intended) and everything is sweet, i just wanted to ask out of curiosity.
Is flash clever enough to not bother with movieclip outside of the scene boundaires?
Thanks in advance,
Rory
According to http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7e3e.html Flash won't render if an object is outside of Stage boundaries:
Display list
The hierarchy of display objects that will be rendered as visible
screen content by Flash Player and AIR. The Stage is the root of the
display list, and all the display objects that are attached to the
Stage or one of its children form the display list (even if the object
isn’t actually rendered, for example if it’s outside the boundaries of
the Stage).
In my experience display objects added to the stage cause a performance hit even if they are not rendered.
Setting visible to false causes a much lower performance hit, but still a small hit.
Removing unnecessary display objects from the display list is a documented performance tip from adobe as well.
Of course, if you only have a few dislay objects it might not be worth the effort, but if we talk about large amounts of display objects I strongly recommend removing them from the display list.

My page transitions looking clunky - how should I do page to page animations?

I have a an app that has several pages. When I move between pages (using the NavigationService) I have an animation that makes the text fly out - think standard WP animations or Zune Client.
The animations themselves look reasonable but the problem seems to be the gap between when the animation finishes and the new page is loaded. There seem to be a slight delay when all the elements have completed the fly out and when the new page is shown.
It's making my page transitions feel a little clunky.
How can I make the target page appear the instant the transitions have completed to avoid this?
fwiw - i'm just using the navigation service to navigate between pages.
this.NavigationService.Navigate(new Uri("/SomePage.xaml", UriKind.Relative));
I recently was trying to solve the same problem in one of my applications. My solution involved two main pieces:
Shifting a large chunk of work from page navigation time to app startup time.
Hiding the unavoidable work that couldn't be moved to app startup time by using smoke and mirrors in my page transition animations.
Moving work from page transition time to app startup time
In my app, I have a main page that contains a long list of items, and then a details page that contains a lot of rich detail on a particular item. Navigating forward from my main page to the details page was taking a long time and looked really unpolished. The main problem was that it was taking a substantial amount of time (ie: well over one full second) just to parse the XAML and instantiate the new page. To get around this, I took the entire contents of my details page and moved it into a UserControl and I instantiate a global instance of this control on application startup. The actual details page is now an empty shell containing the minimal XAML required to instantiate the page. In the code behind for that page, I handle adding the singleton UserControl as the sole child element of the page, and then in the OnNavigatedFrom handler, I remove the UserControl from the page. This allows me to shift the XAML parsing and scene initialization logic from page navigation time to app startup time. Now obviously this makes my application take longer to startup, but given the usage pattern of my app that tradeoff is well worth it.
Using animation trickery to hide the unavoidable work
The previous steps didn't completely solve the problem however as there was still some time needed to bind/set all the actual content of the details page, as well as the time required on the compositor thread to do the initial layout and rendering of the page. Unfortunately, there isn't a whole lot you can do about this. I attempted to work around it as much as possible with smoke and mirrors by playing with my page transition animations. For instance, I originally had an animation that would rotate the contents of the page off the screen using a full 90 degree rotation, and then rotate on the contents of the new page using another 90 degree rotation. I changed those to only rotate part way while simultaneously fading the opacity to/from 0. If this animation is performed quickly enough, the human brain then does an amazing job of filling in the blanks and tricks the viewer into believing that the page rotated all the way. My ForwardOut animation actually only rotates by 50 degrees, but the viewer doesn't really notice that, and in their mind they are still extrapolating the rest of the animation long after the real animation has completed. This helps mask the unavoidable work required during the page navigation.

Resources