Internal Architecture Improvements

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
alxs
Prole
Posts: 31
Joined: Fri Feb 29, 2008 5:22 pm

Internal Architecture Improvements

Post by alxs »

Since some people don't like me "hijacking" the Features thread, with your permission I'll create a new one.

I want this thread to be a place of discussion of _internal_ mechanics and improvements for the Love Machine (AKA the Love Engine). It is also a good idea to clearly state architectural decisions here before we forget and start asking “why the heck we did it this way???”.

Currently I am working on the new project structure to be (hopefully) more logical, clean and allowing more hacks from all project members. I rewrite it from scratch because I believe that in the current state it is wiser to do so than to tweak it by little incremental steps. I also want to stress one more time my good intentions, I certainly not hijacking anything and the final word is always Rude’s.

So, to business.

Here are some of the things I came up with:
1. General project directory structure
common – most commonly used, usually quite independent stuff
drivers – a set of modules to implement interfaces with other systems, like Video, Audio, Input, etc. The user must be able to select any driver from CFG file at run-time. So you will have complete freedom what to use - DirectX or OpenGL or something else.
game – a set of classes, related to game support, such as the main Game class, etc.
lua – lua source code and a wrapper. I made a decision (that can be easily changed) to incorporate Lua into EXE file, not to use it as DLL. a) there are lots of DLL’s already, b) it will be slightly faster, c) it will be smaller and d) if the Lua is updated you would have to recompile DLL anyway.
platform – this is where all the system-dependent stuff is (also, probably, in drivers). Under this folder there are folders for each platform – Windows, Linux, etc.
This structure of course is not fixed. Any ideas are welcomed.

2. There will be one main “love” object and most inter-module communications will go through it. Each platform must initialize this pointer with system-specific implementation of the abstract class Love. For example WinLove is the class, inherited from Love to implement windows-specific application functionality, like HWND, etc.

3. About files – how I see it. There is a folder with all the game packages (.love). It is read-only; we should not mess with developer’s archives. But there should be additional folder, called “save” or “saved games” where there is one file per each game (like “gamename.save”) that holds the current state of the game.

4. About how to organize graphics drawing – I think it is best to be left for each driver. One driver may use SDL to draw shapes, another may use my approach of drawing everything manually in a buffer and then flushing it to video memory. I believe it will be more flexible. Another example – one driver may use standard Windows messages for input, another – DirectX, another – something else. We may even consider creating these drivers (or plug-ins) as DLL’s. Because one of the problems of such kind of engines is that in non-trivial games there is always some non-standard functionality that is missing or too slow to be done in scripts. It would be nice to allow users to extend Love with plug-ins.

Enough for now :)

What are you ideas?
Alex
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Love 1.0 (previously known as LOVE 2 :)

Post by rude »

Now, alxs, we're talking 8-). There are several things I am glad to see here.
    • Drivers seems like a good idea.
    • Not sure what you want in common. Try to use files from LÖVE < 1.0 as examples.
    • Where do you intend to put abstract classes ("driver" interfaces)?
    • If it is faster to include the Lua source, then it sounds like a good idea. Why is it faster, though?
    • Platform sounds like drivers all over again. What is the difference? Edit: never mind. I think I get it. Not sure how needed this is, though.
    • Game ... what would you have here except the main Game class?
    • Been there, done that, didn't work too well. You were right about creating unnecessary classes, I probably do that a lot. Things are much smoother with global devices and some globals functions instead of a "Core" class.
    • .love files should be where the user wants them to be. Be it C:\Program Files\LOVE\games, or /etc/random/stuff/games. People should be able to just click on them. ^^
    • We've been talking about a "save folder" for a long time, but it will probably be up to the user to manage the saves. (It's simple enough to serialize Lua code, but harder to restore the internal pointers. Feel free to implement it, though 8-). )
    • I've thought about implementing the "drivers", as you call them, as dynamic libraries, but I didn't consider it that important (yet).
    • Plug-ins: good idea.
alxs wrote: Love Machine
:D Excellent. LÖVE [virtual] Machine. Puns are truly endless.
alxs wrote: I rewrite it from scratch ...
Okay, one more time: copying your code isn't really interesting for us. I understand that you do not want to tweak the existing source, but just remember that what you're doing will not likely be used. Architectural suggestions are very welcome ^^, but we don't want the job done for us.

alxs wrote: ... and the final word is always Rude’s.
Note that although the final word may be mine, Mike always gets a say. Moreover, if Mike is very persistent about something, he may suddenly take command of The Final Word®.

Speaking of which: Mike, you're up. You really hated the last time we tried to separate things into folders, surely you must have an opinion? *monocle*, *tea*, etc.

Oh, it's on. It's oohwn.
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Love 1.0 (previously known as LOVE 2 :)

