module dev help for a noob

I want to create a module for a game I designed myself.
For starters all I need is the basic green hexmap and a set of counters like the generic ones I can get in the palette(?). No fancy images, no markers, just combat units (and not many at that) with NATO symbols and say for now 5 text items which would vary from unit to unit.

I do not really see anything out there on how to go about doing this. Most of the documentation seems to emphasize presenting a description of menu items or Java classes, to an outsider newbie it seems more a description of what the developers did than a guide for the new user.

And looking at existing modules is just way too complex because they have too much stuff. I just have feeling this should be real real easy to do if I know what steps to take.

Can anyone help me out to get started?

I will provide more details.

Good news first…
I have made a Main Map with a Map Board and supplied it a Hex Grid with the background color and grid color I want for now (plus a zoom etc). And when I load the game it shows up. That is enough by itself to get me well underway until a much later time when I will need to start working on maps.

Now the tough part…
Under GamePieceImageDefinitions/GamePieceLayouts I added a “CombatUnitLayout” with a NATO symbol and a movement factor label to be “specified in individual images”.
Then under GamePiecePrototypeDefinitions I added a “CombatUnit” with Text label traits for strength and morale ties to properties, a marked when moved, a can rotate and a movement trail and a delete.
Then in my GamePiecePalette I added a Tabbed Panel “Austrian” with a single piece “AustrianTest” - no image (I want it to tie to the layout, not to an image file).

Problem is… when I load the game (inside the editor) it shows a blank un-named (tabbed with no name on the tab) pieces panel with no pieces at all.

Odd… when I load it from outside the editor the tab shows “Austrian” but still no piece in the panel. A bug? hey, being a part time s/w weenie I am not gonna huarang you for that, but it would be nice to know how to get my piece to show up so I can proceed.

Absolutely no idea what ties to what to make it work so I have no idea where that particular problem lies.

Any help?

Hi Irish,

A Game Piece Layout is like a template that you use to generate different pieces with the same general layout. It doesn’t actually generate any images itself. Under the Layout, you need to create some Game Piece Image Definitions in which you set specific attributes (colors, text, which symbol) and give the image a name. I recommend you add a ‘.png’ suffix to your image names. Let’s say you create one here called ge-3-2-3.png

In your Game Piece in the palette, you now need to specify what image you want to use. There are two main places where you might set the name of the image you wish to use - in the Basic Piece definition, or in a Layer trait.

For a basic counter, the best place is in the Basic Piece. Open the Basic Piece properties and click on the drop-down list. You should see ge-3-2-3.png in the list that you created in the Game Piece Image definition earlier.

Or double-click on the space just above the drop-down list to open a file dialog and use this to load in an image you have created in an external image program.

In the Module Editor you are using, there should be a Help menu and in the Help menu is a link to the Reference Manual.

Regards,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Thanks Brent, that did the trick and the tab name and piece show up, even without leaving the editor. I can drag it onto the map, move it, rotate it, change the strength points and morale values. Wohoo! My module with the one png piece is 4kB, and the actual file is nowhere to be seen in the explorer - all just interesting observations no questions there.

But there are a couple more questions, if you do not mind, and anyone who knows can feel free to answer (as I fear there may be a string of these - I will attempt to find the data I seek first within the module editor dox but I am sure there is going to be some items that depend to a degree on familiarity with the various ways in which the modules might be meant to be structured, which it will take time for me to acquire).

Right now I have strength and morale as text label attributes in the prototype (the movement text attribute is in the piece layout and works fine). When the piece is loaded into the palette it defaults to blank fields for these. My question(s) is(are)… how do I set up a propert value or whatever to (a) restrict these to numeric values, perhaps with a certain range, and (b) get a default value to load when the piece is placed in the palette?

EDIT - I managed to enter a default in the text label property, but it still treats this as a string rather than a numeric that can be range checked and bumped up and down in increments - which is what I am after.

Again, I appreciate the help.

okay more specific again…

I have, in the module editor under GamePiecePrototypeDefinition, edited my definition “CombatUnit” to include 3 dymanic properties (Strength, Morale, Movement) each numeric with increment/decrement controls on the right-click menu, for now.

I also have, in this same prototype definition, three Text Labels (StrengthLabel, MoraleLabel, MovementLabel) which I was using with fixed text fields (well, with user-editable strings via the right-click menu) and had these text labels with string fields working but with no connection to the properties.

Now I have tried to connect them, by (a) removing the commands for the user to edit the label strings on the right-click menu, and (b) using $Strength$, $Morale$, $Movement$ as the text field for the respective labels. Just in case, I have placed each dynamic property immediately above its respective text label in the prototype’s trait list.

This causes nothing to display. Actually, at various points during the process (after I started trying to connect the properties to the labels) the string for the property “Strength” or the initial value of the dynamic property “0” would be displayed (ie sometimes the property name would display in the pallete and would change to the initial 0 value when dragged onto the map), but now nothing. The good news is that I am not getting null pointer exceptions which was happening at those same interim points (after I started trying to connect properties to the labels) at various times on a module save, a module load, dragging the piece onto the map, or incrementing/decrementing the property from the right-click menu.

