-
Notifications
You must be signed in to change notification settings - Fork 12
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
Feedback & Requests #3
Comments
Firstly - thanks, this is exactly what I was looking for. Secondly - would this work with a LOD? So you could have a low-poly version of a zone operating as scenery that's then swapped out on triggering the zone loading. Thirdly - have you had any issues with saving and loading games? |
Thank you, I'm happy that it is useful :) For LOD version of zones, I think it should be possible without too many modifications if there is only one LOD level.
I've not had any issue with saving/loading games, but I only save very few data. For example, if I kill monsters in a zone and come back later, they will be back, but this is normal for my game. If you need to keep the zone state, you need to save each zone data when they are unloaded, I don't know if that is your issue. |
Hi, just started playing with the template project. The character runs fast enough to launch itself out of all the zones and you can see them being unloaded and brought them back when you come down. It does exactly what I wanted to implement so far. As to the workflow, I guess it comes down to
I'm thinking that maybe it would be nice for the zone to show the map-node it will load later while in the editor. In case you have to line things up again. But either way, very useful, thanks |
You mean have all the zones attached in the editor to see the whole world? Unfortunately doing so Godot would load all the zones at the start of the game, defeating the system purpose (only load what is needed). |
You can use the tool extends Node
func _ready():
if Engine.editor_hint:
# in-editor behavior
show_always() # or use VisibilityNotifier ?
else:
# regular behavior
use_triggers() I'll cook up a prototype, if it works I'll share it in a PR EDIT you obviously know all that. I think the misunderstanding is the loading part; Godot only saves parts of the scene that are owned by the current_scene. If you add the map-part to the editor from scripts, but leave the owner blank, it will not be saved. Then when loading the level in-game only the triggers are there, as intended. |
Wow, that is some seriously cool stuff, didn't know it was possible. It's a great addon to the system, I will merge it when I have time, thank you :) |
How about turning off the "monitorable" property for the ZoneX Area2D's? As far as i can see, they only need to detect the player entering and exiting, but do not need to be detected, as in any overlap between each other? (haven't looked much into the 3D variant, but from what i see i assume this works much the same in that case). edit: Additional thought, would a visibilityEnabler2D also work to just disable trigger areas off screen, or that be unnecessary (too)? |
Hello! I use "zone.get_overlapping_areas()" to detect which zones are connected to each other, so "monitorable" is needed, and without "monitoring" the zone won't be able to detect the player entering it. Anyway, I don't think it is a problem performance-wise since there is only the player and the triggers on this physics layer. I think it is possible to improve the system for 2D with VisibilityNotifier2D, I need to work on this. |
Ok, I updated the 2D detection system and demo, there is actually no need to use VisibilityNotifiers or Enablers. The 2D player now has an Area2D that covers the whole screen making zones attach as soon as they become visible. |
That was quick! Thanks! about the 2D specific change: |
Yes, exactly my thoughts, also the physical engine is optimized for collision detection, so I don't think it is a big deal, unless we have hundreds of areas. In that case it is possible to have a culling process that disables the colliders according to the distance from the camera. |
Hello, I mainly use Godot for 3D stuff, so I don't know the issues with 2D sorting very well, if you think your solution can help most of the 2D games that will use this system, can you submit a pull request? Much appreciated! |
If the 2D game is 100% top down view, then this will be not needed. If it isn't, and the viewing angle of the assets is more like 45 degree (e.g. Undertale), something like this will be necessary so the perspective makes sense(otherwise you will either always be in front or behind everything in every zone). I'll test around a little more to make sure I am not missing anything, and then I'll create a pull request. Glad I can contribute. |
Ok, I converted the 3D demo with the new node structure, unified the scripts, and removed the basic 2D demo, the tilted demo is now the standard 2D demo. @Wrzlprnft, can you check if everything looks fine? |
Oh, i didn't think of just calling connect from the zone on the trigger... whoopsie Yeah, looks good to me 👍 |
I get the following error when quitting after a 2D zone have been unloaded: ERROR: remove_shape: Index p_index = 0 is out of bounds (shapes.size() = 0). Any idea ? |
I traced it down to a zone having a tilemap with YSort enabled after being loaded and the unloaded at the point of quitting causing that error. i haven't found out why at this point, though. I've yet to reproduce it on my personal project under the same circumstances, i do not get the error there. |
Good news, I was able to fix the issue, so I submitted a new version to the Asset Library (waiting for approval) :) The issue was when freeing a loaded zone that was not in the tree, with NPC. I changed free() to queue_free() and it seems to have fixed the issue. Thanks for your patience! |
If someone wants to have a larger viewing distance he can increase the area I hope it helps you. |
Would be a system to hand off NPC's traversing between zones within the scope of this project? |
I think it is a bit too specific to be included in the system. We would add a section to the readme on how to handle this problem if you have a good solution. But I don't know much about pathfinding, I don't use it in my game. I know you have a navigation mesh and a navigation agent, but can you split the mesh across multiple zones and have it work? |
Ill dabble with it and see if i can come up with something. Might take a while, though, as i am just starting with the entire topic of pathfinding. |
It's been a while. Here are my conclusions on the npc stuff so far:
Basically, it would need a "level of detail" like system for moving npcs:
Godot does offer addind/subtracting polygons from nav-meshes. Therefore zones could on loading and unloading add/subtract their navmesh polygon to/from a global "currently loaded" navmesh. Npcs could be reparented to the zone they are currently entering to prevent them going out with their starting zone. On loading and unlading zones could handle populating/depopulating the world areas they control, and hand over control of the remaining npc behaviours to their parent nodes/the world. The real issue i encounter which always blows stuff out of proportion is the information npcs need to function. What if their goal got unloaded? What if they need to exit the loaded zones into a currently not loaded one? There is a bottomless pit of system design here, because it is either super game specific or overkill for most games. It basically ranges from "well, we just want to have city guards be able to run across the whole city which consists of 2 zones" so therefore it would just need to be one navmesh for both zones to "well, we basically need a full economic simulation across all zones to have the traveling merchants be very believable in what they carry and where they go" which requires a whole separate set of logic.
It appears that not the pathfinding is the problem, but rather information doesn't have the same visibility as the player, and therefore it isn't trivial to add this to a system that is based on player visibility. ... unless someone comes around the corner with a finished system. (initial ideas on basically making a second layer of zones only consisting of information for npcs and have that load/unload based on npc behaviour instead of player behavious seemed promising, but i'd need way more time to make it actually work and useable) |
Can we make it while working on editor viewport? |
@blisterPrinkles what do you mean? |
I was thinking in saving power while editing a 3d open-world... however I did not realized that there is other methods to join by script chunks and I bet that your system works with that too! |
There is a "preview" flag that allows to show/hide zones in the editor. |
I kept having my game crash and I think I've found what's causing it. In background_loader.gd, line 237 or so there's a line that is if resource_instance != null: and there were some times when I freed the world to change scenes to a menu or whatever and then when I changed back to the world scene, it would crash. I changed the above line to if is_instance_valid(resource_instance): and it no longer crashes. Thanks. |
Happy you were able to fix your issue :) Normally, if you need to go to a main menu, you should stop the loading system by calling:
This will properly unload all used resources (might take a few seconds). Hope it helps! |
You can use this issue to discuss the plugin.
The text was updated successfully, but these errors were encountered: