Comments (6)
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.
Approach 1 seems good, although I don't understand what we need the awkward [Number] part for
from unciv.
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
-
Learning ANTLR and use the kotlin target might be the way to go for that ↩
from unciv.
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.
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.
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)
- "Open terrain" goes wrong HOT 2
- Workers don't build roads. HOT 3
- Unable to decide what to do with a city HOT 9
- I can't connect to multiplayer HOT 3
- Simultaneous determination a tile HOT 3
- Declaration of war bug HOT 8
- Translating site bug HOT 4
- Air units no longer show attack and move range HOT 10
- Feature INQUIRY: AI's predisposition on SAM's HOT 1
- Check mod versions when online-play HOT 4
- Add "Hide this building in city UI"
- Escorted movement crash HOT 1
- City-state condemnation mechanics
- RFC: Fly-by observations (and mini-bugs) concerning Espionage HOT 8
- Culture order error in declear war notification. HOT 1
- Trigger "Enemy City" tutorial when I disbanded all my units. HOT 2
- Unit automation uses defunct `UnitActionType.StartGoldenAge` HOT 2
- Unable to start on custom map HOT 3
- AI players ignore the One City Challenge HOT 1
- Mods broken since 4.11.12 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unciv.