Auto Calculated Combat how to?

Hi dear community,

I'm trying to find or create my self but without success a Auto Battle System.
where player have 1320 Unity's and enemy 1180.
To calculate who is winner in this battle?

Or trying to make Battle in 3 waves lets say, with 900 Unity's, but slashed on 3 Army's every wave attacking with 300 Unity's.
🤔


ps. I'm sry for bad title.
 
I don't know what Ogame is, and not everyone here will, so I think it's best for us if you tell us what exactly you want rather than referencing another game, especially since such a system could be way too grand to be answered in a mere thread. Start by thinking about what the core concepts behind the system are, and then word them to us what you're struggling with, because if you're just looking for someone to give you an entire system, you're not going to get it.
 
I don't know what Ogame is, and not everyone here will, so I think it's best for us if you tell us what exactly you want rather than referencing another game, especially since such a system could be way too grand to be answered in a mere thread. Start by thinking about what the core concepts behind the system are, and then word them to us what you're struggling with, because if you're just looking for someone to give you an entire system, you're not going to get it.
I'm not here to just take someone's credit, but some pointers. :rolleyes:
It doesn't need to be that game, it can be any auto combat strategy game.

It's more like Combat. As I said, you have like Unity's or Fleets, the bigger unity is (in numbers) bigger chance you have to win against enemy fleet.
Of course we could put some stats for every unit in stacked Fleet, like Attacking power and Health, etc.
 
I know you're not wanting to pretend you did the work, what I meant is that your question has such a vague starting point that pretty much suggests you're looking for a lot to get this system up and running.

Write up the list of stats that will be needed with both parties. Depending on the complexity desired, you could start by comparing the different values between the two and seeing who has more points, and maybe toss in a little randomness to potentially skew the results.
 

FrostyCat

Member
The only pointer I can give is to learn basic programming BEFORE trying to program any sort of game. I hate instructors who advertise so-called "game design" courses without mandating programming experience, no less than I pity students green enough to believe it.

There is no such thing as "auto-combat" to a computer. There are only such things as numbers to compute and the steps that YOU as a programmer give to it. Write down the rules for what inputs are involved, what numbers need to be calculated, and what are the procedures for deciding a winner. Then implement it in code.

An example of a very simple system:
GML:
function simulate_combat(unitsA, powerA, unitsB, powerB) {
    var result = [unitsA, unitsB];
    repeat (min(unitsA, unitsB)) {
        var rollA = irandom_range(1, powerA);
        var rollB = irandom_range(1, powerB);
        if (rollA < rollB) {
            --result[0];
        } else if (rollA > rollB) {
            --result[1];
        }
    }
    return result;
}
GML:
var battle_result = simulate_combat(500, 5, 600, 4);
show_message("Army A has " + string(battle_result[0]) + " units left.\nArmy B has " + string(battle_result[1]) + " units left.");
 
On top of what has been said already, there's many ways game programmers achieve this. Take Civilization, for example. In the old ones, if you had "quick combat" enabled, it would just end up being a dice roll, weighted with stats units (like Frostycat's example).
Some games, like modern sports games (EA's NHL and the such) often use actual simulation nowadays when you make them go automatically (that's why you can interrupt a simulation to play the rest of the game).
This can go anywhere from very simple to very complicated.
It all depends on what you want to do.
 
Top