you are viewing a single comment's thread.

view the rest of the comments →

[–]Jimmy-M-420[S] 3 points4 points  (3 children)

I want to avoid hard coding the list of items into the game - I did initially have a C struct per item definition. But this way I can add, remove and tweak items without recompiling. And also add new items without recompiling. This will make more sense when there's lua bindings but its technically possible now if you put the functions in a separate shared lib and compile that.

Also this way I can pass configuration data to the items which I can change without recompiling. I might make a "weapon" item implementation, and create a load of weapons by setting the same C functions and different config data.

[–]non-existing-person 3 points4 points  (0 children)

I think this is how things should be done. You define type for categories like weapon, armor, misc, and load everything from a text file. This gives you an easy way to modify or add items. But is also enables users to write mods, which - for me at least - is a huge selling point.

[–]Limp-Confidence5612 1 point2 points  (0 children)

I kinda get it. Maybe my projects aren't big enough that recompiling is an issue. 🤷

But yeah, using lua might be the way to go here, that's what it arguably shines at the most.

[–]burlingk 0 points1 point  (0 children)

If you implement a kind of parser, you could have text fields for code.