That's what I did in the demo above. I'm afraid the slowdown comes from constructing polygons from SVG paths, not necessarily from drawing the result. I guess it could be improved but then again, you might as well convert the SVG files to a simpler format that Love2D could just render without doing any math.About slowliness: vector graphics can be prepared beforehand using canvases, and drawn as plain images in love.draw() later. Something like precaching svgs' in Qt.
lua utils
Re: lua utils
Hey Arampl, looks cool.
Re: lua utils
Thanks!ivan wrote: looks cool.
Of course. All that you want to generate procedurally can be done in love.load() or before loading next level of your game. Even create pngs (even texture atlases), store them somewhere, then use in rendering function.ivan wrote:you might as well convert the SVG files to a simpler format that Love2D could just render without doing any math
Re: lua utils
I've decided to port over a couple of my tools to Love2D,
in particular a log terminal and a profiler.
Seems to work OK except that the memory consumption keeps growing even after an explicit call to
Now, I understand that the profiler in particular is highly inefficent and creates a
Lua object after each hook is called,
but with AGen (another Lua engine) the memory consumption is back to normal after a full collection cycle.
Anybody has tips on keeping the Lua memory low?
in particular a log terminal and a profiler.
Seems to work OK except that the memory consumption keeps growing even after an explicit call to
Code: Select all
collectgarbage('collect')
Lua object after each hook is called,
but with AGen (another Lua engine) the memory consumption is back to normal after a full collection cycle.
Anybody has tips on keeping the Lua memory low?
- Attachments
-
- terminal.love
- (162.25 KiB) Downloaded 252 times
Re: lua utils
Have been investigating Box2D's 'contacts' and 'manifolds'
so I wrote a couple of articles detailing what I've learned.
contact lists and callbacks: http://2dengine.com/doc/gs_physics5.html
collisions and math in Box2D: http://2dengine.com/doc/gs_physics6.html
I hope somebody might find these useful.
so I wrote a couple of articles detailing what I've learned.
contact lists and callbacks: http://2dengine.com/doc/gs_physics5.html
collisions and math in Box2D: http://2dengine.com/doc/gs_physics6.html
I hope somebody might find these useful.
Re: lua utils
Updated SVG demo to the latest version of Love2D. Again, it's just a demo and missing a lot of core svg features.
Extract and drop your svg files in the "test" folder to see if it works.
Extract and drop your svg files in the "test" folder to see if it works.
- Attachments
-
- svg.love
- (167.45 KiB) Downloaded 301 times
Re: lua utils
Experiment: wave library, an inferior version of tweener with a simplified API.
Results are normalized in range -1 to 1, period is auto-wrapped in range -1 to -1.
the idea is:
Results are normalized in range -1 to 1, period is auto-wrapped in range -1 to -1.
the idea is:
Code: Select all
wave = require('wave')
-- y = wave.wavetype(x)
-- examples:
y = wave.sin(0) -- sine wave
y = wave.square(1) -- square wave
y = wave.triangle(2) -- triangle wave
y = wave.circ(3) -- circular wave
- Attachments
-
- wave.love
- (1.75 KiB) Downloaded 265 times
Re: lua utils
Code: Select all
a = { b = { c = 'foo' } }
-- old style
if a.b then
foo = a.b.c
end
-- new style:
foo = table.get(a, 'b.c')
Code: Select all
foo = a.b and a.b.c
Re: lua utils
Admittedly that is an old utility and I don't use it anymore.
Perhaps the only useful part is iteration of nested tables:
Outputs:
For debugging it's ok, but no real application otherwise.
For tables, I use a much simpler util nowadays.
https://github.com/2dengine/table.lua
Thanks for taking a look though.
Perhaps the only useful part is iteration of nested tables:
Code: Select all
for i,v in table.fields(a) do -- handles cycles too
print(i .. '=>' .. tostring(v))
end
Code: Select all
b=>table
b.c=>foo
For tables, I use a much simpler util nowadays.
https://github.com/2dengine/table.lua
Thanks for taking a look though.
Last edited by ivan on Sat Dec 11, 2021 8:27 am, edited 1 time in total.
Re: lua utils
New polygon tutorial with interactive demos:
https://2dengine.com/?p=polygons
https://2dengine.com/?p=polygons
Re: lua utils
I don't claim to know a lot about multiplayer games, but I decided to write up a simple tutorial:
https://2dengine.com/?p=networking
https://2dengine.com/?p=networking
Who is online
Users browsing this forum: Ahrefs [Bot] and 0 guests