❔ Modular programming ?
Hello,
I am currently studying video game programming in C#. As part of this, we have a project to recreate the board game Mini-Ville. Our goal is to implement cards, including potential future cards, without modifying the code. We plan to achieve this by using JSON or YAML files. These files would contain information such as the card's name, type, and all other relevant details. Additionally, the files would include instructions to be executed when the card is activated. I would like to know if there is a specific term for what we are trying to accomplish. I have been researching online using the keyword "modular programming," but I'm not sure if that's the right term.
9 Replies
Not sure if there is a specific term for this, but it's not super hard to implement. To could use polymorphic JSON deserialization to create a list of "effects" that run when the card is activated, making each card essentially a collection of effects
So, a card that has to take 5 coins from a player and contains the instruction in the JSON as takePiece(target, 5), when the instruction is read in the code, will it execute the takePiece(target, nb) method?
*if you need any more info btw, say it *
Something like this
yea something like this, so this is polymorphic JSON deserialization ?
it would need that, yes
okay ill search ty
so you could instantiate a
TakeCoins
effect via polymorphic deserialization, then apply it like so
how you structure this exactly is up to you, but the core idea remains the sameokay thanks ill do more research on that ^^
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.