godot-lportal/README.md

54 lines
3.3 KiB
Markdown
Raw Normal View History

2019-09-11 09:04:27 +02:00
# godot-lportal
Portal rendering module for Godot
2019-09-12 17:29:01 +02:00
Work in progress, not yet fully functional
2019-09-11 21:23:17 +02:00
2019-09-15 20:38:42 +02:00
Video of initial testing:
https://www.youtube.com/watch?v=xF_3Fe2HRdk
_Feel free to leave suggestions / feature requests on the issue tracker, especially regarding ease of use._
2019-09-15 20:36:47 +02:00
2019-09-14 13:10:48 +02:00
## Current status
2019-09-15 20:36:47 +02:00
Mostly working now. Will do exhaustive testing of multiple portal views tomorrow.
2019-09-14 13:10:48 +02:00
2019-09-11 21:23:17 +02:00
## Roadmap
* Auto conversion of named room spatials and portal mesh instances to LRoom and LPortal DONE
* Auto creation of mirror portals DONE
2019-09-12 17:29:01 +02:00
* Recursive determine visibility DONE
2019-09-12 21:14:52 +02:00
* Prevent memory allocations (use pools for plane vectors) DONE
2019-09-13 20:26:52 +02:00
* Add support for objects moving between rooms - cameras, players, physics etc - DONE
2019-09-15 17:25:43 +02:00
* Refactor code, moving LRooms and LPortals outside scene graph DONE
* Cleanup code, Optimize DONE
2019-09-15 20:33:15 +02:00
* Handle special cases (multiple portals views into room etc) DONE
* Bug fixing / testing
2019-09-15 17:25:43 +02:00
* Optimize non-moving statics
* PVS (primary and secondary)
2019-09-11 21:23:17 +02:00
* Investigate multiple passes (shadows, lights)
2019-09-12 17:29:01 +02:00
## Instructions
This is all subject to change, but to give a rough idea of the current process:
* Make a list of spatials for each room under a parent spatial (which will become the room manager)
* Name the rooms 'room_kitchen', where kitchen is your room name
* Place your objects within the room as children of the room
* Also place portals inside the rooms
* Portals should be MeshInstances, and convex polygons (e.g. you can create a plane and move it into position for a door)
* Portals should be named 'portal_hall', where hall is the name of the room the portal should link to
* Portals only need to be made in one of the adjoining rooms, the system will automatically create the mirror image portal
Once this structure is set up in the scene graph:
* Convert the parent of the rooms to an LRoomManager node
2019-09-15 17:30:22 +02:00
* At game / level start, call 'rooms_convert' method on the LRoomManager. This will setup internal room and portal lists within the room manager prepared for fast rendering, and make portals 2 way (LRooms and LPortals are now handled internally within LRoomManager, and as such are separate from the scene graph after initial conversion.)
2019-09-13 20:26:52 +02:00
* Call 'rooms_set_camera()' on LRoomManager to set which camera is used for visibility determination (this is useful for debugging)
2019-09-15 17:25:43 +02:00
Dynamic objects that may move in between rooms (DOBs), like cameras, players, boxes etc are handled slightly differently. You should currently maintain them outside the roomlist, and instead of adding them to the rooms directly, you call:
2019-09-13 20:26:52 +02:00
* `void register_dob(Node * pDOB);`
2019-09-15 17:25:43 +02:00
to register with room system, which creates a soft reference, so that the DOB will be culled as part of the system.
I'm still in two minds whether to have the user manually call
2019-09-15 20:38:42 +02:00
2019-09-15 17:25:43 +02:00
`void update_dob(Node * pDOB);`
2019-09-15 20:38:42 +02:00
2019-09-15 17:25:43 +02:00
or have the system automatically manage DOBs. DOB updates check to see whether the DOB has crossed any of the portals out of the current room, as such could get expensive for large numbers of DOBs (hundreds maybe). As such, for efficiency, you usually will want the DOB updates to only take place if the DOB is within the primary or secondary PVS (potentially visible set) of rooms. Likewise you will probably only want to move around / update the AI of these localized DOBs.
For now this function is left to be called by the user but I might be able to make an auto mode for convenience when I implement PVS.