A general way to define infinite

  • Moderators

    Have a way, for whatever numerical value or count, to set it at "infinite", comprising minus infinite (if negative are supported).

    For example, in the xml of another_world, you can see:
    <option name="attemptsPerTurn" value="99999"/>

    I'm not talking of this option in particular, as there are a lot of other options in which mapmakers set an arbitrarily very high value, to mean infinite, that it is sort of hacky. A couple examples are defining you don't have a stack limit for constructions (in a unit attachment) or you want to remove all of some resource (in a trigger).

    Currently, there are several options and properties that have "-1" meaning infinite, that is also the way you define infinite rounds (thus no retreat) in the battlecalculator, and I also think that is not very good and definitely not intuitive on the user (and, of course, it is viable only for options meant to accept only positive values).

    What I would prefer would be that no number means infinite.
    For example:
    <option name="attemptsPerTurn" value=""/>
    <option name="attemptsPerTurn" value="+"/>
    would mean "infinite".
    While not having that option at all, in the attachment, would mean "1", that is the default value (as it works now).

    Also, in the battlecalculator, having no value in "Retreat After Round" and "Retreat When X Units Left" meaning infinite (instead of it having to be "-1", that looks strange).

  • Admin

    @cernel Generally, I agree with you. The challenges are:

    1. Many options use '-1' currently and many maps use that so unless we updated a lot of maps then we'd have to continue supporting that even if we added a better way to specify 'infinite'.
    2. This is would a pretty significant code update given all the options that should be updated to handle 'infinite'.

  • Moderators

    @redrum Yeah I was assuming either you keep supporting "-1" or you mass change such occurrences into the new way of defining infinite, for all repository maps. Now, the second solution would not be very nice on @RogerCooper.

    Ok. So I understand that it is not possible to generally define an "infinite" symbol or practice, but each option and property would need specific update to add something that it reads as infinite.

    Theorically, most actual cases the like are positives only, so they could use the "-1" solution, tho I really wonder if a better way is possible. Especially for properties, like battle rounds, that may be user editable, expecting the user to know that he has to input "-1" to mean unlimited doesn't feel right to me (I wouldn't image any games working like that).

  • @cernel said in A general way to define infinite:

    Especially for properties, like battle rounds, that may be user editable, expecting the user to know that he has to input "-1" to mean unlimited doesn't feel right to me

    How is expecting the user to know he has to input "infinite" or "+" any better?

  • Moderators

    @alkexr Main suggestion was no value equals infinite.

  • @cernel said in A general way to define infinite:

    Main suggestion was no value equals infinite.

    That changes nothing about the fact that the user has to know what denotes infinity.

  • @cernel Unless the information shows up on the user interface or you have something like a drop-down list or a numeric up-down which turns into "infinity" if you go below valid values.

  • Moderators

    @alkexr That was mostly a side matter. The main matter here is being able to set infinite instead of writing 10000 or something. It may be there is not a user friendly way to do it, and this topic is open to suggestions.

  • Moderators

    @alkexr A drop down list would be a good addition also because now the user can't know (for numerical properties) what are the max and min unless by hitting them. Not sure if in this case the infinite symbol (∞) might be telling enough.

  • @alkexr
    A while ago I wondered about adding a description to the <property> tag to help players understand these 'Map Options' better.

    See Map Options


  • @Cernel, @redrum, @alkexr
    Just a thought on this topic. Most of the time that I use that big number is to reset a resource. So if resourceCount accepted '-reset-' as a value, then some of these negative large numbers would go away.

    I know that this does not help with things like 'Land Battle Rounds'.


  • Moderators

    @redrum In the meantime, if I guess it would be an easy touch, I suggest setting in the engine that every time a value or count equal to "10000" is read, the engine reads it as infinite, and documenting this in pact of steel. This would be a bit patchy, but can only make things a little more consistent, especially if documented. Probably, then, better not accepting values greater than "10000".

  • @cernel It would be exactly as patchy as just simply using 10000 as practically infinity, which is what we do now.

  • Various languages have double.positiveInfinity and double.negativeInfinity in some form.

    But in terms of the battle calc, you could just have a checkbox for "fight to finish" then the actual background implementation doesn't show up in the UI. It's an extra click for calcing strafes though as "fight to finish" would be on by default.

  • Admin

    @cernel I would suggest to add an infinite=true flag.


    <option name="attemptsPerTurn" infinite="true"/>