Post by rude »

Forgot this:
I want this thread to be a place of discussion of _internal_ mechanics and improvements for the Love Machine (AKA the Love Engine).
In that case, how about renaming this thread to something more appropriate? It looks like another "Future Features"-thread.

"LOVE architecture"
"LOVE internal architecture"

Or something similar.
User avatar
alxs
Prole
Posts: 31
Joined: Fri Feb 29, 2008 5:22 pm

Re: Love 1.0 (previously known as LOVE 2 :)

Post by alxs »

rude wrote:Not sure what you want in common. Try to use files from LÖVE < 1.0 as examples.
You know, all the common stuff, like math, etc...
rude wrote:Where do you intend to put abstract classes ("driver" interfaces)?
Not sure... Maybe also in dirvers :)
I see it so far like hierarchy of Driver => VideoDriver, SoundDriver, InputDriver, FormatDriver (to load resources of various formats) => Implementation classes.
rude wrote:If it is faster to include the Lua source, then it sounds like a good idea. Why is it faster, though?
Well, DLL calls are a little bit slower...
rude wrote:Platform sounds like drivers all over again.
No, there is a difference. Platform deals with stuff like "main()" or "WinMain()", basic initializations, main loop. Drivers are stand-alone modules to deal with concrete, isolated things.
rude wrote:Game ... what would you have here except the main Game class? [/list]
Don't know yet :)
Resource management?
rude wrote:Been there, done that, didn't work too well. You were right about creating unnecessary classes, I probably do that a lot. Things are much smoother with global devices and some globals functions instead of a "Core" class.
Yeap, you got it right, you just didn't get my idea completely :)
The Love class will be VERY simple, not all-in-one universal for everything... Just a connector.
rude wrote:.love files should be where the user wants them to be.
Hm... On one hand - I understand. On the other - shouldn't we use PhysFS logic of protecting file system from malicious code? Need to think more about it...
rude wrote:I've thought about implementing the "drivers", as you call them, as dynamic libraries, but I didn't consider it that important (yet).
Plug-ins: good idea.
We can leave it for version 2.0.
rude wrote:Okay, one more time: copying your code isn't really interesting for us. I understand that you do not want to tweak the existing source, but just remember that what you're doing will not likely be used. Architectural suggestions are very welcome ^^, but we don't want the job done for us.
Now I feel offended somehow :(
Isn't the whole purpose of OpenSource - collaboration? Creating great things by combined effort? Is my code somehow bad? I am upset... I want to contibute to Love engine, make it trully the best 2D engine in the world, and now you say I can't write code for it???
Alex
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Love 1.0 (previously known as LOVE 2 :)

Post by rude »

Will get back to this later today. Need to do some school-stuff.
User avatar
alxs
Prole
Posts: 31
Joined: Fri Feb 29, 2008 5:22 pm

Re: Love 1.0 (previously known as LOVE 2 :)

Post by alxs »

Probably I misused the phrase "rewrite from scratch".

I didn't mean - throw away your code completely and replace it with mine.

I meant to rewrite from scratch the basic project structure. After that we can continue, integrate your SDL and other code in the form of drivers and continue developing it... The effort is to standardize interfaces.

There will be plenty of work, don't worry. The only problem may be - I have a lot more free time than you, guys, and if I work on something I usually work fast.
But I have other projects as well and will go on LOVE-Vacations from time to time...
Alex
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Love 1.0 (previously known as LOVE 2 :)

Post by rude »

alxs wrote: Now I feel offended somehow :(
Isn't the whole purpose of OpenSource - collaboration? Creating great things by combined effort? Is my code somehow bad? I am upset... I want to contibute to Love engine, make it trully the best 2D engine in the world, and now you say I can't write code for it???
Yeah, we're egoistical bastards :twisted:. I'm not saying that you can't write code for it, I'm saying that you're randomly putting a lot of energy into doing something that neither me or Mike feel is needed. Just saying "no" after all your hard work would really suck, right? That said, I do not claim to fully understand exactly what you want to reorganize, as what you have presented yet seems to be pretty similar to what we already have.

There will come a time when restructuring will be needed again. That time is not now. (^.^)/
User avatar
alxs
Prole
Posts: 31
Joined: Fri Feb 29, 2008 5:22 pm

Re: Love 1.0 (previously known as LOVE 2 :)

Post by alxs »

Nnnnice...
Alex
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Love 1.0 (previously known as LOVE 2 :)

Post by rude »

That was unusually short? :D
User avatar
alxs
Prole
Posts: 31
Joined: Fri Feb 29, 2008 5:22 pm

Re: Love 1.0 (previously known as LOVE 2 :)

Post by alxs »

Well, shit, what else can I say?
Alex
Locked

Who is online

Users browsing this forum: No registered users and 0 guests