Advice to structure directory for game and editor

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
greycoder
Prole
Posts: 2
Joined: Sat Jul 14, 2018 7:20 pm

Advice to structure directory for game and editor

Post 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 :(
User avatar
Sir_Silver
Party member
Posts: 286
Joined: Mon Aug 22, 2016 2:25 pm
Contact:

Re: Advice to structure directory for game and editor

Post by Sir_Silver »

Image
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Advice to structure directory for game and editor

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests