Print Page

Tuesday, November 3, 2015

Working on DunMap

Nothing to show yet on the map loading version of DunGen, but I have a name for it. Figured out so far how to draw into the canvas of the network, but that ends up on top and gets blown away instantly, so I figure I have to underlay a second canvas with the image, using Z-index, and find out how to make the background of the network graph transparent. Found the controls to turn off zoom and drag of the network, so the nodes should stay where they are put over the image.

So things are being a bit more difficult than I imagined, but I'm moving forward again. If this doesn't work out this way, I've been looking at the API and examples for leaflet.js, that does Google maps style tiled and zooming maps with markers. But those get to be big collections of preprocessed tiles at different zoom levels, so I'd need to use it in the load one image without zoom fashion, since I want to be able to load images from all over, and lay markers over them.

Postscript: I set the background color of the body tag to see if the graph canvas is transparent already. It is! Also, in trying the image load yesterday I noticed that Dyson's image URLs end in some GET arguments:   ? width = x height =y  I tried dropping the height and changing the width and it still got the image with it's scaling set by the width. I guess either Wordpress or a plugin to it has a feature to rescale images based on those arguments. That could be quite useful.

Wednesday, October 28, 2015

DunGen variant concept - Stock a Map

So, let's say you want to use DunGen to generate a dungeon key for a map you already have. There is a digital version of the map on a website like this blog or Dyson's or Matt's. What do you have to do currently? You first probably need to get out a graphics program and put numbers onto the map and save it. Then go into DunGen and set the size of the map to something close to the highest number on the map. Then add or subtract nodes until it matches. It doesn't really matter what the connecting edges are, since you are only interested in the node list. Then copy out the node table to a word processor file, maybe also copy out the notes field for the wandering monsters, relationships and any other notes you added. Edit nodes either before or after copying. Then paste the edited image into the file, and you have your dungeon scenario. It's a bit, um, tedious.

Here is what the experience could be:
You find a map you like, right click the image and copy the URL to it. You bring that back to DunGen and click a button for "Stock a Map" or something like that. The UI rearranges a bit, the current network clears, and you have a field to paste the URL in. Paste in, maybe hit a button, and the map image loads into the app. For my own maps, and maybe other map makers that opt in, there could be a select menu to just pick the map to use. Click a button for Place Nodes. Click onto each map feature that you want to be a numbered feature. As you click, it starts creating nodes, probably just showing room numbers in a small label initially, so as not to obscure the artwork. The node list fills in below the map image. When you are done, you can click that button again, which now says "Stop placing nodes", and then you can drag nodes around like usual. The nodes stay where you put them unless you move them. Reroll or edit nodes as necessary. When you save the dungeon, it remembers where you put the nodes and the URL of the map, along with the usual contents. When you load it, it sets back up the way you left it. There is no edge list, since the map image shows you everything you need to know in that regard. Seems to me this is about the easiest possible way to assemble a scenario  for a nice map in a hurry. The main downside would be that it does not store the map, so it if disappears from that URL, you would have to repoint it at another copy to see the map image again.

Maybe after awhile, there is an export to PDF that makes a PDF document of the map, key, and notes, in version 2 or 3 of the feature.

I've been mulling around an extraction from the app that would do this, and figuring it would be a moderately heavy project to learn what I needed about HTML5 Canvas to do everything needed to pull it off. Today I had a bit of an epiphany when I realized that the Vis.js library can do this for me, if I turn off the physics, use nodes as the labels, and make a graph without edges. I just have to write the rather small routine to put in the background image, change what gets created and stored (X,Y coordinates, map URL and scaling, etc, and change a bunch of settings. Not sure yet if it would be better to do it as a separate application webpage, or as a mode in the current one that you toggle into. Anyway, it should go together as a first version pretty quickly. It could even be integrated with an HTML5 drawing app to let you draw a map and then populate it. So far, I have started rearranging the current codebase, so that it will be easier to slot in new code that isn't about the current network graphs.

P.S. started coding. It will be a second page on the same site, the simplest thing that works.

Monday, October 26, 2015

DunGen - Fleshing out NPCs a bit.

Non player characters now have names, from a basic name generator. It will get better by iteration. They also have very rough stats now. You'll see some marked as "smart" or "strong" or "clumsy" or "uninspiring", etc indicating high and low attributes. They are limited to two high or low stats, since they represent what is exceptionally noticeable, and the line looks cluttered when there are more. Stats that aren't mentioned are midrange. You might want to figure that a dullwitted mage is actually about normal intelligence, at the bottom end of mages, and make similar accomodations to class minima. The really lucky NPC also gets a magic item, beyond whatever is in the room loot. Higher level NPCs tend to have items more often and better weapon and armor bonuses on their items. The item might even be useful for the character's class, but that's purely random currently.

Here's the unedited key from the previous post's map as an example:

