Giter Site home page Giter Site logo

Countable scopes approach decision about unciv HOT 6 OPEN

PLynx01 avatar PLynx01 commented on May 22, 2024
Countable scopes approach decision

from unciv.

Comments (6)

yairm210 avatar yairm210 commented on May 22, 2024

Approach 3 is right out - how do we know to "link" those specific modifiers and not others?
Approach 1 is good, but I don't like that we need to specify "number 25" - that doesn't look good as text.
Approach 2 seems to be the best of breed, we can be as specific as we want or as general in the same format

from unciv.

RealBamboolord avatar RealBamboolord commented on May 22, 2024

Approach 1 seems good, although I don't understand what we need the awkward [Number] part for

from unciv.

SomeTroglodyte avatar SomeTroglodyte commented on May 22, 2024

Approach 4: UniqueParameterType.Formula - implemented as generic math parser supporting a small set of the usual operators, + - * / % ! && || < > == != <= >= ^, (), and operands literal or $game_var, the latter being extensible and supporting scope. prefixes. Result type Float, implicit conversion to/from Boolean as required by mapping to 0 or 1 or as != 0 with an epsilon. Defer decision whether to allow string expressions... And whether to support ternary operators (with string ops potentially a very powerful modding option - trigger grants promotion A or B depending on...)

If we decide to go there eventually, then keep this as small and simple as possible...

If someone digs up a code template, CC0 or PD, to copy most of, could be done in a week. After all, parsers are common. Edit: 1

What's simplest of those approaches? To code and maintain? Maybe 2 - complexity concentrated in one place, namely parsing parameters left to right keeping track of last selected scope. Drop "Number" - any parameter whose scope is unambiguous isn't required to specify one, similar code complexity as requiring pairs throughout. Requires scope names to be uniquely different from any countable name though. Can use some of my experimental data model - a countable being an interface that can be implemented by an empowered Enum or by non-enum dispatchers like the Stat one. But the value getter would receive a Scope parameter from the upstream parser, and the interface should likely get a supportsScopes function for validation. All of that code could then be easily reused in UniqueParameterType.Formula.

Footnotes

  1. Learning ANTLR and use the kotlin target might be the way to go for that

from unciv.

PLynx01 avatar PLynx01 commented on May 22, 2024

I suggest you to opt for the blend of 1 and 2 approach

The aforementioned example "return true when there is more than 25 cities on the entire map" would be like this

<when [Global Number of Cities] [] is greater than [25] []>

These empty parameters would be places to insert a limiters of the specified filter

<when [Global Number of Cities] [Enemy] is greater than [10] []>

The second example would return true if there are more than 10 cities of hostile civilization.

The general syntax would be like this:

<when [countable] [optional limiter(s)] is greater than [countable] [optional limiter(s)]>

What is your opinion? If you don't understand something or if you want additional examples, feel free to ask me.

from unciv.

PLynx01 avatar PLynx01 commented on May 22, 2024

BTW, we should somehow attach buildingFilter to cityFilter, allowing to choose cities that have the specified building.

Example:
<when [Global Number of Cities] [University] is greater than [10] []>

Returns true when there are more than 10 cities with University

As you can see, there is an obvious problem with wording. Maybe we could inject some words when the buildingFilter is used as cityFilter?

So, it would display like this:

When Global Number of Cities with University building is greater than 10

I hope you understand.

from unciv.

PLynx01 avatar PLynx01 commented on May 22, 2024

I suggest you to opt for the blend of 1 and 2 approach

The aforementioned example "return true when there is more than 25 cities on the entire map" would be like this

<when [Global Number of Cities] [] is greater than [25] []>

These empty parameters would be places to insert a limiters of the specified filter

<when [Global Number of Cities] [Enemy] is greater than [10] []>

The second example would return true if there are more than 10 cities of hostile civilization.

The general syntax would be like this:

<when [countable] [optional limiter(s)] is greater than [countable] [optional limiter(s)]>

What is your opinion? If you don't understand something or if you want additional examples, feel free to ask me.

@yairm210 @SomeTroglodyte @RealBamboolord @woo1127

Please review my proposal

from unciv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.