In the jMonkeyEngine 3.0 Beginner’s Guide, page 84 - 86 has the description of what it wants the reader to do at the end of Chapter 3 for the tutorial game.
It says “The constructor takes the GamePlayAppState object instance as an argument because the towers need access to the list of creeps and the beam_node object.” It then a few lines down says “It iterates over the ArrayList of creep objects that it gets from the GamePlayAppState objcect…”
The problem is that the book does not describe where the ArrayList comes from, and how I am supposed to access it. None of the documentation I have read on the AppState objects indicate that they have any sort of automated arrays, but the tutorial is worded as to indicate that such a thing exists and it has not instructed me on how to create it.
I have figured out how to move forward with a workaround, but I am not sure that the way I am doing it is the right way or not.
An ArrayList is a simple object that exists in the Java core, you can make one at any time. The book can’t really explain everything about Java programming so if something seems new to you maybe check the web to see if its a more basic thing.
The problem I was running into was not a basic Java problem. It was a confusing spec problem.
The page was worded as if there was a built in function doing what it wanted (there was not). What had to be done depended on features of Node, and NOT features of an AppState. The spec said we needed the AppState object to get the list that IT provided.
Looking at the Documentation, I was able to find that there is a getChildren() method on Node (not AbstractAppState), but spent another day or two searching for the “right” way to do it, because I was sure that the book I had spent fifty dollars on would not send me on a wild goose chase.
All in all though, the book is still awesome. It just has a few quirks that need ironing out in future editions. I am at the end of Chapter 3, and have only encountered two issues that could bee seen as “boneheaded mistakes,” and as tech books go that is a pretty good record so far.
The point of the text you quoted is that you can access an AppState (and anything you coded into it) quite easily and that you should thus should put central code into AppStates. Its not so much about what the code in an AppState can do, which is about anything you can imagine. These questions on how to connect code in Controls, the Application and AppStates come up quite often here and I guess somebody wondering about these things would read an answer to these questions instead of attributing the features of the example to AppStates in general. But as you say, technical concepts are sometimes hard to put into words in a sensible sequence and form.