-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Spell Dictionary and reroute everything through it #183
Comments
Get me a format for what we are wanting to do and lets start with a small set like CoK or FiF and see how that works? |
I'm getting close to a workable format. I think the each creature dictionary should store basic properties of the creature and also functions, tied to named events. Buffs will be handled as events that update a global "gameState" dictionary, containing all the information on the present state of the game. Each time a player makes a choice, the game state will be updated; this should greatly reduce lag because it will usually happen during a player action. The BC can then be rerouted through the gameState dictionary, as opposed to passing dictionary objects containing the attacker and defender a bunch of times (not to mention updating those between each combat step). Here's an outline of my format idea at the moment, which may change as I figure out better ways to do this:
|
#183 - Improvements to the set.xml parser, mainly in the handling of d12 effects and card traits.
#183 - Now the spellDict generator is easier to use. Simply move the set.xml file to the same location as datagenerator.py, then double click on datagenerator.py. It will save the parsed data in "parsedCards.txt".
I decided to move the generator to the dev dropbox folder, since it isn't needed in the game files at all. Right now, I am considering a few possible ways to handle information encoding. Maybe you can weigh in with your opinion on some of these.
We want Asyran Cleric to be able to call this function for 2 dice when declaring an action. So we package the following tuple in his dictionary:
(right now, I am thinking of handling unique creature actions as a list of special action names which is stored as a list in some dictionary parameter, e.g. Then, when specialAction1 is called, the argument dictionary (packaged with a few other pieces of information such as the source and target of the ability) is passed to the generic diceBasedHeal function.
Then, when running a targeting legality check, you would iterate over the (string) elements and return False if any one of them returns false under |
3: Brilliant! On Wed, Apr 8, 2015 at 3:06 PM, ACG8 notifications@github.com wrote:
|
That is how I originally handled it, before I removed it from the BC. The problem with treating Heal as an attack is that attacks have a lot of baggage that comes with them, such as abilities that trigger on attacks, effects that boost attacks, etc. While I could code exceptions for all of those, I think it would be much cleaner to just make a separate function dedicated to healing effects.
There may be some, certainly, but at the moment I already have loads of By the way, I intend to rewrite most of the BC from scratch to incorporate the spellDictionary. Much of the current code will be scrapped for new, better code, so building exceptions into existing code is not a major concern. The BC code should be much more concise once the spellDictionary is implemented, so it should not take as much time to rewrite it as it did originally (especially since I have a better idea of how to do it now). |
On Wed, Apr 8, 2015 at 3:48 PM, ACG8 notifications@github.com wrote:
|
Oops, accidentally closed this. |
#183 - Began work on the code that will interpret the spelldictionary and enable a much higher level of automation. To start with, I have coded a guard function. I intend to test it with the guardian angel having a unique guard function, as a proof of concept. Still a few things that need to be worked in, of course.
I begin to demonstrate the use of the spellDictionary using Guardian Angel's unique guarding-triggered ability. To try it out, just create a Guardian Angel, press TAB while mousing over it, and then just follow the buttons. There is no healing yet; this just demonstrates that the spell dictionary method of storing functions in a dictionary works.
#183 - Now the card actions module can handle special, unique card actions. As an example, I have coded Hand of Bim-Shalla's special actions (they don't actually do anything at the moment; they just give notifications to demonstrate that things work as desired). #183 - Only creatures have "guard" as an option for their action.
#183 - Improved the formatting of the card actions menu. I can't get the button text to center in a satisfying way, so I opted to left-justify it instead. #183 - Began work on attack module. There is a LOT to do, so don't expect it to be finished any time soon. Added Cleric and Adramelech as further examples. #183 - Fixed bug that was preventing actor's name from displaying for guard action.
#214 - Created a single function (okay, really two) and single global variable to handle game memory of events with more flexibility than was previously present. #213 - Fully implemented targeting, at least for special abilities. To see an example of how it works, do the following: 1. Create a Hand of Bim-Shalla and an Asyran Cleric 2. Press <TAB> on the hand of Bim-Shalla and select a blessing. 3. Follow the game's instructions from there. For added fun, put a zombie token on the cleric. Note that nothing actually happens yet; this is still just proof of concept. #178 - Created getTitle function, which currently does 2 things: 1. It cuts out secondary parts of a creature's name, e.g. "Adramelech, Lord of Fire" becomes "Adramelech" 2. It puts the zombie prefix before a creature's name if zombified. For example, an Asyran Cleric with a zombie token becomes "Zombie Asyran Cleric"; "Adramelech" becomes "Zombie Adramelech" instead, etc. This function should be used for in-game notifications. #215 - Added function to compute the "Living" trait. #183 - Further work fleshing out Hand of Bim-Shalla as an example of the spell dictionary in action (see above)
Now the non-attack abilities of Asyran Cleric and Adramelech's Torment work! Also changed the spelldictionary access so that it doesn't give errors for spells that aren't included. Relevant for #176
I think we have just about reached the limit of what we can do by reading the set.xml files. To continue with the automation of the game's features, I think we will need to create our own spell definitions.
I am proposing a dictionary of spells. Each spell will contain the stats of that spell, including its special, unique effects encoded by functions, buffs that it provides, etc. These functions and buffs will be bundled with instructions to specified when they are used, and on which targets (similar to the events system that OCTGN has). For instance, a creature might have an effect that triggers when it receives flame damage, in which case any game effect that causes flame damage will see that trigger in the dictionary and call the associated function. Or it might provide a buff to all bird creatures in its zone, and will have flags indicating that the ability applies to creatures in that zone that have the bird subtype.
I have a decent idea of how to implement this, and I also think it may be possible to automate a significant portion of the work. This is definitely a Q2 project, at least, and will require a lot of work. The benefit is that it will make automating the rest of the game MUCH easier, and will reduce upkeep of code for new releases by a lot.
It may be possible to write the functions directly in the dictionary, which would be great for creatures with unique effects. No guarantees yet, though; I am still figuring this part out.
Once the new spell dictionary is created, we can see about modifying all existing functions to go through it instead of the set.xml. This will result in significant gains in speed, since we can store data in the spell dictionary in its processed form, rather than having to process it each time we want to read it. I think ideally, we should use XML data only for proxy generation.
Thoughts?
The text was updated successfully, but these errors were encountered: