@Thales, right, you haven't mentioned your profiler results. You have a lot of robust profiling options with Java so that should be your first step.
Regarding 50 actors at 20 updates a second, yes, that is too slow. You should get at least 40 updates a second (with rendering, animation, etc.) with no problem, especially with Java, which is relatively fast.
Yes well to be honest Eclipse seems to have its own profiling system. I've tried getting the profiler to work but I didn't manage to do so as of yet (I've never done this before), what little information I found on the internet didn't work for me. I must have been doing something wrong but I don't know what, the profiler kept ending up without any data.
That is neither a yes nor a no; I can't really deduce anything from that statement.
What I mean is that regardless of whether or not your 50 actors need to be updating more than 20 times per second (they may, but it depends on the game) your program should easily be capable of performing twice that. The fact that it struggles to do so suggests a problem exists somewhere. I can't offer a good suggestion because I don't know enough about your code to say where the problem lies.
This data wasn't calculated from my entire game loop. I implemented my own little debugger system, and I calculated the time taken for each piece of the game loop independently. Input checking and rendering were next to none. These numbers you're talking about were calculated from the logic update independently, so I don't understand how the problem could lie elsewhere.
Also, since this is a turn-based game, the game spends most of its time doing nothing, and checking the player's input.
I think you might utilize this. Most of the actors who do not actually interact with the player (for a simple example, all those outside of player's FOV) may be calculated in advance while waiting for the player's input, from closest to player to farthest. The main idea is to calculate as much as possible during the time game has nothing else to do.
This will increase game engine/logic complexity. There must be some way to check if precalculated move conflicts with actual state. Game data must support some level of parallelism. However, this approach can make an impression of all the actors being handled.
That's a great idea, thank you. The decision on what move to make for each character is a little object of its own making it perfectly manageable to check those conflicts even after I expand my action possibilities.
This list of actors is sorted by their action value. The first actor in the list is always the next one to make a move, and each time an actor executes his move, his action value is increased by a certain amount, depending on the cost of the move, and he is re-entered in the list.
Does it have to be this complex? I'm using a power value for each creature, increasing it each turn and when it's full the creature can make the move. If it's not, the creature is skipped. I don't know what is the idea in sorting the list. Why would you need to do that?
No I don't have to do it this way at all. It's simply the first thing I thought of. I don't see why you would consider it complex though, it kinda reminds me of the FFX battle system: next guy to make a move does his thing, then he moves up the list, repeat.
The priority queue, according to oracle, should be optimized to poll for the next element in the list, as well as sorting an already nearly sorted list, so I took that and went with it. Correct me if I'm wrong, but what you're suggesting here is that the sorting procedure specifically is taking the most time? I was planning to check up on that, so I'll get back to you on that.
I suppose I could use that power value idea, or more specifically, I'd do the opposite, decrease it each turn and make a move when zero, that way I can easily account for actions taking in different amounts of time. I'd have to change the way the game waits for the player to make a move though. As it is now, since there's only one actor event active at any given time, the player's event is simply an extension of the normal actor event that suspends its execution until the player has decided on his move.