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: Azhrei, dorpond, trevor

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

TokenMaker

Post by Blakey »

Some Background
I've just started to learn java and so as an intellectual exercise I figured I'd put my skills to practice doing something I might enjoy and that might actually be useful to me when and if I ever finish it. I looked about for projects to get my hands on and I realised that there was an opportunity available for MapTool that I could have a crack at - automated Token Generation.

Me and my pals play D&D 4E. We are currently using MT as our VTT and one of our number lives 250 miles away and dials in, with Skype, to join the games. It works great. I am the DM. I'm also the techie who understands all the technology we are using (although others understand most of it too). But no one else has yet taken up the batton of DMing using MapTool. We use a complicated Framework (a highly modified version of Veggie's) and I use a modified version of James Mastersen's monster cut and paste to generate my monsters. It's relatively simple for me to make PC tokens and Monster tokens but its not as easy as it could be. If I want others in my group to use MT as DMs I'm going to have to explain to them how to build monster and PC tokens using these tools I've cobbled together and hacked. It's not easy.

We all have a DDi subscription, so we all have access to the Compendium and the Character Builder. All our PCs are built from the Character Builder and when making my campaigns I nearly always pick and choose monsters already existing in the Compendium. I have used the Monster Builder to build a few monsters at times too.

So, I thought, if I could make a program which would very simply and easily create PC and Monster tokens for MapTool that would be dead handy. It would also make a good project to play around with for learning Java. Hence TokenMaker was born.


TokenMaker
TokenMaker has been designed to do two distinct jobs:
1. Make PC/Player tokens.
2. Make Monster tokens.
I'm going to address both of these separately. Note that TokenMaker is 100% geared towards making 4E D&D tokens and definitely requires a DDi subscription to use.

1. PC Tokens
What I want is a tool that will take an existing DDi Character Builder Save File and generate a Player Token for MapTool.
The idea would be simply that you select a ".dnd4e" save file and press build and off it goes. It can get all the basic stats for your PC from there. It can parse out the Powers. It can also get a portrait file - which will be needed to make a token. The only thing missing is the details of what the Powers do. But the program can look that up as we make the token, if we have access to the Compendium inside the program. Press a button and "pop", a token can be made and saved.

2. Monster Tokens
Building monsters is perhaps a little more complicated in places and easier in others. I want the facility to look up monsters by name ("Goblin" for example) and have it throw me up a list to pick from. Click on the name in question and pop up it's stat block. Then pick a portrait file and press a button and "pop", out comes a monster token.

This Thread
This thread is here for me to report my progress on this task. I'm going to use it to report when I've completed parts of the task and to brain storm ideas for what I want it to do next. Feel free to chip in and help out wth comments and suggests and critque.

My Coding Speed
One thing I should point out up front is that I'm a busy chap. I have a full time job, a family, I run a D&D campaign which needs a lot of time spent on it, and I have a good social life. I'll spend the odd hour on the PC coding up some java as and when I have the time and feel the desire to do so. So don't expect this project to be finished any time soon. In fact, if it's anything like many of my other projects it may well never get finished.
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 »

PC Parsing

Things I've got working so far:
  • Open the save file.
  • I can parse out the basic stats for the PC (name, level, class, etc)
  • Get the portrait file name.
  • I go through and pick out each Power the PC has.
  • With each Power I'm capturing their attack and damage stats per weapon equipped.

Things still to do:
  • Grab their skills
  • Make a GUI to handle/display all this.
  • The Whole MapTool side of things (building a MT token with macros for powers, etc, etc).

Basically I have some simple parsing working here and am getting most of what I want out of the save file and into a Object for the PC. I still need to scan Skills and then I'm about there, ready to start looking into how on earth I'm going to output this into an actual MT token.
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 »

Monster Parsing

