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

res.cpp: Extract data into XML file #150

Open
OnlineCop opened this issue Aug 24, 2022 · 3 comments
Open

res.cpp: Extract data into XML file #150

OnlineCop opened this issue Aug 24, 2022 · 3 comments

Comments

@OnlineCop
Copy link
Owner

While (still) poring over eResistance and other recent changes, I've found quite a few bugs (yay!). Having a giant wall of data in res.cpp isn't ideal, however.

If I were to move these into the data folder as an XML, it should have an added advantage of allowing the stats to be hot-reloaded via Lua, so we can test that things like spells and elemental attacks are doing what they're supposed to.

If anyone sees disadvantages/cons to this, let's discuss. Otherwise, I think I'll start this migration process.

@pedro-w
Copy link
Contributor

pedro-w commented Aug 24, 2022

Just as a reminder, in the JB days, all the data written as C code was in res.c, then we extracted it into the csv data files (in other/) to edit with a spreadsheet, and generated code from the data, then we went onto editing the code directly, now we're back to data. I agree being able to 'hot reload' would be an advantage.

On XML - will a giant wall of XML be easier to edit? (maybe there is a graphical XML editor out there, I don't know)
The only other alternative I can think of (short of adding in a dependency for a JSON parser) are to use Lua files as data (LSON, if you will) as Lua's literal object syntax is just as good as Javascript's.

@z9484
Copy link
Collaborator

z9484 commented Aug 25, 2022

I think lua might be nice as specialitems and items are already in global.lua just not their stats.

@OnlineCop
Copy link
Owner Author

I usually haven't done much Lua programming (it warps my brain), but I'm happy to move everything to Lua-based.

Pros:

Cons:

  • Large refactor.
  • Have to move the logic of how items work, both inside and outside of battle, to Lua as well.

If moved to a different data format (JSON, XML, csv, etc.) instead, we might still be able to write a Lua wrapper to ingest it, which should allow us to hot-reload the data (no recompile).

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

3 participants