Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Noodle - Game Framework  (Read 3817 times)

0 Members and 1 Guest are viewing this topic.

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Noodle - Game Framework
« on: June 15, 2014, 06:09:06 pm »
Hi community !

I'm starting a new project that I would like to share with you.

Noodle

Noodle is/will be a game framework in C++/Lua. It's inspired by my Potato framework (itself very strongly inspired by SFML Game Development Book) but I planned some improvement.

Features

So this framework will contain, more or less :
- Windowing + Rendering
- Resources
- Events
- Screens / Game States
- Entity/Components
- Simple GUI
- Animations
- Particles
- Json + Json serialization

Goals

The goal is to have a strong "engine" in C++ completely binded to Lua, so that when you develop a game you just write Lua.
Bind some SFML features to Lua.
To be able to copy/paste an executable and then just change Lua code to make a new game.

There's a lot of work to do, the most of it will be done when I need it (SFML Jam here  come). I also encourage you to fork/issue/participate anyhow, you will be welcomed :)


Inspirations - Other libs

So it's philosophically inspired by LÖVE (a lot) somehow.
It's also inspired by some of your libs like Thor, Featherkit, etc. but I don't know yet if I can bind them directly to Lua.

I use Selene as Lua C++11 wrapper, even if I have trouble with static methods...

Examples

What the Lua code looks like at the moment  - main.lua

local Noodle = require("scripts/Noodle/noodle");

function Init()
        Noodle.Application.setWindowTitle("It Works !");

        print("Init function called");
end

function Step(dtInSeconds)
        --print("Step "..dtInSeconds);
        if Noodle.Mouse.isButtonPressed(Noodle.Mouse.Button.Left) then
                print("Left Mouse Button pressed {".. Noodle.Mouse.x() .." ; ".. Noodle.Mouse.y() .." }");
        end
end

function Render()

end

function Quit()
        print("Goodbye !");
end

There are three mandatory functions/hooks : Init() , Step(..) and Render() and some facultative ones. These hooks are parsed once and then directly called by C++.
C++ and Lua classes are indistinctly accessible through the Noodle Lua table.

Links

Noodle GitHub Repo (check de dev branch)
Potato-framework GitHub Repo

Ricky

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
    • Tejada
    • Email
Re: Noodle - Game Framework
« Reply #1 on: June 15, 2014, 06:58:20 pm »
I'm doing something similar but I went with XML for serializing entity types instead of JSON simply because all the libs I found to interface with JSON were crappy or had some crappy build system that I didn't want to waste time figuring out. That said, pugi xml is soooo sexy.
Wilt thou yet say before him that slayeth thee, I am God? but thou shalt be a man, and no God, in the hand of him that slayeth thee.

Xornand

  • Jr. Member
  • **
  • Posts: 78
  • C++ / Python
    • View Profile
Re: Noodle - Game Framework
« Reply #2 on: June 15, 2014, 07:15:13 pm »
Sounds interesting. How much of the C++ implementation are you planning to expose to Lua and how will you deal with Lua to C++ overhead when passing data back and forth?

Also, good choice on Selene. I found out about that library recently and it seems very clean and simple. If I hadn't already gone for LuaPlus with my engine some months ago, I would have definitely picked that one instead.
« Last Edit: June 15, 2014, 07:19:14 pm by Xornand »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Noodle - Game Framework
« Reply #3 on: June 15, 2014, 07:30:49 pm »
... I went with XML for serializing entity types instead of JSON simply because all the libs I found to interface with JSON were crappy or had some crappy build system ...
Take a look at PicoJSON. It's just a single header file, so no build systems to figure out etc. It's extremely simple to use and works well - I use it for my own projects and love it :)

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: Noodle - Game Framework
« Reply #4 on: June 15, 2014, 08:01:24 pm »
Sounds interesting. How much of the C++ implementation are you planning to expose to Lua and how will you deal with Lua to C++ overhead when passing data back and forth?

I will expose everything I need to be able to use Lua only, I don't know how I can explicit this more :) SFML Drawing sprites/shapes should be accessible, entity/components, etc. The idea is to have base classes in C++ (ie: few components like render, sound, etc.) and then derive them with Lua and extending them with hooks.

So the goal is to have the least back and forth between C++ and Lua, the plan is to load Lua hooks in C++ once and use these hooks directly (since I can pass a Lua function to a C++11 std::function). So the heavy part is the loading part, but then a lot of things will be converted to C++ primitives. (not everything, but whenever possible)
Plus you can use compiled Lua.
So I don't think there will be performances issues for a 2D game at 60fps. Klei studios used the same kind of engine to make Don't Starve but way more complicated and complete, and there is no performance issues.


Json :

I use Json on the Lua side so I didn't had to care about a C++ lib here but QtJson is pretty neat. I don't know about PicoJSON but there are a lot of good libs for that :)
XML is not handy IMO, and since Lua table syntax is really close to Json, it was a natural choice.
« Last Edit: June 15, 2014, 08:03:29 pm by Lo-X »

 

anything