Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change modding system #3

Open
Rorkh opened this issue Aug 1, 2023 · 1 comment
Open

Change modding system #3

Rorkh opened this issue Aug 1, 2023 · 1 comment

Comments

@Rorkh
Copy link
Contributor

Rorkh commented Aug 1, 2023

It's would be cool to have modding system similar to Cataclysm DDA game:

  • All mods have same structure (kindaa similar)
  • Base game data is in it's own mod (not similar :( )
  • Each mod loads it's own data (similar)

So I suggest to move data files into it's own mod (there will be no data folder, so make global variables for all data) and during mod load each supported file in each mod will merge it's return with global variable.
Like

-- Global data table
data = {achievements = {}}

-- Load mod with name 'name'
local function load_mod(name)
   -- List of file names to load from mod (all filenames that now in data folder)
   local files = {'achievements'}
   -- Load each file
   for _, part in ipairs(files)
      local path = 'mods/' .. name .. '/' .. part
     
      if love.filesystem.exists(path) then
         -- Get returned table from mod file
         local mod_data = require('mods/' .. name .. '/' .. part)
         for k, v in pairs(mod_data) do
            data[part][k] = v
         end
      end
   end
end

So core data as other mods will have same structure and loading will be simplified (because of unification), And it will be possible to delete core data because global variables for data containment will be created not in data files.
I can do PR for this but idk if there will be changes to data.

@vaughantay
Copy link
Owner

It's definitely an interesting idea, and it's giving me some ideas on how to change mods (which I admittedly haven't updated at all since Possession). I think making it so that they and the data files work in the same way is a good idea.
But I don't think we're quite able to do that to the degree you're talking about at this point without a bit of reworking how things work.

For one, there's some stuff in data/ that is pretty necessary regardless of game and that mods shouldn't necessarily need to have (the map layouts and AI come to mind), but those might be worth moving somewhere else.

Also, when making an actual game with this, you'll probably want there to be a core set of data it loads by default. But I can see how putting in a way to not load that data when there's a different mod to load may be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants