Aurora 4x

C# Aurora => C# Suggestions => Topic started by: vorpal+5 on December 22, 2020, 03:47:34 AM

Title: Order templates should be additive
Post by: vorpal+5 on December 22, 2020, 03:47:34 AM
To my surprise they are not. I had an order template where I load the 10 minerals in small quantity, ready to be delivered somewhere, but if you add the template, and then another, the 2nd erase everything. Meaning you can't have a ship service several planets by adding templates one by one.

Now consider the other possibility, that templates are additive. If you don't want that, just click on 'Remove All'. If you want that, do nothing. So clearly it seems there is only a benefit to have them additive and not replacing everything  :D
Title: Re: Order templates should be additive
Post by: Froggiest1982 on December 22, 2020, 03:59:29 AM
To my surprise they are not. I had an order template where I load the 10 minerals in small quantity, ready to be delivered somewhere, but if you add the template, and then another, the 2nd erase everything. Meaning you can't have a ship service several planets by adding templates one by one.

Now consider the other possibility, that templates are additive. If you don't want that, just click on 'Remove All'. If you want that, do nothing. So clearly it seems there is only a benefit to have them additive and not replacing everything  :D

The reason is that the template creates a list of orders copying from a previous one templated.

My guess is that the window does not add lines of orders but adds orders to the line.

When you then paste and copy the template you are effectively overwriting the same lines.

It may be possible to be done with a bit of work, not sure if that easily though.

Obviously, now Steve will confirm the above being absolutely wrong and able to add that for you in a jiffy  ;D

EDIT: I will be happy with the change
Title: Re: Order templates should be additive
Post by: Steve Walmsley on December 22, 2020, 04:20:03 AM
Its because there is no guarantee that the orders in template B would make sense following the orders in template A. The amount of code required to check that would be huge. It's the same reason you can't delete an order from the middle of the list.
Title: Re: Order templates should be additive
Post by: mike2R on December 22, 2020, 06:14:22 AM
Its because there is no guarantee that the orders in template B would make sense following the orders in template A. The amount of code required to check that would be huge. It's the same reason you can't delete an order from the middle of the list.

I've been wondering about this for a while.  It seems like orders must be able to deal with being unable to complete already - anything that targets a transient object like a fleet or waypoint may find that its target doesn't exist.  Any order that requires a colony to be on a body must handle the colony being deleted, or one that requires a component to be on a ship in the fleet must deal with it being destroyed.  And you can cause all sorts of failures by setting orders to repeat.

So couldn't you just not check?  If a fleet finds it can't perform its next order, it errors out and the player has to fix the problem they caused.
Title: Re: Order templates should be additive
Post by: Droll on December 22, 2020, 06:24:34 AM
Its because there is no guarantee that the orders in template B would make sense following the orders in template A. The amount of code required to check that would be huge. It's the same reason you can't delete an order from the middle of the list.

I've been wondering about this for a while.  It seems like orders must be able to deal with being unable to complete already - anything that targets a transient object like a fleet or waypoint may find that its target doesn't exist.  Any order that requires a colony to be on a body must handle the colony being deleted, or one that requires a component to be on a ship in the fleet must deal with it being destroyed.  And you can cause all sorts of failures by setting orders to repeat.

So couldn't you just not check?  If a fleet finds it can't perform its next order, it errors out and the player has to fix the problem they caused.

Furthermore the game already checks if an order is not possible in a system like order cycles not working because you forgot to reroute the ship back to the cycles starting system.
Title: Re: Order templates should be additive
Post by: xenoscepter on December 22, 2020, 07:30:45 AM
 - Perhaps the issue is that the orders make a call to the database. Thus Order Template A and Order Template B could cause potentially game crashing issues. After all, Sol doesn't come up as a valid target in the Centauri Backwoods system... unless you place an order to jump to it first.

 - Thus Order Template A being set somewhere outside the system could cause a problem on account of database shenanigans., perhaps?
Title: Re: Order templates should be additive
Post by: mike2R on December 22, 2020, 08:02:39 AM
- Perhaps the issue is that the orders make a call to the database. Thus Order Template A and Order Template B could cause potentially game crashing issues. After all, Sol doesn't come up as a valid target in the Centauri Backwoods system... unless you place an order to jump to it first.

 - Thus Order Template A being set somewhere outside the system could cause a problem on account of database shenanigans., perhaps?

Yeah this is what I'm curious about.  If its anything like that, then obviously we aren't getting these sort of changes.  But from the outside it looks like you can engineer situations very much that already, and the game recovers from them gracefully and even sends an error to the player.

So I'm wondering if Steve means he would need to add a ton of error checking simply to protect the player from creating orders that would be invalid, but not harmful (to the game).  If its this case, my personal preference would be to be given the rope needed to hang myself :)
Title: Re: Order templates should be additive
Post by: Steve Walmsley on December 22, 2020, 02:59:03 PM
The code will currently only let you create valid orders, which includes checking previous orders, cargo, etc. so you can't unload something you don't have for example. That means any single template has valid orders.

However, it is isn't as simple as checking the first order of template B vs last order of template A because there are a lot of checks before the potential order list is created. There are 110 potential orders and you normally see a small subset. The existing order check code wouldn't be able to handle an order that would not normally have been an option in the first place.

Ultimately, I don't want to spend time chasing bugs caused by incompatible orders that I will never be able to find, so it is much simpler to avoid concatenated templates.
Title: Re: Order templates should be additive
Post by: mike2R on December 22, 2020, 03:25:09 PM
Thanks for taking the time to explain Steve, I shall quit bugging you about it :)
Title: Re: Order templates should be additive
Post by: Migi on December 23, 2020, 01:13:35 PM
The code will currently only let you create valid orders, which includes checking previous orders, cargo, etc. so you can't unload something you don't have for example. That means any single template has valid orders.

However, it is isn't as simple as checking the first order of template B vs last order of template A because there are a lot of checks before the potential order list is created. There are 110 potential orders and you normally see a small subset. The existing order check code wouldn't be able to handle an order that would not normally have been an option in the first place.

Ultimately, I don't want to spend time chasing bugs caused by incompatible orders that I will never be able to find, so it is much simpler to avoid concatenated templates.

 ;D  Can't you let us live with the consequences of our bad decisions?
Title: Re: Order templates should be additive
Post by: Steve Walmsley on December 23, 2020, 02:33:38 PM
;D  Can't you let us live with the consequences of our bad decisions?

Yes, if I didn't have to live with them too :)
Title: Re: Order templates should be additive
Post by: Froggiest1982 on December 23, 2020, 03:18:02 PM
;D  Can't you let us live with the consequences of our bad decisions?

Yes, if I didn't have to live with them too :)

Standing Ovation