I've made some good progress on here to date. One thing which has been really tough has been getting access to the Compendium programatically. It is easy to do searches on the Compendium, so getting a list of monsters with the name "Goblin" in them is simple. But actually getting the HTML code for a given monster has been a nightmare. Thanks to the usual very helpful people on this board I have now cracked that hurdle. This is what I have so far:

When you start up TokenMaker and tell it you want to build a Monster it pops up the frame below. You can type something you want into the "Name:" field and press "Find" and it goes off and finds all the monsters matching that name:

The Monster Maker
The Monster Maker
monstermaker.jpg (157.92 KiB) Viewed 5840 times


Selecting a monster and pressing the Build button (or double clicking the monster name) will pop up a new frame with the monster's web entry in it:

The Monster Build Dialog
The Monster Build Dialog
goblinunderboss.jpg (114.5 KiB) Viewed 5840 times


You can use the Portrait button to pop up a file chooser to select yourself a portrait file for this monster.

Still To Do
  • Add the portrait (thumbnail) that you select to the Builder Frame so you can see it.
  • Scan the HTML page we grabbed and populate the underlying Monster object - I suspect this will be a non-trivial task! Need to populate the Powers collection as we go.
  • Do the whole "Build a MapTool Token" thing.
Last edited by Blakey on Mon Jun 21, 2010 7:05 am, edited 1 time in total.
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 »

Frameworks

Before I can start building actual tokens I need to come up with a final plan for what I'm going to do with respect to Frameworks - if I'm going to make a new Framework to suuport this application or if I'm going to try and build tokens for specific existing Frameworks like Veggies and Rumbles. Much more thought is needed in this area.
The guy in the green hat.

User avatar
CoveredInFish
Demigod
Posts: 3104
Joined: Mon Jun 29, 2009 10:37 am
Location: Germany
Contact:

Re: TokenMaker

Post by CoveredInFish »

The cleanest solution would be to open your tool to support "any" framework - given someone wrote an "exporter class" (or whatever needed) for it. If you think now extendable it shouldnt be so much harder than to write one fixed solution.

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

Re: TokenMaker

Post by Blakey »

What's Next

I think I'm going to get both the PC and Monster scanning stuff working completely first. So I need to make sure I can get all the info I need from the PC save file and into the PC object. And I need to parse the Monster HTML and get that all stored in my internal Monster object. That's step one really.

Once that is done I have to have a serious think about how I get from my internal classes to actual MapTool tokens. I'm not even thinking about this yet!! :D
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 »

CoveredInFish wrote:The cleanest solution would be to open your tool to support "any" framework - given someone wrote an "exporter class" (or whatever needed) for it. If you think now extendable it shouldnt be so much harder than to write one fixed solution.


Yeah, excellent suggestion. I'll keep that in mind - thanks.
The guy in the green hat.

User avatar
jfrazierjr
Deity
Posts: 5175
Joined: Tue Sep 11, 2007 7:31 pm

Re: TokenMaker

Post by jfrazierjr »

Blakey wrote:What's Next

I think I'm going to get both the PC and Monster scanning stuff working completely first. So I need to make sure I can get all the info I need from the PC save file and into the PC object. And I need to parse the Monster HTML and get that all stored in my internal Monster object. That's step one really.

Once that is done I have to have a serious think about how I get from my internal classes to actual MapTool tokens. I'm not even thinking about this yet!! :D


Well... one option is to serialize the Monster/PC object as an XML document. Then the end user could provide an XSLT to transform the XML content from one form to another based on the token's internal structure (or some other intermediary structure. This would make it fairly simple for thinks like skills, abilities, to be stored no matter what the target framework's property names are. The powers are the big ugly piece here. Some frameworks store the power directly on the token macro, others store a JSON description of the power on the token inside the macro, others store the JSON description in a token property, and others store a JSON description on a Lib token... I am sure there are other combos I am not thinking of right now.
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

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

Re: TokenMaker

Post by Blakey »