LocationDescription (click in a cell to edit)
1: QuartersHook: symbolic piece of jewelry
2: MillM: 1 scheming porting hound
Hook: inscription on wall
3: QuartersM: 16 lizards, one is sick
Ts: 4156 silver, Jewelled Belt worth 1454 GP
Mg: Potion of Disguise
Mg: Potion of Silence
4: BarracksA water drain channel in the floor
5: TowerM: 2 hell hounds, one is eccentric
Ts: 48921 copper
Mg: Wand of Spell Penetration (-2 to target save vs spell)
Mg: Potion of Treasure finding
6: SewerEmpty
7: Guard roomM: 16 veteran adventurers:
Zormund: wise assassin 1
Staazor: thief 2, has Leather armor +1,
Frovinc: paladin 2
Jasud: dullwitted assassin 2
Ninmund: cleric 2
Winsind: weak, insane warlock 2
Goromir: delicate, bantering druid 1
Henwhistle: delicate, smart cleric 2
Gorwhistle: uninspiring, weak mage 2
Bavend: foolish, eccentric assassin 1
Banmund: weak cleric 1, has Strong healing potion
Omerdor: illusionist 1
Aescdon: thief 1
Anick: mage 2
Gaiessa: ranger 1, has Wand of Firestarting
Noskand: tough, charismatic fighter 1
8: LockupMushrooms
M: 8 veteran adventurers:
Atriril: tough, clumsy, forthright fighter 3, has Broadsword +3,
Quiond: cleric 4
Denthor: exceptionally well armed sorceror 3
Bengast: weak shaman 5, has Codex
Norvend: starving ranger 4
Enasud: fighter 5, has Clown suit of Creepiness
Nindred: weak, stoned thief 4
Quezul: foolish mage 4
Hook: captive
9: WellTp: burning oil trap
M: 6 ensorcelled giant snakes
M: 1 heroic adventurer:
Dorskand: assassin 5
Ts: 41 x 10 GP gem, Vessel worth 498 GP
Mg: Staff of Power
10: BarracksTs: 1870 gold, 1 x 600 GP gem, 935 gold
Mg: Scroll of spells
11: KennelM: 3 heroic adventurers:
Lesud: fighter 8, has Dagger +4, +2 damage to favored enemy
Enavinc: cleric 6
Gantros: condescending shaman 6, has Scroll of spells
Ts: 1 x 300 GP gem, 212 gold, 212 gold
12: QuartersM: 2 giant spiders
13: StablesM: 2 tired giant lizards
Hook: howling wind
14: Barricaded entranceThe door closes behind with a slam.
15: QuartersHook: distinctive arrow, quarrel, or sling bullet

It shows the bug where novice adventurers are sometimes labeled as veterans. Need to chase that down. But hey! Names, roughed in attributes, and magic items on guys!

Sunday, October 25, 2015

DunGen styling is working



Check out the Style button. Since last post, there are now several style attributes that can be changed, to be used in generating a new dungeon or applied to the current one, and the edit dialogs for nodes and edges let you custom style individual ones, so you can do things like visually call out the entrance and the boss room, or color sets of rooms by faction. The code for all the dialogs is much cleaned up if you want to look behind the curtain.

Handy link:  DunGen

There are a lot more attributes that can be styled in the VisJS engine, so many that to expose them all would be both tedious and a really cluttered UI, so plans are to add just the ones that seem most useful.  The one I am most excited about trying is to add images to nodes. I'll  need to collect or draw a batch and add image setting to the UI.  For now though, it is pretty good proof of concept on styling and I'll shift back to adding content.




Wednesday, October 14, 2015

Small DunGen update - beginning of a styling dialog

This time, it only handles two properties, edge width and background color, with limited options for each. More importantly, it lays down the pattern for restyling at generation of a dungeon level.  I'll flesh that out a bit more, and then add styling of individual nodes and edges, so you'll be able to do things like place direction arrows on stairs and slides, make water edges blue, and mark a special room in red. Anyway, its nice to shake some rust off...

Sunday, October 11, 2015

Sushi mat rope bridge terrain project

Saw these sushi mats in the grocery store yesterday for something like $1.50 and $2.50, and my terrain making pattern recognition went PING!  Rope bridge? Japanese fence? The issue was going to be in cutting them down their length reasonably evenly.
The "raw material"
 So this morning I dug out my razor saw and got to work on a first try. I started by trying to lay one out flat and cut a bunch of the bamboo sticks at once but it wiggled too much to get very far that way, too much of the energy was wasted moving stuff that I wanted held still.

You can see some of the scoring from my initial attempt at cutting flat here, and how I held it to cut a stick at at time.

Progress...

Bridge cut out. On to working it into a terrain piece...


The trick turned out to be to hold up an edge, cut a stick at a time and bend the two sides down in opposite directions as I went, since it is very flexible. I had a bit of trouble with the last few fibers of a stick splitting away sometimes instead of sawing through. It would probably all be tidier if I had the work clamped in a big clamp instead of using my left thumb and forefinger as the increasingly sore clamp. But hey, I got through the whole thing pretty quick once I got the hang of it.

It might be worth it on the next one to lay a bead of thinned PVA white glue into the binding string and letting it dry first to keep the skewers even and not sliding during the work.  It might also help to avoid the loosening of the binding strings during the cutting.

