TokenMaker

We are always looking for new tools to create to help facilitate the table top gaming experience. Let us know if you have an idea for a new gaming tool you'd like to see. (Note: this is NOT for feature requests on existing tools!)

Moderators: dorpond, trevor, Azhrei

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Rumble wrote:Someday. I plan on taking a look today at the TM code to see if I can figure it out. Extending it for my framework will be nontrivial no matter what (simply because my character tokens are so complex) but I managed it with the parser I modified from JamesManhattan, so it'll be possible.
I'll help as much as possible Rumble -you have been a great aid to me so it's the least I can do.

Tomorrow (off to DM now) I'll post a description of the classes and methods I think you'd need to extend/override in order to make it work with your framework.

Cheers!
The guy in the green hat.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

Unfortunately, I can't build it due to missing Apache commons stuff, which...I don't know how to get.

False alarm - classpath issue, not missing files.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

Okay, lemme say something here - TokenMaker is slick as hell. This is some seriously nice work, Blakey, and I am looking forward to trying to screw it all up trying to make it make tokens for my framework. Really, though, it's great. I'm blown away. It is well beyond my level of Java-fu, though I think I can use it as a basis for modification.

On the downside, after reading through it, I am not positive how far it can be bent to my will, but I'll give it a shot. It looks like I'll have to do a lot of overriding in terms of PC powers, since the current approach in TokenMaker appears to be building an attack bonus that looks like:

"+19"

and damage that looks like "2d8+12"; whereas my attack bonus information for a power is "Str" and damage is in the form "1MHW+Str" (the rest of the relevant modifiers being tacked on by the framework as necessary). So I'll be subverting a bunch of code to get the power's generic form, rather than the specific form for the token. But if the information is there in the dnd4e file, it should be doable.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Rumble,

Thanks for the compliment. No one has ever said anything like that about my code before and I do this for a living. :oops:

Now onto some help for you and your framework:

I don't know your framework really, but I'd suggest either starting with monsters or players and concentrating on that first off. Personally I'd pick monsters as their base data is a lot smaller to deal with and they are created a lot more regularly than players.

Monsters
The NPC class stores the data from a monster. It's usually generated by a bit of a backdoor approach. When you ask it for it's HTML (getHtml() method) it goes off to the Compendium and grabs the HTML and whilst there it parses it, populating all the fields at that time. I think I get pretty much everything you need from the monster HTML onto the 'NPC' object when I parse it. I don't parse out the Equipment at this stage but I think I get everything else. You probably don't need to change this code I don't think.

Once your NPC is populated, you create a Token for it using the Token class. This class is subclassed into NPCToken and PCToken for any special extra stuff that needs doing for those specialist cases. To output a token for your framework (whether it be PC or NPC) you'll probably best off extending NPCToken and PCToken, creating something like RumblesNPCToken and RumblesPCToken classes. This done you need to override the following methods:
  • writePropertyMap() - this is what builds the properties for your token. Should be quite self explanatory.
  • writePowerMacros() - this writes out the macros on the "Selected" frame. I loop through each power on the N/PC and create a macro for each one. Currently what those macros do for me is to display the HTML of the power. You would override these to do whatever your macros do. I also create my "Character Sheet" macro at this stage but I guess you have no need for that.
  • optionally writePowerMacro(). If you use the same approach as me of looping over each power to make a macro this method actually writes out the XML for each macro.
That's it. I think that the issue for you will be how to get the data that you want to write out. Incidentally, the important part of the macro code in XML is the <command> node. This is where you need to stick your actual macro code.

Players
Firstly, in order to get more granular information out of the save file, look at the PCDataAccessor.java file. This class basically deals with taking in a Character Builder save file and generating a PC class object. It builds a DOM and then uses lots of separate routines to parse the DOM to get all the nitty gritty data out. It could easily be expanded to pick out smaller granularity stuff like a PCs strength bonus etc. So far all I have done is to make it retrieve the stuff I am interested in. If you do expand it to read in more data you'll need to expand either the Character or PC class to hold this extra data.

Once you have got all the data you need out of the character sheet, you can use the same approach as for monsters to make your PC tokens. Again there really isn't much to do other than override those same three methods.


This may well not cover everyrhing and more issues will probably come up from this but I think this should be a start for you.

Also, if you want to utilize my character sheet dockable frame, as well as your existing framework, feel free. Just add code to make the "Character Sheet" macro when you're building the others and add it on as a 'on mouseover' field. You could override the buildHtml() method if you want it to look different - for example by copying the code but removing all the links which are for my framework.