jfrazierjr wrote:Well... one option is to serialize the Monster/PC object as an XML document. Then the end user could provide an XSLT to transform the XML content from one form to another based on the token's internal structure (or some other intermediary structure. This would make it fairly simple for thinks like skills, abilities, to be stored no matter what the target framework's property names are. The powers are the big ugly piece here. Some frameworks store the power directly on the token macro, others store a JSON description of the power on the token inside the macro, others store the JSON description in a token property, and others store a JSON description on a Lib token... I am sure there are other combos I am not thinking of right now.


I'm well away from getting here still, but I think this is a good idea. I'll probably provide some sort of simple XML output as a first step - using serialize as you suggest. People can then take them and run with them for their own frameworks in the short term.

I definitely want to be able to press a button and have it save a Token out of this tool when I'm all done. I suspect that the most likely approach I'll take here is to make myself a new Framework that this tool generates tokens for. As suggested earlier if I write an interface to represent "tokenizable" (!!!) then anyone can come along later and write a class to implement that interface for their own framework.

But this is way in the future!
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 »

Player Maker

Today I added a little frame to display the Player and let you load PC save files. It looks like this:

Player Maker Frame
Player Maker Frame
playermaker.jpg (127.35 KiB) Viewed 5820 times


This is with the 18th level wizard in my current campaign loaded. As you can see there is a list of all his powers in the middle of the screen and when you mouse over a given power a ToolTip pops up with the stats of that power with his first equipped weapon, for reference (although you can't see all the tool tip on this screen grab). Getting there.

Next up on PCs is to scan in Skills from the Save File and maybe display them on this frame.
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 »

Player Maker

Last night I added a little portrait onto the Player Maker frame. This is the default file that is held as the portrait for your PC inside the CB save file. It's enabled as a button so you can click on it and it will pop up a file chooser which will allow you to change the portrait displyed. This doesn't change the portrait on the character builder save file but when the time comes to build a MT token this is the portrait that will be used for the token.

It now looks like this:

Player Maker frame with a clickable portrait.
Player Maker frame with a clickable portrait.
playermaker.jpg (117.15 KiB) Viewed 5798 times


Next up - scanning the save file for Skill data and saving it with the PC object.
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 »

Quick update.

I've now got the PlayerMaker scanning the save file and grabbing out all the PC stats of significance and saving them away, including the skills. So basically I can now read a Character Builder save file and get everything out of it I think I need.

Today I have created a Token class to deal with actually creating a MapTool token. I have written all the code to create all the constituent parts of the token in the right places and then zip them up to make an rptok file. I've added some code to the PlayerMaker frame such that when you click the "Save" button it pops up a dialog box, asking for a save file name (*.rptok). Once that is selected it actually goes off and builds a plain MapTool token. Yay!

Trouble is, if you come to try and use the token inside MapTool it doesn't recognise it as a valid token. That whole side of things needs debugging and fixing up and then I'm at the stage where I can generate tokens from my saved PC files. Of course the tokens I'm creating have no MT Properties or Macros on them yet so we have a LONG way still to go.
The guy in the green hat.

User avatar
jstgtpaid
Giant
Posts: 142
Joined: Sun Jun 22, 2008 1:23 am
Location: Tampa, FL

Re: TokenMaker

Post by jstgtpaid »

Have you considered publishing your code as you go along? You could use google code as a repository, then folks can see what you have and possibly contribute.
When the boogeyman goes to bed everynight, he checks his closet for Chuck Norris.

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

Re: TokenMaker

Post by Hawke »

Very cool... would love this to be easily integratable (is that a word?) with Rumble's framework someday. Great work.

User avatar
kristof65
Dragon
Posts: 287
Joined: Tue Mar 31, 2009 9:48 pm
Location: Lakewood, CO

Re: TokenMaker

Post by kristof65 »

Are you concentrating on this being specifically for D&D, or a more general tool?

I'd love to see a more general tool, along the lines of what I suggested in this thread awhile back:

viewtopic.php?f=2&t=13036

Post Reply

Return to “Ideas for New Applications”