Comments (11)
I agree it should be similar to "secret discovered" on the screen. I'm thinking we'd add a new ActionResponse
called something like OptionalWinConditionActionResponse
(See the Actions guide) that contains the condition
/conditionId
so it can be used to show the banner.
onGameEnd
should definitely not be triggered. I would probably suggest to extend checkGameOverConditions
and if an optional condition is hit, return the OptionalWinConditionActionResponse
. I assume I'll have to rename some things later to make it fit with this new model, however it should work since that function returns a GameState
.
from athena-crisis.
We should never mutate the map state directly, see: MapData guide. applyActionResponse
always takes a map data object and returns a new one. In our case since we are editing win conditions it's a bit more finicky. Something like this:
const { condition, conditionId, playerId } = actionResponse;
const winConditions = Array.from(map.config.winConditions);
winConditions[conditionId] = {...condition, completed: new Set([...condition.completed, playerId])};
map.copy({
config: map.config.copy({
winConditions
})
})
from athena-crisis.
Sorry for being unclear. We don't need to reset the state at the end, but the way Athena Crisis works is when you save a map, it resets everything to the initial state so it's ready for games to be played. validateMap
is what takes care of that. We call dropInactivePlayersFromWinConditions
and I would suggest renaming that function to resetWinConditions
and setting the completed
field to an empty set + keep doing what the function is already doing.
Secondly, validateWinCondition
should basically just verify that everything is set to the initial state. So if completed
is not empty, that function should return false
.
Let me know if you have any more questions, happy to answer them.
from athena-crisis.
Hi, https://github.com/nkzw-tech/athena-crisis-universe/blob/ed772104aeaa8264b2c3d8afd677312e7860b1f1/apollo/lib/checkWinCondition.tsx is not working. It gives 404.
from athena-crisis.
Thank you. The correct link is checkWinCondition.tsx
, I edited the issue description. Apologies for the inconvenience.
from athena-crisis.
@cpojer this might be a dumb question, but what should happen (on the screen) when a user achieves one of the optional win conditions?
It seems like an optional win condition shouldn't end the game.. so should it trigger some kind of animation, similar to 'Secret discovered banner'? And (well sorry this is a little more specific, but I'm kinda lost 😭) how should I prevent an optional win condition from ending the game? should I perhaps do something in onGameEnd()
or should it never trigger 'GameEnd' action in the first place?
from athena-crisis.
@cpojer Hey thanks for a detailed answer! It was immensely helpful 😄
I would like to ask another question though if you don't mind.
So this completed
state—that tracks players that have completed the optional win condition so far—cannot be a field in a WinCondition
, right? since a WinCondition
doesn't change once a game starts, but the completed
state would, as the game progresses.
Maybe having it in MapData
would make more sense? so that we can update completed
in checkGameOverConditions()
like:
map = map.copy({
completed: [...map.completed, pickWinningPlayer(...)]
})
from athena-crisis.
We can certainly edit the win conditions to add the player ids! I assume the action response will have a playerID, conditionId, and the condition, so in that case we can add a few lines in applyActionResponse
that adds the player id to the completed
field on the win condition.
from athena-crisis.
Sorry, I may be misinterpreting your intent here, but it looks like applyActionRespose()
simply calculates and returns a new map, depending on actionResponse.type
? And what you're suggesting is to modify the condition contained in actionResponse.condition
in place and return the same map as is? so something like:
case 'OptionalWin': {
const { condition, playerId } = actionResponse;
condition.completed?.add(playerId);
return map;
}
If so, I should use Set<PlayerID>
instead of PlayerIDSet
for the type of condition.completed
since add()
is going to be used?
from athena-crisis.
Ah ha! thank you so much for that code snippet! It clarifies things a lot 👍
from athena-crisis.
@cpojer Hey, I was reading the issue description again, and was wondering about this part:
and validateMap (or maybe validateWinCondition or similar) needs to reset the completed state.
I'm not very sure when and why we should reset the completed state? Maybe when the game ends eventually?
I'd greatly appreciate it if you could elaborate on this part a little more 🥹
from athena-crisis.
Related Issues (20)
- [AI] Medics and Support Ships should heal nearby units HOT 6
- [AI] Prioritize Win Conditions when possible
- [Fix] Windows Support for Scripts and Tests HOT 2
- [Feature] Symmetrical Drawing Mode in the Map Editor HOT 1
- [Experiment] Build a React-Three-Fiber (WebGL) renderer for Athena Crisis HOT 2
- [Performance] Improve the performance of `Radius.tsx` by 2x. HOT 2
- [AI Competition] Build the best turn-based AI for Athena Crisis
- [AI Competition] Placeholder Issue for 2nd Place
- [AI Competition] Placeholder Issue for 3rd Place
- [Open Source] Add share link to the Map Editor HOT 7
- [Performance] Reduce memory usage when rendering Portraits
- [AI] Improve AI performance by 5-10x HOT 2
- [Performance] EvaluationPanel should run map evaluations async and/or in a worker
- [Bug] When placing a unit in map editor, the placed unit doesn't reflect the current player
- Can reinforcement learning be used to develop AI for this game? HOT 2
- [Feature] Win Condition to Fulfill Multiple Optional Conditions HOT 21
- vite related module not found when open http://localhost:3003/open-source HOT 3
- [Feature] Firefox support HOT 1
- Unable to interact with game on https://athenacrisis.com HOT 1
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 athena-crisis.