1

So, I want it to be very easy to create all the entities of my game and for other people to come in and do the same. I was thinking I could just let the users/myself create an XML sheet the stores all the properties of each block (Like a Terraria or Minecraft voxel) and add Lua scripts that are referenced in the XML for additional functionality of any of the blocks.

I'm starting to think It would just be easier to let the user create a JAR file full of classes for each block. And then that JAR file could easily be used to get all the blocks. It'd just be interesting to reference all the blocks by a block id without storing all the classes by ID. Or I could give each class a static id. But that's not important.

Okay, so my short question is what are the pros and cons of storing all the the different types of blocks as classes versus in an XML sheet with Lua for additional functionality?

UPDATE: It looks like I'll be using pure Lua! Looks like an interesting and effective way to do it!

4

1 回答 1

1

JAR 方法的一个限制是您的数据需要在使用之前进行编译。使用 XML/Lua,数据在运行时被读取/解释。

您没有提到的第三个选项是使用直接 Lua 表而不是 XML。这使您可以使用简单的“require”、“dofile”或类似的方式加载数据,而无需同时使用 XML 库。

于 2013-09-05T19:17:27.260 回答