i think Julia could really gain from having something similar to Love2d but with Julia instead of LUA.
It is a game engine which loads a LUA file and calls LUA functions defined in their to update the application state (stored in the LUA heap), calls LUA functions to process input and calls LUA functions to do the drawing (which calls C functions in turn).
Love2d is a C++ program that kickstarts a lua program that gives back a frame callback. How it is implemented (See line 164 forward)
Then a LUA file is interpreted which handles default configuration, configuration loading, creation of callbacks and sets up the event handling/drawing loop.
From there an user redefinable loop takes over (here returned):
function love.run() if love.load then love.load(love.arg.parseGameArguments(arg), arg) end -- We don't want the first frame's dt to -- include time taken by love.load. if love.timer then love.timer.step() end local dt = 0 -- Main loop time. return function() -- Process events. if love.event then love.event.pump() for name, a,b,c,d,e,f in love.event.poll() do if name == "quit" then if not love.quit or not love.quit() then return a or 0 end end love.handlers[name](a,b,c,d,e,f) end end -- Update dt, as we'll be passing it to update if love.timer then dt = love.timer.step() end -- Call update and draw if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled if love.graphics and love.graphics.isActive() then love.graphics.origin() love.graphics.clear(love.graphics.getBackgroundColor()) if love.draw then love.draw() end love.graphics.present() end if love.timer then love.timer.sleep(0.001) end end end
Since LUA is more similar than different in programming style to Julia and both are embeddedable in C. I think it i can serve as an good inspiration to make a 2d gaming engine available.
Here are a few reasons why i think Julia would profit from such software:
- It is great for hackish or interactive visualization and demonstration
- It exposes Julias numerical performance to people working in a performance sensitive industry (Game development)
- It might yield insights into how the Julia GC can be modified to archive lower latency (if that is a problem)
- It gives a platform to ship a certain family of GUI applications in a cross platform manner
- It would make for a great (self) teaching tool in my experience and might motivate younger people to take a look at Julia for their early hobbyist game development
Sadly i am currently in no position to spearhead the effort myself. Although i might comeback to it in a year or so if nothing has moved in this direction.
I hope some finds that idea worthwhile and picks a good name.
Love choose to depend on the following libraries:
SDL2 OpenGL 2.1+ / OpenGL ES 2+ OpenAL Lua / LuaJIT / LLVM-lua FreeType PhysicsFS ModPlug mpg123 Vorbisfile Theora
I am sure the implementation can differ from their choices and modify their interface to do more clever stuff with multiple dispatch.
If there is an library which does something similar please let me know. If you find this idea stupid or would be interested please comment.