• Hello, Guest!
    Are you passionate about Tribal Wars 2 and like to help your fellow players?
    We currently have open positions for Forum Moderators!

    >> Join the Tribal Wars 2 Team now! <<
    We would love to hear from you!

Combat system

DeletedUser3731

Guest
Why is it that the troop deaths are evenly split up.
ie: 10,000 axemen attacking 10,000 swordmen 10,000 spearmen, and 10,000 archers behind a lvl 20 wall would get you -1248 swordsmen, spearmen, and archers.

My question is why in the hell are the spearmen even going in and are 33% of the axemen just chucking their axes at the archers up on the wall? How they hell are the archers dying.

Before each battle do they all just shake hand and 1/3 of each of the types of units stay while the other 2/3 give moral support from behind the wall?
They just get in lines and evenly split up the axemen into 1/3's?
What the hell xD

It should be like this (could use some fixing/help):
There are axemen, light cavalry, rams, and cats attacking swordsmen, archers , and trebuchets.
The trebs attack the rams.
The rams attack the wall.

The largest part of the attacking army (ie: axemen) gets attacked by the archers (maybe archer damage is increased based on wall level) then that part of the attacking group (ie: axemen) attacks the biggest defending group (ie: swordmen) until one side is wiped out (ie: axemen).
Then the archers (if the first largest army is now gone or smaller) attacks the current largest attackers group (ie: Light Cavalry).
Then the current largest attackers group attacks the current largest defending army group until one side is wiped out (ie: swordsmen).

And so on until either there are only rams or catapults on the attacker's side or there are no heavy cavalry, spearmen, or swordsmen on the defending side.

If there are no more attackings units on the attacker's side then the rams will be attacked by all the remaining defending troops. If the rams survive then they attack the wall again. Then the same thing happens for the catapults, all the defending army attacks the catapults and if the catapults survive then they attack the preselected building.
If there are no more defending units (not counting offensive units, archers, and any Hall of Orders)
then the attacking army will be attacked by any remaining offense and archers and by any berserkers.
If the attacking army wipes out all the defenders offense/archers/berserkers then it will plunder all resources then the catapults will catapult the preselected building.

Same thing if defense attacks offense/defense. The largest attacking group goes first (after rams) then everything get ran again.




I started to learn coding in september so go easy on my bad coding, point out errors if you can.
I just started making this code about an hour or so ago.

HTML:
// Start of Tribal wars 2 battle mechanics;
function start() {
   
    //START OF CHECK FOR, RAM && TREBUCHET && WALL;
    if(attacker > 0){
        if(ram > 0){
            if(trebuchet > 0){
                println("trebuchet killed " + "x" + " ram.");
                    if(ram > 0){
                        if(wall > 0){
                            println("ram attacks wall. wall loses " + "x" + " lvl and is now " + "x" + " lvl.");
                        }else{ //if(wall > 0){
                            println("no wall " + "x" + " return.");
                        } //}else{
                    }else{ //if(ram > 0){
                        println("no ram. wall is unchanged.");
                    } //}else{
            }else{ //if(trebuchet > 0){
                println("no trebuchet. ram is unchanged.");
            } //}else{
                if(ram > 0){
                    if(wall > 0){
                        println("ram attacks wall. wall loses " + "x" + " lvl and is now " + "x" + " lvl.");
                    }else{ //if(wall > 0){
                        println("no wall " + "x" + " return.");
                    } //}else{
                 } //if(ram > 0){
        }else{ //if(ram > 0){
            println("no ram. wall is unchanged.");
        } //}else{
    } //if(attacker > 0){
    //END OF CHECK FOR, RAM && TREBUCHET && WALL;
   
} //function start() {

//defender && attacker var;
    var defender = 1;
    var attacker = 1;
//defender units;  
    var spearmen = 500;
    var swordmen = 0;
    var archer = 400;
    var heavyCavalry = 0;
//attacker units;
    var axemen = 500;
    var lightCavlary = 0;
    var mountedArcher = 100;
    var ram = 10;
    var catapult = 1;
//Hall of Orders;
    var trebuchet = 5;
    var berserker = 0;
//wall
    var wall = 20

How can i make the + "x" + actually calculate? (ram - trebuchet = ramCurrent)?
then I replace x with ramCurrent?
 
Last edited by a staff member:

DeletedUser1323

Guest
You have several different questions all going on at the same time here. For a good reference on how the combat system works. https://en.forum.tribalwars2.com/index.php?threads/battle-simulator.3934/

That thread will explain the round system and I have already contributed to that thread pertinent information you are looking for. After reading that thread return and post unanswered questions in order so I can follow your logic and answer them in a way you will understand.
 

DeletedUser3731

Guest
I know it might be hard to understand LOL.

Let me break it down a bit, also my code is bad and ruff. Just learned how to and still bad at it. Doubt this 'code' would even work even if someone with skill revised it from the dead. Might try and finish it...

1: Trebs attack Rams.
2: Rams attack wall.
3: Archers attack attackers if there's a wall.
4: Attackers attack Defenders.
5: repeat 3-4 until either attackers have no longer have Light Cavalry, Axemen, Mounted Archers, and or Paladin.
Or defender no longer has Spearmen, Swordsmen, and or Heavy Cavalry.

Rules:
Archers can not defend if there is no wall.
Archers die if rams completely take down wall.

Trebuchet cannot be hurt until 5 is true.
Rams cannot be hurt after 1 until 5 is true.

Defending offense will not defend until 5 is true.
Attacking defense will not attack until 5 is true.

(Side note, possible rule: the largest part of the attacking army attacks the largest part of the defending army first until one group dies OR maybe until one group is no longer the largest group).
(Side not, possible rule: Archers can only attack once (to avoid friendly fire or maybe attackers get too close) and archer damage depends on wall level ie: height).
(I might of added/removed/modified some of the things I might of posted above due to hindsight).


My reasoning for this being a thing (with the help of the community and their tweaking) is because (and I'll say it again) How are 50 of 100 trebs going to die and 500 of 1000 spearmen going to die when the enemy only sent in 500 axemen.
 
Last edited by a staff member:

DeletedUser3731

Guest
P.S
Could a mod move this to 'Player Projects' or a more appropriate place.
 

DeletedUser3726

Guest
It is in the end just too complicated to be implemented I think. It add a lot of things to be taken into account before playing.

It's interesting, you should try something more simpler even if it lacks logic.
 

DeletedUser3731

Guest
It is in the end just too complicated to be implemented I think. It add a lot of things to be taken into account before playing.

It's interesting, you should try something more simpler even if it lacks logic.
Did you read the last post I made? The more simpler one.
 

DeletedUser1594

Guest
I'm confused, are you trying to re-write the battle code?
 

DeletedUser3731

Guest
Also I thought It made a lot of sense.
Trebuchet should get a chance to take out rams before they get the chance of taking a wall.
Then the archers should get a chance to thin the herd.
Then it would be fairer for the largest group (ie: axemen) to attack the largest defending group (ie: usually spearmen).
This way as a defender if you have more swordsmen they will defend first against the biggest enemy group.
Also if you decide to build 100% archers they could slaughter one whole group of soldiers (ie: 10,000 axemen) but this is not OP because they will only attack the first biggest group and if rams manage to break down the wall then it will kill all the archers that are on top of it. And the damage being multiplied by wall level makes sense because the higher an archer is the more damage they would probably be able to do.

Defending offense and Attacking defense going last makes a bunch of sense as well, this way you don't waste offense if you're defending and you mange to repel the attack without them getting into the castle.

It all makes sense to me. The code i made is probably crap but I don't see any logistical issues here. Maybe practical issue, might be hard to code or might be slower to process (I wouldn't know) so the devs shrug it off as too much work and keep the same system. I wouldn't know.

I'm confused, are you trying to re-write the battle code?
Well... I don't exactly know, i'm trying to give the community/devs an idea of what a new battle code should look like in my opinion. Ignore the code.... I just learned and wanted to see If I could write it out. figured code might be easier to understand than my chicken scratch text.

Also this system might be easier for calculators to be made out of. You would just do something like:
treb = t
ram = r
wall = w

r - t = r
w - r = w
I don't know, just trying to think of how it might be, I wouldn't know where to begin with writing out a calculator.
I'M THE IDEA PERSON NOT THE SMART WORKER.
 
Last edited by a staff member:

DeletedUser1594

Guest
I get it, but I don't think wasting your time trying to figure out how the battle should actually take place is worth the time you are going to waste unless you fully understand it won't get you anywhere. I'm sure when they originally thought of how the battle should take place they came up with a way that made sense to them, rewriting it would be a major overhaul and change the game completely.
 

DeletedUser3731

Guest
I didn't think the current battle system was very good. wall multiplies defense by 200% when it shouldn't... the wall should only lower cat damage or increase archer damage in my opinion.
What good is a wall going to do when you have to go outside it to defend. And if you wait for them to get in same deal.
Also the losses being divided evenly makes no sense, sure it's easy and is a quick fix. But it just feels lazy... trebs don't defend on the frontlines like a swordsmen.

Again this is just an idea for the community to make a better idea for the devs. I just have a bunch of ideas and no idea how to make them work.
 
Last edited by a staff member:

DeletedUser3833

Guest
Trebuchet should get a chance to take out rams before they get the chance of taking a wall.

Thats already the case, i dont think they will implement anything as complicated (altough more realistic) as this
 

DeletedUser3731

Guest
Really all i'm changing is the way deaths, archers, and wall works.
 

DeletedUser1323

Guest
Here is the main issue behind your logic. The way that the order of combat is set is by the total provisions for army composition. The way the deaths work is based on how the defence is set up. The attacker sets the order of combat. If you want more archers to do damage first have a heavy MA nuke.
There is nothing wrong with the current combat order for Trebs vs. Rams. It is called the pre-round. Now from there Rams get first shot with 50% of the rams with 1/4 of the axe/infantry. Then it goes by provisions so an even stacked nuke will fight at 100% of the percentage. a 7k axe 1750 LC 1400 MA (21k provisions) will all attack at 100% of 33% which is the total army composition. The deaths are based on attack power of the units based on the round defence value which is much easier to maintain.
Then the 50% surviving rams get a final round along with any catapults. The basis of the wall not crumbling to 0 in one shot is that is not realistic. Back in middle ages they would do the best to maintain as much of the wall in tact so the attacking army could have a place to hold. To match that type of realism they went for one stage to drop the wall to no lower than 10. Then from there the last round can decimate the wall as overkill. Which is why you see most armies composed of just enough rams to knock a few levels (3-10) to reduce the losses.
 

DeletedUser3731

Guest
A bunch of what you said @jehzir has nothing to do with anything I said.
I'm in favor of the 'pre-round' as you called it. I even suggested that not knowing about the current battle system.
I also don't care and didn't go into depth on any percentages or anything of the sort seeing as how I lack in that area of knowing what the heck you're talking about.
Also I did not say anything about wanting archers to do more damage. I suggested that maybe wall lvl would contribute to archer damage, ie: they would do more/less damage depending on wall lvl. Maybe they only fight at 100% with a lvl 10 wall and they don't get any more damage buff from a higher lvl wall. Also i suggested that destroying the wall would kill all the archers. This would be realistic seeing as how the archers are on top of the wall and falling 50 feet usually kills a man.
Also in my original comment I suggested that (as you said) Rams (if any survived and attackers win) would tear down the wall to 0 because 'why not'.

Also I was merely suggesting that largest group vs largest group goes first, if you think it should be based off provisions instead of numbers THEN COMMENT THAT.

I mean seriously. If you're not contributing and only tearing down my poor poor thread then just shut up. I didn't post this half done project asking for someone to say how bad it is.
Also i asked if a mod could move the thread a long time ago, obviously you read this entire thread and you didn't just read the first comment and immediately comment afterward... I mean who would do such a thing...

I'll say it as I say in most of my suggestions, if you don't have something constructive to say or any ideas on how to improve this, why do you need to reply?
 

DeletedUser3731

Guest
@jehzir Do you think this thread is about me asking how the current system works or something? your first comment kind of threw me off after re-reading it...
This is a suggestion on how a new battle system would work and i'm trying to get advice from the community on how to make it work and to get any details or suggestions on how things would work and if this is plausible.

And if some lovely smart person could sift thru my mess of a suggestion and break it down so people can understand it that would be great.
 

DeletedUser300

Guest
Well it doesn't makes sense imo that all archers should die if wall goes down, I mean imagine your an archer on a wall and the wall is going down, you'd get off right? It also could make perfect sense for archers to be on the ground, ever played total war? :p

I'm not here to bash your idea down but just saying killing all archers when wall goes down isn't realistic which you are seemingly trying to achieve.

On another note, wall shouldn't contribute to archer damage. Think about it, an archer will still hit a shard with an arrow if he stands on the wall or on the ground, he'll just dies less easier.

Another point is the level of realism your trying to achieve is impossible in a game like tw2 from a programmers view, also the current system is good enough for a game like tw2 ;)

I hope you can make sense of this post and can understand what maybe others are trying to say :)
 

DeletedUser1323

Guest
@jehzir Do you think this thread is about me asking how the current system works or something? your first comment kind of threw me off after re-reading it...
This is a suggestion on how a new battle system would work and i'm trying to get advice from the community on how to make it work and to get any details or suggestions on how things would work and if this is plausible.

And if some lovely smart person could sift thru my mess of a suggestion and break it down so people can understand it that would be great.
What I am telling you is the battle system is not going to change. I attempted to give you examples based on your own admission that you did not understand it. I lead you to the spreadsheet that gave you the best breakdown on how the system works for you to follow. The CALC and DB tabs of the spreadsheet that @hibakusha spent hundreds of hours on attempting to perfect is about the best we as a community are going to get.
You cannot design a system without knowing what is the problem you are attempting to fix or determine is it worth the capital to fix it. I am telling you that it is not plausible to design this system unless you planned on making your own game.

You are approaching the area we cannot discuss on the forums such as formulas and detailed system information due to Innogames owning the intellectual property.
 
Top