Hi monkeys!
The game is freely available here: http://contest.rpgmakerweb.com/game/view/id/169
If I manage to win the contest, it is free advertisement for jMonkeyEngine, so you’re welcome to vote for me XD
This version of the game is little more than a programming exercise created in one month.
I’m not sure to have fully understood what is a Quaternion or an AppState, the code is UGLY and I plan to rewrite the whole thing from scratch (and reread some tutorial); but this version lays down the foundation of a bigger game that I plan to release in about one year.
I’ve tried to follow the JMonkey best practice and set all the properties of a Node with setUserData(), but with complex game systems it lead to a lot of bloat (or maybe I don’t know how to use it).
For example, how am I supposed to add an Inventory to a Node? How do I add custom logic properties to Items?
Really, I think the simplest way should be to use POJO and/or extend Nodes… but this is labeled as an antipattern.
So I ended up writing 90% of the code in a single class (and this is the reason for which I need to rewrite it).
What am I doing wrong?
Inventory sounds like a game object. This is a sign that you are mixing your visualization objects with your game objects. It’s nice for quick and dirty tests/prototypes but a real game should separate these two things.
This is exactly my point. But then, a game object can have a Spatial as a property, but now vice versa (from the best practices: “Use setUserData() to add custom attributes to Spatials”)
How do I get my game object from a Spatial? Example: two Spatials collide: how can I know which game objects are those referring to?
Should I keep an ID of the object and store it on a hashtable?
@Pesegato said:
This is exactly my point. But then, a game object can have a Spatial as a property, but now vice versa (from the best practices: "Use setUserData() to add custom attributes to Spatials")
How do I get my game object from a Spatial? Example: two Spatials collide: how can I know which game objects are those referring to?
Should I keep an ID of the object and store it on a hashtable?
s/Hashtable/HashMap… but yeah, that’s one way. You could also make it a field of a control… which often makes sense since you will likely be updating position, etc. from the game object to the spatial. Controls are well suited for that.