Page 1 of 1

Advice to structure directory for game and editor

Posted: Sat Jul 14, 2018 8:48 pm
by greycoder
Hi, I'm new to LOVE and game programming. Question how to organize better files in my case. There are standart game folders such as lib, assets etc but also I code editor to build map/scene. Editor uses some game files( same objects, classic, images etc) and it's better to place editor in the same repository as game(for developing). But because of package.path I can't just create editor folder inside root folder with own main and conf to run it with files from root folder without changing game files' require paths(class extending chain). It is preferable not to change game require paths(editor won't be in final version). Only solution I see is to copy same scripts inside editor folder (such as libs) and loadfile heavy files(such as images) from root :(

Re: Advice to structure directory for game and editor

Posted: Mon Jul 16, 2018 8:02 am
by Sir_Silver
Image

Re: Advice to structure directory for game and editor

Posted: Mon Jul 16, 2018 3:20 pm
by zorg
Let's try to tackle it chunk by chunk :D
greycoder wrote: Sat Jul 14, 2018 8:48 pm Hi, I'm new to LOVE and game programming.
Hi, and welcome to the forums!
greycoder wrote: Sat Jul 14, 2018 8:48 pm Question how to organize better files (in my case.)
There are many possibilities... also you haven't exactly presented your case yet.
greycoder wrote: Sat Jul 14, 2018 8:48 pm There are standart game folders such as lib, assets etc
Debatable on what is considered standard and what isn't; it depends on too many things, including game engine, operating system, etc. (for some DOS era games, you had GFX, SND, ANI, MUS, and similar folders only, no assets per-se... with specifically unreal engine games, those have their own folder structure...
greycoder wrote: Sat Jul 14, 2018 8:48 pm but also I code editor to build map/scene. Editor uses some game files( same objects, classic, images etc) and it's better to place editor in the same repository as game(for developing). But because of package.path I can't just create editor folder inside root folder with own main and conf to run it with files from root folder without changing game files' require paths(class extending chain). It is preferable not to change game require paths(editor won't be in final version). Only solution I see is to copy same scripts inside editor folder (such as libs) and loadfile heavy files(such as images) from root :(
There can be a few solutions to this; one glaring one, so that you don't duplicate any other file, since that is literal hell, would be to have some kind of gamestate system in your main.lua, that could act on commandline flags; if there's a "-editor" or "-debug" or whatever flag passed in, it would go to the editor gamestate instead of the default one.

Look at hump.gamestate, that's a nice enough library, and another benefit would be that your main.lua would be cleaner.