Thursday, October 8, 2015

Frostgrave setup variant

Saturday we played our first game of Frostgrave. We had four players, and somewhat larger table size, with ruins running roughly diagonally, so I tweaked the setup rules:

Set out four setup zone markers, each about 6 inches out from the ruins and space out pretty evenly around the table. Each player will setup within 3 inches of one of these markers.

Each player will set up three treasure markers, one at a time, in rotation around the table. Each treasure marker should be 9" or more from a board edge, 9" or more from a setup marker, and 6" or more from any other treasure marker.

Roll randomly for which wizard sets up from which setup marker after treasure markers are out.

This should lead to more interesting set ups than "I set up my treasures as close as possible to me and you set up yours as close as possible to you", so they go to the places that seem more like treasure locations in the scenery. But they'll go out in a reasonably balanced fashion since you don't know who starts where.

Aaron looks over the table after terrain setup. We didn't do use the ice floes and boats at the far end as playable ground in this scenario, but might do something with that later. The buildings are TerraClips printed cardboard terrain, mostly from the Streets & Buildings of Malifaux sets, with some pieces from the dungeons sets.

Dave's Elementalist warband

 My archers and undead wardogs mistakenly pile up in cover, soon to be fireballed by Dave's Elementalist Apprentice.

John's goblins are heading up the stairs with one treasure marker and heading for the one near the altar atop the building to the right. But then they are surprised by a White Ape that appeared as a wandering monster in response to another pickup. Instead of starting all monsters from an edge, we diced a random grid position on the table, by dividing a long edge and a side edge into die increments. The ape popped up about 3" from the goblin treasure bearer.

 Aaron measures a move as John looks on. We played in John's kitchen.

 My Necromantic gang tries unsuccessfully to jump Dave's guy carrying away from the cauldron, but we did get his Apprentice that was covering the withdrawal.
John's Goblins chased up the stairs by the White Ape. Wounding it at the base of the stairs only infuriated it and it took out two goblins and chased the Orc Wizard right off the roof before he could grab the loot there.



Wednesday, August 19, 2015

Scry Overflow

In any sufficiently advanced magic using culture there should be commodity magic items or spells capable of accessing the magic equivalent of Stack Overflow.

"How did we ever do magic before Scry Overflow?" the apprentice wizard asks while cut and pasting a demon summoning that goes horribly wrong.


Wednesday, August 12, 2015

Rails callback sequence with observers and model inheritance

 Cleaning up a tangle of callbacks I need to know the order they fire in to guide my refactoring. I ran this experiment in a tiny rails app with Rails 4.0.9 and the 'rails-observers' gem to match a legacy app I am working on, upgrading soon.

I made a mini rails app with two models, one inheriting from the other:

class Thingy < ActiveRecord::Base
  after_create :thingy_created_callback
  def thingy_created_callback     
    puts "thingy_after_create_callback"
  end 
end

class SpecialThingy < Thingy   
  after_create :special_thingy_created_callback
  def special_thingy_created_callback 
    puts "special_thingy_after_create_callback"
  end 
end

Made an observer to observe each:

class ThingyObserver < ActiveRecord::Observer   
  observe Thingy   
  puts "ThingyObserver loaded"
  def after_create(thingy)
    puts "ThingyObserver.after_create"
  end
end


class SpecialThingyObserver < ActiveRecord::Observer   
  observe SpecialThingy   
  puts "SpecialThingyObserver loaded"   
  def after_create(thingy)
    puts "SpecialThingyObserver.after_create" 
  end 
end

When creating an instance of SpecialThingy at console, I see the results in this order:

thingy_after_create_callback
special_thingy_after_create_callback
SpecialThingyObserver.after_create
ThingyObserver.after_create

Sunday, August 2, 2015

What's next in DunGen

Got in some work this morning on the graph styling. Will let you set colors, shapes and borders on nodes, and line width and color of edges. The first editor that I am maybe half done on will be for the overall graph, then a second pass will add to the individual node and edge editors so you can call out an important room in red or with a star shape, or put an arrow on the downhill end of a slide or make water edges blue. Thinking about custom defaults being different for particular types of nodes and edges too, but may not go into that.

Another thing that will be coming pretty soon is to add theme tagging to the hooks and oddities tables so that there can be different lists of set dressing in a castle vs a temple vs a creepy horror setting. You'll only generate a litter of corpses if going totally random or you want stuff like that.

Lastly, I'm thinking to add tweak buttons to the node editing dialog (+Trap), (+Hook) (+Monster) (+Treasure) (+Oddity), so you can just add  a roll for one of them, not a total reroll.

Still mulling ideas about other mapping styles, more monster lists to add in - maybe a branch that does EPT lists instead of D&D, maybe swap in lists tailored to particular OSR rules instead of my personal mish mash. One possible map style would be to draw up a set of semi-geomorphs and record for them the points at which room numbers would go, so they could be tiled onto a canvas, room numbers overlaid, and then contents generated to match the room numbering. The result would be a traditional looking map with some flexibility and nicer looking than I could probably procedurally generate from code.