Design advice for strategy/RPG game

Hello forum, I’m new here. Was doing java development a number of years ago but has been out of it for too long and I’m now considering to start a little game project to get back in.

The plan is a turn-based strategy game with some RPG elements. You manage a smaller group with skills & personalities. There will be lots of items and resources. A lot of the challenge will be resource management and time management for your characters.

The game will be 2d and most things happen through selecting different options in events, moving around inventory and setting tasks to be completed. There will actually not be much graphics at all to begin with, I’m planning on using the Netbeans GUI builder to get most of the interface done

But there will be a lot of detailed simulation going on. You should have different tasks available to choose for your characters, for example to build something, but this will require tools, materials, skills etc. It all fits quite well into a nice OO structure with inheritance from less specialized object types etc.

But with my rusty java skills I’m still a bit confused about how to best go about this. For example, there will be a lot of possible tasks to do, but the selection needs to be limited based on character skills, tools available, raw materials etc. Some tasks will be unique, some can be repeated but they will all have different criteria for being selectable or not. What is the best approach here, do I keep task objects in a big list to iterate over every turn and ask each object if they are “selectable” based on the current world state or is there a smarter way?

The task selection is a good example of a problem that is coming up a lot in my design. I basically want to handle groups of object based on their properties (which could also change), but not have to keep the full objects in memory. Using a SQL backend would go a long way to help with the selection, but would introduce a few other complications and might be a bit overkill if there is a better way to do this.

I would be grateful for any general advice or pointers to similar examples.

How many of these objects are we talking about? Dozens? Thousands?

Let’s assume 100-200.

That’s nothing. Just keep them in memory, or at least the relevant properties (images I suppose you could lazily load), and iterate over them every turn.

Well, with the wide variety of tasks you want, and the completely free allocation of requirements for them to be available, at first glance you’ll be stuck at iterating through a list of all of them and check each one for availability.

I’d probably divide the tasks into a few lists. One with tasks that require item-stock or something that changes all the time, and a list with the ones that only change with skill-availability. The latter one will only be iterated through when a change in chosen skills happens e.g. when a character has levelled up and has chooses a new, or upgrades an existing, skill.

It really depends on how many tasks you’re going to end up with. Iterating through 200 tasks won’t take any time at all, and as long as you make sure it doesn’t have to run through the entire availability-validation algorithm every time you should be fine even with thousands, but make it able to stop whenever it finds a reason why the tasks should NOT be available. If you end up with, like 15000 tasks, you should probably think up some system of dividing them into separate lists, otherwise I wouldn’t worry about it.

Thanks, you are right of course that the iteration model should be fine here. Even if I have to iterate again for each object to check against a number of properties the check will not be that heavy. This will also give me the best flexibility to handle any special cases.

You’re talking about a turn based game? Even if it took milliseconds to complete the task, would that even be a problem? Would any of your players complete a turn that quickly, even with animations turned off?

Most of the calculations and updates of things to display in the GUI cannot be done until the player clicks “end turn” button. Of course I want to minimize the waiting time between turns, but as you say we are not really talking about noticeable differences so yes I was probably overengineering it.

I expect the amount of objects & calculations to grow over time if I keep working on the game and expand it further, especially with easy things like adding more items, so I was afraid I would lock myself into a design that would at some point limit the expansion possibilities.

Looking at you planed gamedesign, you will not run into any performance problems.
Its really the least of your problems.

A special case goes to how the AI is contructed.
And I mean not a simple statemachine, but AI Agents with some massive planning and search strategies.

But event then, its only going to impact realtime strategy games.
in a turnbased game you can arrange everything pretty unoptimized. (even a500ms delay to calculate a turn will not bother any player here)

Choose a system wich is easiest to implement, extend and not loos oversight of. Dont bother about logic performance in this gametype.
Its not going to determine if the game is good or bad.

At the beginning after the user has chosen their starting skills or whatever you could iterate over your list of tasks, and add the ones that are available to a separate list, then you can display the contents of this list as the available tasks.

Then everytime, the user levels up, or a new skill is chosen, or gains more materials, you simply re-run the method containing the iterate code.