IMPORTANT EDIT - changed the order of traits, put dynamic property immediately below the respective text label. Now they show, and Movement (the bottom one of the three in the trait list in the prototype) works ie I can change by right-click. However, Strength and Morale do not update at least on the piece, not sure about in the innards.

So… (whew)…

How do I get the dynamic properties to be displayed by my text labels? Or is there something much better to do that I am completely missing here?

btw - happy to take a look at an example of this and try to figure it out - but the modules I am using for playing mostly do not do this kind of thing or do it using graphic layers of different images. so I would need a pointer to a module that using dynamic properties for variables shown on the counter (ie with text labels or somehow otherwise).

Thx.

okay - I note that in the text window your keystrokes that change dynamic properties via the right click menu do not display, but other keystrokes that do not change anything (including those after a numeric property reaches its limit) do display.

so… I notice when I type the key commands for my $Movement$ dynamic property that the respective text label adjusts and no key is shown on the main window. But when I type a key command for $Strength$ or for $Morale$ it shows up on the main text window.

This means that my dynamic properties are being displayed by their text labels correctly but that my key commands to change them are not being activated (including by clicking on the right-click menu items).

Also - oddly, changing the order of wether the dynamic properties are listed above or below the text labels in my prototype definition no longer seems to make any difference.

UPDATE - okay for no reason more commands started working…
m decrements $Movement$ down to limit of 0
M increments $Movement$ up to limit of 7
q decrements $Morale$ down to limit of 0

  • decrements $Strength$ down to limit of 0

but…
Q still no effect on $Morale$ (should increment) but shows up on main text window instead

  • still no effect on $Strength$ (should increment) but shows up on main text window instead

And of course, for the stuff that does work when you hit the limit it shows up on the main text window instead.

Any ideas what is happening?

Hi,

At this point, I think I need to have a look at your module. Can you email it to me b.easton at uws.edu.au.

Cheers,
Brent.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

okay I sent it.

Note I am at the point I am 99% sure I am doing it the way one is supposed to, saw some examples (had to dig) showing it (I think Tim M, maybe? thanks) and it follows exactly what I did, finally.

Differences are only (a) using multiple dynamic properties for apiece, (b) doing all that (dynamic properties attached to text labels) within a prototype instead of a piece itself, and (c) different keystrokes.

Since the values are displaying correctly and adjusting in at least one direction okay, I think it might be (c) that is the problem, odd. Unless putting multiple ones within the prototype is causing issues with reacting to the keys and changing the values?

keymap is…

M (lower case or ‘m’) decrement $Movement$ 7->0
SHIFT M (upper case or ‘M’) increment $Movement$ 0->7
Q (lower case or ‘q’) decrement $Morale$ 9->0
SHIFT Q (upper case or ‘Q’) increment $Morale$ 0->9
MINUS (the dash on the right of the number keys, think the keypad is a different one) decrement $Strength$ 12->0
SHIFT EQUALS (the ‘+’ to the right of the number keys, the one on the keypad definately different) increment $Strength$ 0->12

found the problem, something typical…

When you assign a value for increment you must type “-1” or “1”, ie not “+1”. (yeah, I know, it could be any number besides one or a property value)… counter-intuitive, but at least I know now…

I find it odd that the parser did not handle this, and did not throw an error. And that it acted like the key was not mapped or the value was at its limit.

btw this is DAYS calendar time and maybe 10-15 hours personal time of mine plus time from developer help just troubleshooting this one problem. the documentation for module creation does seem to be a little light.

I believe it uses the standard Java Integer parser (Integer.valueof(String)), which does not like ‘+’ signs!

B.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)

Exactly… and that parser does not chuck an exception when hit with something like that?
Nevermind, not that important to me, but I would think for the devs stuff like that would drive them crazy.

Anyhow, back to working modules, just wanted to close the loop on that issue.

On that note… for completeness sake attached is the fixed version, plus showing how I did the prototypes in a more sensible arrangement (more specialization to come I am sure).

This attachment now has one of my fav prints, public domain, slightly overplayed, for the splash screen. The only bit of chrome in an otherwise very graphically dull module, but hey just getting going. Too bad I do not know of many good prints of mid-C18 Austrian Cuirassiers. Also a help screen with an extremely breif rundown of some of the rule highlights (yes I know the game is a battalion game with brigade pieces right now).

keymap I am using for now…
Rotate CW = RIGHT-ARROW
Rotate CCW = LEFT-ARROW
Strength Point add = UP-ARROW
Strength Point subtract = DOWN-ARROW
Morale add = NUMBERPAD-PLUS
Morale subtract = NUMBERPAD-MINUS
Movement Factor add = CTRL-SHIFT-EQUALS (‘+’)
Movement Factor subtract = CTRL-DASH (‘-’)

Thus spake “IrishBouzouki”:

I’m reviewing exceptions right now. I’m sure it throws a
NumberFormatException, but we have hundreds of those which have empty
catch blocks. This needs cleaning up eventually, but it’s a long-term
project.


J.


Messages mailing list
Messages@forums.vassalengine.org
forums.vassalengine.org/mailman/ … engine.org

Post generated using Mail2Forum (mail2forum.com)