Gerikes
User of Run-on Sentences.
GerikSpells Framework
An Action-Creation Framework for Civ4
Current Status: Beta
Latest version: v0.54 August 23, 2006
Wiki: http://gerikspells.pbwiki.com
Known to work with Civilization 4 Vanilla version 1.61 (get the patch here)
An Action-Creation Framework for Civ4
Current Status: Beta
Latest version: v0.54 August 23, 2006
Wiki: http://gerikspells.pbwiki.com
Known to work with Civilization 4 Vanilla version 1.61 (get the patch here)
News:
August 22, 2005: After merging with Civcraft, made a bunch of tweaks and fixes I found while using the code there.
Spoiler Old news :
August 18, 2005: Bunch of bug fixes, including problems with incorrectly calculating ranged plots in GerikSpellsUtils. Also changed GSImmediate to become GSImmediateNoTarget, along with creating a GSImmediatePlotTarget. This allows for GSImmediatePlotTarget to be used with GSMissionTargetCounter, since that policy expects to get a plot policy as it's target (and GSImmediate will only give a NoTarget policy). Finally, chaned how the stage list is made. Prior, it was created in the constructor, but this meant that creating different targetting stages based on the ctrl, shift and alt keys (as defined in GSHandler.start()) couldn't change anything. Now, create the stage by overriding the function createTargettingStageList(bAlt, bShift and bCtrl).
August 15, 2006: Beta, baby! I've decided to wait on the AI implementation for now while I view my options and pour more work into perhaps creating more targetting info policies and updating the documentation.
August 14, 2006: Fixed the patrol spell from crashing when moving to a place that the unit can't move to. Fixed the cyber terrorism missions to actually be affected by range. Whoops

August 13, 2006: Hurray for small updates! I finally put a stamp of approval on how I change interface modes and cursors, and now the multi-cursor feature is functioning. To see an example, check out the new and improved Patrol spell. It has a cursor that points one way to show the user that they are picking the first plot, and another feature that turns around to show that they are now picking the second plot. How deviously delightful!
Unfortunately, because I was testing the Patrol spell, I found that it has a bug in it when it comes to trying to move to plots it can't move to. It will cause crashes. I'll fix this in the next version, and also work on a better scheme for help texts. I can smell the AI just around the corner!
August 11, 2006: v0.41 released. Yup, I'm back to incrementing by a hundreth. I've implemented two new spells, using two new policies. I've renamed that long "GSPushMissionNoTarget" to just "GSMission", since basically the only other alternative (besides the base) is "GSMissionNoTarget". Knowing this, I've created two policies, GSMissionTargetCounter and GSMissionCasterCounter. These two policies allow for "counters" to be placed on either the target of the spell or the caster of the spell. These counters will then be incremented every turn, and when they reach a predefined amount, the user's function will be called.
For examples, I've put up two Cyber Terrorism spells (since as I am a self-defined supporter of the hacker culture, I'm hard pressed to allow the term "hacker" or "hack" be used in a negative way

August 8, 2006: v0.40 released. First off, I've implemented a version of "Plant Forest". Note that you need to have TECH_BIOLOGY to use it. I've also changed Sacrificial Oath to use a new graphics policy, GSPopup, as an alternative to GSPieMenu. I felt that people would probably want choices as to the target-selection process to use, since not everyone is going to be wild and crazy about my Pie-menu system. I also fixed a few bugs, and started working on implementing help text.
August 4, 2006: v0.35 released. The range system is finished. Included into every PlotInfo (whether it be single or square, or, in the future, other multi-target policies) there are callbacks and checks for range and visibility (fog of war-wise). The total range is created using a callback, but I have made two utility functions in GerikSpellsUtils that will help aid that function. Also fixed that annoying bug where pressing escape at the pie-menu will cause the main menu to appear. Finally, did some work finallizing a "Patrol" spell. I still don't like how it works, so I'm going to continue trying to come up with at least a better example for a spell that takes multiple turns.
July 31, 2006: v0.3 released today. I'm very happy with the changes made, and I don't believe I will be doing any more complete restructering anytime soon. The big change is how the "stages" of a targetting spell is done. Prior, there was specific, built-in policy for each "ordering" of target-retrieving. For example, the "PlotSelect" policy was just getting "Plot". The "PieMenu" select policy was getting "Plot, then PieMenu". This meant for every order a new policy would have to be created. The new policy, "GSTargetting", will replace all those. It can take any list and do the targetting. For example, I could make a "Plot" or "Plot->Pie Menu" like normal, or just as easily change it around and take "Plot->Plot->Pie Menu" or "PieMenu->Plot->PieMenu" or "Plot->Plot->Plot->Plot->Plot->Plot->Plot->PieMenu->Bacon, Eggs and Spam" (ok, not really the last one, but yes on many plots). Also, I've fooled around with the graphics, showing some easy ways to create neat effects and plot textures.
July 28, 2006: A completely reconstructured code base for GerikSpells is pretty much finished. It's not very well tested, but hey, that's what alpha's all about. I experimented a bit with plot coloring, but feel that do to the limited amount of plot textures you'd be able to have, that an unlimited amount of effects would be more scalable.Unfortunately, modifying effects is a bit tougher. Hopefully I can find someone on the forums that knows a thing or two. I'll still persue the plot graphics, however, for all it's worth. Finally, I've updated the screenies showing the unit info panel.
July 26, 2006: After losing tons of time trying to "fit in" code to the current structure, I've decided to go back to the drawing board for a few things. Basically, I'm completely changing how the Target and PieMenuGraphics policies work, and adding a third policy (Stages) to fill the gap. These are going to work COMPLETELY different, so I'd recommend anyone trying out this mod not to get too comfortable. Hey, I warned you it was alpha.
July 24, 2006: Today I released the alpha version of GerikSpells. I hope there isn't any other exciting events that might overshadow this...

------------------------------------------------------------------------------------------------------------------------
The code is in it's VERY infant stages. The testing has been completely in single player mode. Asides from that, the AI, Civilopedia, and much of the popup info-pane implementation is not complete. I'm also going to add more pre-built policies. However, you should get a good idea using what's in this package of what you can do with GerikSpells.
What is the GerikSpells Framework?
The GerikSpells Framework is a tool that allows mod makers to create actions in a very quick and easy manner for the game Sid Meier's Civilization 4. The framework is built around a very customizable structure that allows for users to create very powerful actions, from simple "click and your done" to full-fledged unit targetting, while trying to make the modder go through as little code as possible by encapsulating most of the work into pre-defined class "Policies". This, all while allowing for the spells to be Multiplayer-ready, AI-moddable, and easy-to-use.
It's also good to note that although I refer to actions as "spells", that this does not mean that all actions created with this framework must be of the Fantasy-style spells. Indeed, the framework can be used to create actions for fantasy-style mods, sci-fi style mods, even simple Civ4 tweaks. However, as "spells" would be the obvious use of such a package, I decided to use that for a name. In fact, when finished, a modified version of this framework will be the backbone of the action system in Civcraft: SC, most likely controlling everything from special abilities of units to burrowing to even building buildings.
For more information on GerikSpells, check out the "About" page at the Official Wiki.
What can the Framework do?
I've whipped together a few "spells". I've given the end Python code into a spoiler to show you exactly what you would have to code to make similar spells (note that options such as AI and some more advanced plot highlighting is still to be made, but at least you get a fair idea of what's going on). The screenshots aren't very much graphically, mostly the code is the point of this presentation. Check them out in the next post, or download the mod and see them for yourself!
Thanks and shout outs:
Locutus: (Creator of the Python API I reference at least 20 times an hour.)
Stone-D (Creator of SdToolkit)
Teg Navanis (Modification to SdToolkit called SdToolkitAdvanced)
Kael (Writer of the tutorial "Adding new XML attributes" which got me addicted to the SDK)
jdog5000 (Writer of the "Exposing new functions to Python" tutorial, another necessity to get me started quickly in modding the SDK).
Rabbit, White and ArenaNet (For some of the Fantasy buttons used as part of the examples).