I hope this helps and if you have any questions at all, shout.

Have fun!
Blakey
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Another thought. At some stage if this is to support more than one framework we will need to let the user select which framework they want to use. I'd suggest adding a radio button to the PCMaker and NPCBuilder classes which lets you select "Blakey or Rumble" frameworks. We can easily expand this approach to include more frameworks down the line.

If you take a look at TokenMaker.java (the original main class) this is where all the state is handled. I'd suggest making the new radio button selections a state that is saved off and loaded in saveState() and loadState(), so that it recalls your last choice. This way you don't need to keep clicking "Rumble's Framework" every time you start the program up.
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

I guess I'm going to have to put some sort of versioning in here sooner or later but as we're still on an Alpha release I'm not bothering yet! But I did try throwing a brand new 1st level character at this last night and it failed to load him. The reason was he had no Experience which was causing an exception to occur. I've fixed that up in my latest version.

Blakey
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Critical Weapon Damage

The most fundamental issue I have currently with TM is that there is no way to pass weapon critical damage into the framework. Well, that would be easy, but at present there is no way to know what a given weapon's critical damage is as this info is not in the CB save file. Last night, laying awake in bed thinking about this (I really need to get a life), I came up with a short term solution which will be extensible later on to do this job properly. This is my plan:

I'm going to create a Weapon class which will contain not much more than a weeapon's name and, vitally, it's critical damage dice. Every PowerWeapon object will then be given a Weapon object to record the weapon itself that is used with that attack. This way when an attack is made the weapon itself can be queried and the critical damage read out. Pretty straight forward so far.

The trouble comes from populating this Weapon object. For any given attack you know the name of the weapon (it's in the save file XML) but you don't know the critical damage dice. This is the key bit. So, what I'm going to do, short term is any time a weapon is created, get it to go off to a file (weapons.dat) on disk and search for that weapon name in the file. If it's not there, prompt the user for the critical dice string for that weapon and save it in the file. If it's there, read it from the file.

This way the first time you load a PC with a "longsword" as a weapon it will ask you to enter the weapon's critical damage string. It will then save this away and any further time you read in a power with "longsword" as the weapon the critical dice string can be read from the data file. This means if more than one PC uses a "longsword" they can share this info and if you read the same PC in multiple times - which happens a lot over the course of one PC's life - it only prompts you for Longsword once and once only. Effectively the program forever knows what the critical damage of a longsword is from now on

Of course it is vital that every distinct weapon gets its own entry because a "+3 frost greataxe" does not do the same damage as a "greataxe" or even a "+2 frost greataxe". But that's easy as this level of detail is held on the character sheet for the weapons.

This might turn out to be a longer term solution to this problem but I'm also thinking that the same code could later be replaced by something that went off to the Compendium and found out what critical damage as +3 frost greataxe should do, which would be a better solution as I'm not keen on building any sort of database on disk using this program.

I think this will be my next area of development for TokenMaker.
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Well, this lunchtime I managed to build the classes necessary to add critical damage to tokens/weapons. It works pretty good although I'm not keen on leaving data on disk in the long term.

I also updated my framework to use this new info. Not happy with how that looks at all now - the 'table' of data I'm putting out when a token attacks is getting massive. I just don't know what is important and what is not yet...
The guy in the green hat.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

Blakey wrote:Well, this lunchtime I managed to build the classes necessary to add critical damage to tokens/weapons. It works pretty good although I'm not keen on leaving data on disk in the long term.

I also updated my framework to use this new info. Not happy with how that looks at all now - the 'table' of data I'm putting out when a token attacks is getting massive. I just don't know what is important and what is not yet...
For data output, I'd strip it down as much as possible. My frameworks, for instance, put out info like this:

Twin Strike (Standard action):
Villain 1: 22 vs. AC, 4 damage
Villain 1: 6 vs. AC, miss
Hit: 1W damage per attack.

It's simple and small. I use tooltips to break down any damage info, but that may not be necessary for your needs.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Small and simple is good. :-)

I think I need more than this though - for example, I want to display the weapon used because it's quite possible someone will have clicked on the wrong link so it is good feedback.

How do you deal with Sneak Attack?
The guy in the green hat.

User avatar
Rumble
Deity
Posts: 6235
Joined: Tue Jul 01, 2008 7:48 pm

Re: TokenMaker

Post by Rumble »

Blakey wrote:Small and simple is good. :-)

I think I need more than this though - for example, I want to display the weapon used because it's quite possible someone will have clicked on the wrong link so it is good feedback.

How do you deal with Sneak Attack?

We're getting into complex macros at this point. For the full process, here's what happens:

1. Player makes an attack.
2. If the attack hits, and the player has combat advantage, and the player has the sneak attack feature AND has not used it this round, then...
3. A prompt comes up saying "You hit So-and-so. Do you want to apply sneak attack damage?"
4. If the player says yes, then the sneak attack damage is rolled and folded into the overall damage amount.
5. The attack is processed (including any conditions that get applied, etc) and the output is displayed.
6. If you hover over the attack value, you get a tooltip breaking it down. Likewise, the damage value. Those are shown below:

Chat output sample:
sampleattack.png
sampleattack.png (14.75 KiB) Viewed 7120 times
Attack Tooltip sample:
attacktooltip.png
attacktooltip.png (27.24 KiB) Viewed 7120 times
Damage Tooltip sample:
dmgtooltip.png
dmgtooltip.png (17.25 KiB) Viewed 7120 times

After that, the total damage amount including sneak attack is applied to the target token, reducing its HP and so forth. Any resistance/vulnerability is handled, and if there is such thing, it's displayed (as you can see in the sample) as a note to the GM or to the player.

As you can guess, this means that there's a lot more detail in my framework about where each bonus comes from, and a considerable amount of code goes to setting up those tooltips (it also means that as players swap weapons in and out, the damage values change automatically to accommodate different equipment). It's probably much more than what you need; I'd just add a link to the page for "Sneak Attack" and have it roll 2d6 when necessary.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Rumble, that is sweet as a sweet thing with extra sugar. I'm actually tempted to move over to your FW!! :)

I think I'm going to resdesign the output from my FW along the same lines, as far as possible. I'm aiming for a one click solution though - so I need things like Sneak Attack damage to be printed without any pop up boxes appearing. When there are multiple targets my rogue player always declares who sneak attack is on before making the attack anyway, so that works for us. I'll just print out sneak attack damage on the part of the output at the top where the power is described.

I'd forgotten you can do tool tips like that. That's definitely the way forward - make the output simple with a detailed tooltip behind it. Neat.
The guy in the green hat.

User avatar
Hawke
Great Wyrm
Posts: 2261
Joined: Sat Apr 21, 2007 12:12 am
Location: Albuquerque, NM

Re: TokenMaker

Post by Hawke »

Blakey wrote:Rumble, that is sweet as a sweet thing with extra sugar. I'm actually tempted to move over to your FW!! :)
After using my own custom FW for a long time and a recent convert to Rumble's 5.0, I highly suggest you give it a shot =)

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Hawke wrote:
Blakey wrote:Rumble, that is sweet as a sweet thing with extra sugar. I'm actually tempted to move over to your FW!! :)
After using my own custom FW for a long time and a recent convert to Rumble's 5.0, I highly suggest you give it a shot =)
And I guess that would encourage me to get TM generating Rumble tokens too... :D

I'll have a peek at it when I get a chance I think...
The guy in the green hat.

User avatar
Blakey
Dragon
Posts: 778
Joined: Fri Mar 23, 2007 11:27 am
Location: Sussex, UK.

Re: TokenMaker

Post by Blakey »

Update

Work on TokenMaker has continued apace these last few days and this weekend we played an entire weekend of D&D using my new framework. Other than a lot of ideas for tweaks and improvements it was a great success. The monsters and PCs were easy to use, the players really liked the HTML character sheets and the ability to simply click-select targets for their powers. There was a general concensus that not having lots of pop up boxes asking you to put in temporary combat conditions and not having to select targets from a drop down box was a Good Thing. All in all, a good first real test.

Recent improvements include PC character sheets having links for every power, feat, ritual and item equipped which, when clicked on, pops up a dockable frame with the entry's description out of the compendium. This is all gathered at token generation time so all this info is there instantly during a game session. This means we don't really even need to access the compendium these days during a game, apart from the occasional glossary look up.

I have a long list of things to tweak and improve upon for the framework and for TM in general but it's heading in the right direction. Not much if any feedback on the framework I posted so I guess that no one is particularly interested in that which I'm not surprised about. Unfortunately TokenMaker isn't really all that useful to anyone who isn't wanting to use that FW at the moment.

I'm nowhere further along with respect to thinking about expanding this tool to work with other FWs yet but am still more than happy to help anyone who wants to do so.

Cheers!
Blakey
The guy in the green hat.

Post Reply

Return to “Ideas for New Applications”