Hey, what are you using as a level editor?
Dynamic lighting camera system
Oct 02 2019 09:50 PM
What approach did you settle on for watching and propagating state changes?
I've been pondering some kind of function, maybe a clone() method for non-group display objects, that would make a new object with all its current Corona-side state replicated. The use cases I had in mind were motion-blur images, mirrors and other reflections, maybe shadows. Of course one can make multiple objects at creation time, but taking an existing object and incorporating it into an effect on demand is another matter. I think I know some of what needs changing in the source but it would touch a lot of objects, so haven't been brave enough to attempt it yet.
Vlad mentioned a while ago, on Slack I believe, that uniforms are pretty much set at this point, so should be fine to use.
- basiliogerman likes this
@sporkfin, Sure! I developed the editor myself! The project started out years ago and was used for other games, but i decided to polish it until it was more comfortable to work with. Made with Corona too!
@StarCrunch for transforms, some sort of monitoring: intercept x, y, etc. property changes on a new metatable, update the clone object values, and then pass it to the default metatable, effectively updating itself and its clone part. For physics bodies, the only way was to add them to the camera for manual update in an enterFrame, as the physics engine skips the metatable completely.
This can also be done with functions, so you can intercept insert and removeSelf for example, and return a new insert/removeSelf function that inside calls the default one, like extending the default function implementation with some sort of function inheritance. This can be done without metatables even (Just saving a reference to default insert, and replace .insert) then use the inserted object's .path property to recreate a new untextured object, for example. Just try it and see what happens! Git is your friend hehe.
Regarding the uniforms, that's awesome!
New progress, and some cool features!
Fixed the iOS crash problem faster than anticipated!
Optimized light drawing, added light culling, which greatly improves performance on heavy levels, next improvement to try is some sort of pooling, but will leave it as it is as performance is good, still have to test on low end devices.
Was getting an error 256 trying to build for android but fixed it today as well. All i had to do was remove the corona and corona simulator directories in the ~/Library/ folder. So next week there will be android testing.
Since touch listener objects now have a forwarder object, this object can be manipulated directly, for example to create a bigger touch area than the object itself, without resorting to bigger alpha or tricks:
Screen Shot 2019-10-26 at 1.45.47 AM.jpg 86.04KB 0 downloads
The alpha circle area is the touch area, debug is set to true, so we can view it. This effectively forwards all events from the larger circle to the smaller one. This is all i had to do achieve the above result (touch related result):
playerMarble:addEventListener("touch", touchMarble) display.newCircle(playerMarble.touchArea, 0, 0, MARBLE_TOUCH_RADIUS)
Where playerMarble is the smaller circle, the .touchArea group is added automatically after adding the event listener, by the light engine.
Tiny update, i've been busy with other stuff, but decided to do a small update to the plugin. Added more error handling and testing to make sure nothing breaks, and something extra that can be done with the plugin:
Right now framerate is divided between cameras which means that in the video each camera gets 30 frames per second. This is by design as Corona only lets me get so far while trading performance for some features. uncapped/higher FPS possible in the future? As a note, camera canvases can have any shape:
More Android testing needs to be done in regards to texture handling.
- StarCrunch, sporkfin and pixec like this