Java and 3D Meshes. And Database advice

Ok, so I have two questions, one about 3D meshes and java, and the other is about using databases for games.

Right so, first one. If i was to create an object/mesh in Blender3D, is there a java library, or a way for me to use this mesh with my java code. Like, how could i create a 3D world using 3D objects and java code, or would be better to stick to a game engine like Unity and learn C#?

Next question, if i was to have an RPG would it be better for me to create a database which stores weapon stats, shop locations, building locations, user details and stats, and can then be updated when anything changes, or is it better for me to save them to a txt file and read it everytime I try to get user data?

Also, would using a database, not set it up, so that i could turn the RPG into an online one?

First question: Sure.


Second question:

What’s the difference between saving to a “txt” file and using a database?

Nothing, essentially - well, that’s not entirely accurate - but they fulfill a similar basic purpose. Storing data for loading later and storing data for later that we don’t need right now so as to save RAM.

Databases come with a lot of useful stuff, however. You can deny or grant access to specific data. You can quickly search and or modify specific data. You can make the database available remotely etc etc.

There is no right or wrong answer - what do you think?

Well for the database, the remote database, and the quick searching might come in handy with a rpg, because as the game gets updated, all i have to do is insert new fields into the database, and therefore, means less time for users to download the client files, however it also means they need to connect to the internet to play a singleplayer game, which some may not like, unless i was to give them an option of online/offline play with online granting them some other benefits.

Thank you for the answer :slight_smile:

For the database bit, it sounds to me that there are actually two parts to that question:

  1. how to implement ‘static’ configuration data, i.e. your weapon stats, shop locations, etc.

  2. how to implement ‘dynamic’ data, i.e. user location and data.

For the static stuff you could use a simple text or properties file. You might also want to consider using XML which is nicely structured and there are any number of supporting libraries to parse it. Although this is ‘data’ it doesn’t change (for the duration of the game) so there doesn’t seem much point in storing this stuff in a database.

For dynamic data then you would definitely want to persist this to some sort of database: you could use a standard SQL database such as MySQL, or use an object-based persistence store such as Mongo. The latter is probably a better approach for an online RPG style game.

Depending on the load (number of players, volume of network messages, etc) you would probably want to periodically update the database with changes to relatively transient information such as the players stats, location, etc. whereas ‘important’ changes (kills, inventory changes, money, etc) should be persisted immediately. This is how many MMOs are implemented.

So what your saying for player position etc, they can be sent every second or slower perhaps, but kills etc, should be instantly updated?

Absolutely. As a player (and especially if you’re a paying customer) you’re going to be REALLY mad if you lose an inventory item for example because the server crashed, whereas you’re not going to be too concerned if you’re a few yards away from where you were meant to be.

Understood, thanks for all the help guys, gives me a lot to think about and look into, and learn.