Sunday, May 15, 2011

D&D BattleMap Using the UDK – Placeable Zones

Normally I wait until the end for the big “reveal”, but this is too cool not to show off:


Our first implementation of zones involved creating a plane object with a scripted texture.  Color and text were passed to the object which would draw the text on a canvas and apply it to a Material Instance.  And of course, it had the same positioning code as the torch.

However now that we’re making use of UDK’s ScaleForm UI, I thought we could pull off some pretty spectacular effects with Flash.  We’re not including text (yet), but the tradeoff is worth it.  Like the grid, it takes a LOT less code to implement the zones in Flash.

We’ll continue to use our existing BMSpawn, BMInteract, BMModify and BMDelete functions to start things off, but all the work will done in similar functions in ActionScript.  Essentially, we’ll blindly “toss up” the commands to ActionScript and let it handle them with its own Spawn, Interact, Modify, etc.

First, let’s update our UnrealScript functions.

BattleMapGfxHud.uc

Add the following wrapper functions to BattleMapGfxHud.  Note that most of these do not expect a return value.  We’re just forwarding the command along.  The UnrealScript code doesn’t care how ActionScript handles it.  Except for InteractObject(), and all we need to know there is if we actually did click on something.
function CallSpawn(string Param1)
{
 ActionScriptVoid("Spawn");
}

function int CallInteractObject()
{
 local int ObjectFound;
 ObjectFound = ActionScriptInt("InteractObject");
 return ObjectFound;
}

function CallModifyObject( int Param1 )
{
 ActionScriptVoid("ModifyObject");
}

function CallDeleteObject()
{
 ActionScriptVoid("DeleteObject");
}

function CallSwapObject( int Param1 )
{
 ActionScriptVoid("SwapObject");
}
BattleMapPlayerInput.uc

We need to extend our existing functions for new “zone” objects.  In BMSpawn(), add this to our switch statement:
   case "Zone":
    BattleMapHUD(myHUD).CrossHairMovie.CallSpawn("Zone");
    break;

The BMInteractObject() function tracks what we selected.  In this case, we don’t necessarily know the specific item since ActionScript is handling it.  So, we’ll just track that our CrossHairMovie object is selected since we know something in there is.  (Yes, in hindsight, “CrossHairMovie” probably wasn’t the most appropriate name for that.  Note to self: fix that later…)  In the first switch statement which stops selecting, add:
    case "CrossHairMovie":
     BattleMapHUD(myHUD).CrossHairMovie.CallInteractObject();
     ObjectSelected = none;
     break;

After the next switch statement that determines what we selected, add this CallInteractObject() check.  If ActionScript tells us that it selected something, then we track that the CrossHairMovie has something:
  if(BattleMapHUD(myHUD).CrossHairMovie.CallInteractObject() > 0)
  {
   ObjectSelected = BattleMapHUD(myHUD).CrossHairMovie;
  }
In the BMModifyObject() switch statement, pass the modifier along:
    case "BattleMapGfxHu":
     BattleMapHUD(myHUD).CrossHairMovie.CallModifyObject(Modifier);
     break;

Yes, the case parameter is correct.  The switch statement checks the first 14 characters of the object type, not the name.

Replace the entire BMDeleteObject() function with the code below.  We need to add an “object deleted?” check throughout the function.  Since it would be easier to click inside a large zone than a torch, we want to track if we actually deleted an UnrealScript object first so that we don’t accidently delete multiple items in both UnrealScript and ActionScript.  If nothing was found, then we pass the command along:
exec function BMDeleteObject()
{
 local BattleMapTorch To;
 local BattleMapBlood Bl;
 local bool ObjectDeleted;

 if (WorldInfo.NetMode == NM_Standalone || WorldInfo.NetMode == NM_ListenServer)
 {
  ObjectDeleted = false;
  switch(ParseObjectName(ObjectUnderMouse))
  {
   case "Torch":
    foreach DynamicActors(class'BattleMapTorch', To)
     if (To.Name == ObjectUnderMouse)
     {
      To.Destroy();
      ObjectDeleted = true;
     }
    break;
   case "Blood":
    foreach DynamicActors(class'BattleMapBlood', Bl)
     if (Bl.Name == ObjectUnderMouse)
     {
      Bl.Destroy();
      ObjectDeleted = true;
     }
    break;
  }
  if (!ObjectDeleted)
   BattleMapHUD(myHUD).CrossHairMovie.CallDeleteObject();
 }
}
Finally, add a new BMSwapObject() function.  Our ModifyObject() function increases an item’s size, for example, but BMSwapObject() will exchange it for something else.  Like different blood decals, or a sunrod in place of a torch, or different types of zones:
exec function BMSwapObject(int Modifier)
{
 if (WorldInfo.NetMode == NM_Standalone || WorldInfo.NetMode == NM_ListenServer)
 {
  if (ObjectSelected != none)
  {
   switch(Left(ObjectSelected, 14))
   {
    case "BattleMapGfxHu":
     BattleMapHUD(myHUD).CrossHairMovie.CallSwapObject(Modifier);
     break;
   }
  }
 }
}

DefaultInput.ini

We need three more keybindings for spawning a zone and swapping an object:
.Bindings=(Name="Z",Command="BMSpawn Zone")
.Bindings=(Name="LeftBracket", Command="BMSwapObject -1")
.Bindings=(Name="RightBracket", Command="BMSwapObject 1")

Photoshop/Gimp

Now, something new.  The zones are three layered images rotating in different directions animated in Flash.  The runic circles themselves are brushes from Obsidian Dawn.  At the bottom of their page, they provide instructions for importing and using the brushes.  Essentially, we:
  • Created three layers in a transparent image
  • Chose a color
  • Painted a large, medium and small runic circle on its own layer
  • Align the circles
  • Crop and resize the image to a power of 2 (256x256, 512x512, etc.)
  • Save as PNG into the .\UDKGame\Flash\BMHud\BMHud folder along with the cursor
Flash

To get the circles animating, import the individual images into Flash.  Don’t forget to update the properties of each PNG file to “Lossless (PNG/GIF)” Compression, otherwise they won’t import into the UDK:

Next, create a new Symbol.  Just as in Photoshop/Gimp, create three layers and put a rune image in each later.  (If you lined them up correctly before cropping/saving earlier, then here you simply need to stack them perfectly on top of each other.  If not, you can still make fine adjustments here.)

Insert a frame way out on the timeline for however long you want the animation to run.  Ours goes 360 frames, which is 15 seconds at 24 fps.  We didn’t want to cause epileptic seizures with fast spinning circles.  Create a motion tween on each later, setting the number of rotations and the direction:


Once you’re done creating your runic circle, edit the symbol’s properties in the library:
  • Enable “Export for ActionScript”
  • Enable “Export in frame 1”
  • Enter an identifier.  Ours are CircleXXX.  (CircleBlue, CircleGreen, CircleRed, etc.)
ActionScript

Once you’re done creating all your circles, we just need to add object manipulation functions to ActionScript.  First, a simple Spawn function:
function Spawn(Param1:String)
{
 switch(Param1)
 {
  case "Zone":
   SpawnZone();
   break;
 }

}

Next, a function to create a zone.  This function will perform a double duty.  It will create a brand new zone, as well as replace an existing one.  It does that by creating a zone at the same level as an existing one.  (Flash allows one movieclip per level.)  So, the function accepts input parameters to predefine a zone’s color and shape, or sets defaults if none are provided.

To keep things simple, we’re also performing some slight-of-hand with the movieclip’s properties.  We need to track two things: which symbol this zone is using and what level it’s on.  Rather than creating a custom class to extend movieclip for two properties, we’re going to appropriate existing properties.  We’ll attach the level to the zone’s name (since both the level and the name need to be unique anyway, it seemed a good fit), and store the type of symbol in the taborder property.

“Wait, what?”  Yeah, that’s kinda tricky.  Flash doesn’t provide a property to determine what linkage type a symbol instance was created from.  So, we’ll store our linkage names in an array then save the individual index in the taborder property – also an integer value.  Which as it turns out, makes it easy to swap instances since we simply need to rotate the index number:
var Zones:Array = Array("CircleBlue", "CircleGreen", "CirclePurple", "CircleRed", "CircleYellow");
// Param1:Name, Param2:Index, Param3:x, Param4:y, Param5:scale
function SpawnZone(Param1:String, Param2:Number, Param3:Number, Param4:Number, Param5:Number)
{
 var ZoneName = (Param1 != undefined) ? Param1 : GetNextZone();
 var ZoneIndex = (Param2 != undefined) ? Param2 : Math.floor(Math.random() * Zones.length);
 var ZoneX = (Param3 != undefined) ? Param3 : _root._xmouse;
 var ZoneY = (Param4 != undefined) ? Param4 : _root._ymouse;
 var ZoneScale = (Param5 != undefined) ? Param5 : 70;
 var ZoneLevel = int(ZoneName.substr(4));

 var z1 = _root.attachMovie(Zones[ZoneIndex], ZoneName, ZoneLevel);
 z1._x = ZoneX;
 z1._y = ZoneY;
 z1.tabIndex = ZoneIndex;
 z1._xscale = ZoneScale;
 z1._yscale = ZoneScale;
}

function GetNextZone()
{
 var LastZone:Number = 1;
 for (var RootObject in _root)
  if (RootObject.substr(0, 4) == "Zone")
   LastZone = (int(RootObject.substr(4)) > LastZone) ? int(RootObject.substr(4)) : LastZone;

 return "Zone" + (LastZone + 1);
}
Implement the InteractObject() function to handle clicking an item.  This works exactly like its UnrealScript counterpart.  On each mouse click it first stops interacting with whatever may be currently selected, then tries to find a new item to select:
var ObjectSelected:String;
function InteractObject()
{
 var PrevObjectSelected:String;

 //stop Interacting with existing object
 if (ObjectSelected.length > 0)
 {
  DragObject("");
  PrevObjectSelected = ObjectSelected;
  ObjectSelected = "";
 }

 //find new object to interact with
 for (var MousedObject in _root)
 {
  if (_root[MousedObject].hitTest(_root._xmouse, _root._ymouse, false))
  {
   switch (_root[MousedObject]._name.substr(0, 4))
   {
    case "Zone":
     //find zones, but not the one we had clicked on
     if (_root[MousedObject]._name != PrevObjectSelected)
     {
      ObjectSelected = _root[MousedObject]._name;
     }
     break;
   }
  }
  if (ObjectSelected.length > 0)
  {
   DragObject(MousedObject);
   return 1;
  }
 }
 return 0;
}
When moving torches in UnrealScript, we set the object to either a moving or stationary state.  The moving state updated itself every tick to the mouse’s position.  Here, we can let Flash do all the work.  Just like our custom cursor, we tell Flash to drag around our symbol.  Flash will only drag one item at a time, so we hide our cursor symbol and reattach it when we’re not dragging something else:
function DragObject(ObjectDragging:String)
{
 if (ObjectDragging.length > 0)
 {
  CursorInst._visible = false;
  startDrag(ObjectDragging);
 } else {
  CursorInst._visible = true;
  startDrag("CursorInst", true);
 }
}

ModifyObject(), again, works just like the UnrealScript version.  It determines what’s selected, then takes an appropriate action.  For a zone, we modify the scale:
function ModifyObject(Param1:Number)
{
 if (ObjectSelected.length > 0)
 {
  switch(ObjectSelected.substr(0, 4))
  {
   case "Zone":
    _root[ObjectSelected]._xscale *= (1 + (0.1 * Param1));
    _root[ObjectSelected]._yscale = _root[ObjectSelected]._xscale;
    break;
  }
 }
}
DeleteObject() first calls InteractObject() to see if there’s something under the mouse to delete.  If so, delete it, then start dragging the cursor again:
function DeleteObject()
{
 InteractObject();
 if (ObjectSelected.length > 0)
 {
  _root[ObjectSelected].removeMovieClip();
  DragObject();
 }
}
Finally, a new function SwapObject().  This will swap an existing zone for another.  It simply records the properties of the selected zone then passes those to SpawnZone().  Since it’s inserted at the same level, Flash removes the old one for us.  The modifier we pass in determines which direction we loop through the array of linkage names:
function SwapObject(Param1:Number)
{
 if (ObjectSelected.length > 0)
 {
  switch(ObjectSelected.substr(0, 4))
  {
   case "Zone":
    var ZoneID:Number = _root[ObjectSelected].tabIndex;
    ZoneID += Param1;
    ZoneID = (ZoneID >= Zones.length) ? 0 : ZoneID;
    ZoneID = (ZoneID < 0) ? Zones.length - 1 : ZoneID;

    SpawnZone(_root[ObjectSelected]._name,
        ZoneID,
        _root[ObjectSelected]._x,
        _root[ObjectSelected]._y,
        _root[ObjectSelected]._xscale);
    startDrag(ObjectSelected);
    break;
  }
 }
}

Now, fire up the UDK Editor and reimport your BMHud SwfMovie.  Make sure the package also imported all your circle images.  I’m not sure when it was fixed, but the FrontEnd is now smart enough to detect the updated package so you shouldn’t have to manually copy it into the CookedPC folder.

Last but not least, by request, a way to toggle the debug text.

DefaultInput.ini

Bind a key for toggling debug mode:
-Bindings=(Name="Q",Command="GBA_ToggleTranslocator")
.Bindings=(Name="Q",Command="BMDebug")
BattleMapPlayerInput.uc

Add a function for toggling debug mode:
exec function BMDebug()
{
 DebugMode = !DebugMode;
}
BattleMapPlayerController.uc

At the top add a declaration for a DebugMode variable:
var bool DebugMode;

BattleMapHUD.uc

In the PostRender() event, wrap the debug string and DrawText() in a condition:
 if (bmPlayerController.DebugMode)
 {
  StringMessage = "NetMode=" @ WorldInfo.NetMode @ "\nMousePosition=" @ bmPlayerController.MousePosition.X @ "," @ bmPlayerController.MousePosition.Y @ "\nMouseOrigin=" @ mouseOrigin.X @ "," @ mouseOrigin.Y @ "," @ mouseOrigin.Z @ "\nObjectUnderMouse=" @ traceHit.Name @ "\nObjectClass=" @ traceHit.Class;
  //`Log(StringMessage);

  Canvas.DrawColor = GreenColor;
  Canvas.SetPos( 10, 10 );
  Canvas.DrawText( StringMessage, false, , , TextRenderInfo );
 }
Thanks for the suggestion DrZuess.

BattleMap mode source files

45 comments:

  1. Yay, zones are working like a breeze, thanks very much they are indeed very cool. :)

    And many thanks for adding the HUD display toggle, I can now take some hires screenshots for VTT play.

    ReplyDelete
  2. Hey, guys, im having a problem, whenever i make changes to the BMHud file it crashes :S.
    it works fine as long as the flash file only contains the grid and cursor, when i add something new, the cursor dissapears and it crashes when i hit G

    ReplyDelete
  3. When you save and publish your BMHud scene, check the Compiler Errors tab and make sure it's clean before reimporting into UDK. If so, add some `Log() statements in UnrealScript and matching trace() statements in ActionScript to ensure that each call is getting passed along correctly.

    ReplyDelete
  4. sorry but im kinda noob at scripting, the compiler tab is clean, so how do i do that last thing u mentioned?

    ReplyDelete
  5. I like to say a big THANKS to ZombPir8Ninja for this. I'm excited to try and get it up and working. I've read through all the blog posts, and watched all the videos.

    This weekend I've tried to put together the project myself. I've build a sample level (following the youtube video), and I've built the flash file with the Grid, and the cursor. When I put everything together, I get the custom cursor just fine, but I can't get the Grid to toggle on.

    I added a trace to the GridToggle function, but it doesn't work. In the mouseListener functioning, I added
    GridInst._visible = !GridInst._visible;
    to turn the Grid on and off when I move the mouse. This works, and I see the Grid when I move the mouse. It's just as if the game isn't receiving any player input.

    In the DefaultInput.ini file, I have
    .Bindings=(Name="BMGridToggle",Command="BMGridToggle")
    -Bindings=(Name="G",Command="GBA_SwitchToBestWeapon")
    .Bindings=(Name="G",Command="BMGridToggle")

    To add the command and then remove the default keybinding and add our own, but it doesn't seem to work.

    I also see that pressing T turns on chat, even when I have added the spawn torch bindings. If I go in and just delete out the original keybinding, it still will not work.

    Am I missing a simple step in order to get our DefaultInput.ini keybindings to work in the CookedPC folder?

    I feel kind of silly asking, but I've googled and looked through some tutorials, but I can't seem to figure it out.

    Thank you for this project, and any help will be appreciated. Hopefully I'll be able to sort this out quickly. I'd love to catch up and get ont he same page as everyone else and see if I can help out in any way to expand this great project.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. Based on trial and error, i found that the crash occurs, when the movieclip CircleRed (the only i made so far) has the "Export for ActionScript" and "Export in frame 1" properties cheked. But of course, if they are not checked the zones wont spawn. So still i got no placeable zones on my maps :(
    also, when i import BMHud into UDK, it wont import the images on the BMHud folder
    any advice will be most welcome, cause its driving me crazy :P

    ReplyDelete
  8. maybe this helps you Todd:

    For the grid, remember to give it the instance name GridInst on the properties tab so the action script knows what to call when you press G. Also, drzeuss and i have a bit of an issue too wich the grid wont show inmediatly as u press G but if u scroll with the mouse wheel for rezising it, it eventually appears

    for the torch, check if you saved it on the right asset package under the right name i think it was
    BattleMapAssets.PSTorch (first title package name, second file name, remember that its case sensitive also)

    my two cents based on my personal experience, hope it helps you too

    ReplyDelete
  9. Fixed it :D :D :D its gorgeous

    as usual, my mistake was a basic one, didnt changed the png's to lossless, thats why it wasnt importing them to UDK and making the HUD to crash, now its working wonderfully

    idk if you guys play 4e, but this script could be easily used to place marks too, and i think it doesnt even need a different keybinding, i think i just make other objects and swap them along with the zones, may take a bit to find the right one, but i think itll work just fine.

    ReplyDelete
  10. Todd, something to check in addition to the comments from Gerar, I also encountered some initial problems with not getting the Grid to display, in the end it was down to me not launching the game in fullscreen mode - in line with the resolution settings I had defined in DefaultEngine.ini, DefaultEngineUDK.ini, UDKEngine.ini and BattleMapHUD.uc. Make sure the resolution is set identically in the files and then make sure you are launching the game in window/fullscreen in line with the settings you have defined.

    In my setup unless I launch the game and run it in full-screen 1440x900, the grid will not display.

    Gerar - I had the problem with the circle images not importing into UDK for the same reason. You can tell that the import has worked as the Content Browser will list the circle images along with the SWF movie in BattleMapHud. Also the size of the .upk file will be much larger.

    BTW ZomBPir8Ninja - I still had to manually copy the file to the CookedPC folder, what version of UDK are you all using? I am using the April Beta version.

    Also - there is a formatting error on the blog - for the BMInteractObject() instructions, the 2nd block has merged the code regions with a comment/instruction.

    ReplyDelete
  11. DrZeuss:
    Im using the second Beta of march and do not have to copy the BattleMapHud.upk file to cooked folder, it wont appear on the folder though, but its not necessary, the Hud still shows when i launch the game.

    I recently downloaded the may beta, but still havent tested it

    ReplyDelete
  12. Guys, thanks for the helpful suggestions. I've read through the blog comments on the older posts, so these have been really helpful in troubleshooting.

    Gerar - From the older posts, I found to change my Flash symbol instances to be named properly. They are named correctly, and I see the ActionScript working. I put trace code in the MouseListener function and I put code in the mouse listener function to toggle the grid. When I move the mouse, the cursor is updated, and the Grid toggles, verifying to me, that the instances are named correctly, and the ActionScript code is working. I also changed the default value of the Grid to be visible, so I see it immediately as the game launches.

    DrZeuss - I went through all the files and verified that I'm using the same resolutions across the board. As I mentioned above, when I manually set the Grid in the Action Script to be visible, I can see the grid.

    From the tests I've done and some debugging work, it appears that the actionscript functions are not being called for anything other than mouse movements. Even with the Grid visible, the mouse scroll wheel does not adjust the scale of the grid. I've tried switching up the keybindings in DefaultInput.ini, but they do not seem to work at all. For instance, no matter what I bind "T" to, it always opens the chat channel.

    It would seem I have some weird issue with it not accepting the keybindings. I'll have to look at it again tonight.

    Thanks for all your help guys.

    ReplyDelete
  13. @Todd: If the DefaultInput.ini file already has a key bound to a function, you'll have to unbind it first before you can use it. For example, using the "G" key to toggle the grid requires two entries (note the dash to remove an existing binding): -Bindings=(Name="G",Command="GBA_SwitchToBestWeapon") then .Bindings=(Name="G",Command="BMGridToggle")

    ReplyDelete
  14. @DrZuess: We're also using the April Beta. I double-checked the /CookedPC folder and the BattleMapHud.upk no longer appears in the folder. So, it may not need to be there at all anymore. And the BMInteractObject() instructions above (at least what I see) are correct. Two separate pieces of the function are updated.

    ReplyDelete
  15. By the way, it isn't called out specifically in the post, but a link to the latest copy of the code is provided at the end as "BattleMap mode source files". If you're having trouble, you can always compare your code with ours.

    ReplyDelete
  16. ZomBPir8Ninja - OK I'll double check again, although the May beta is out now.

    For BMInteractObject(). After the block of text that starts with "After the next switch statement" in the following code block, the following line is included formatted as code:

    In the BMModifyObject() switch statement, pass the modifier along:

    ReplyDelete
  17. Guys im not sure if this is how its supposed to work, but the zones wont stay in the floor where i place them like the blood and the torches, if i move foward, the zones moves as well.

    ReplyDelete
  18. Gerar - Its the same for me. I believe its because the Flash elements are relative to the screen and not the world as per the UDK objects like torches, blood etc. etc.

    ReplyDelete
  19. oh right, thats probably it, same happens with the grid now that you mentioned it,

    still, they look awesome :D

    ReplyDelete
  20. BTW, id like if you still have it and wanna share it, the code for the old square zones, just to have another option and maybe use it as markers, thx in advance :) keep up the excellent work

    ReplyDelete
  21. @DrZuess: Fixed the code block. Thank you.

    ReplyDelete
  22. RE: Zone Placement. Correct, the zone objects are in the 2D HUD (as is the grid), not the 3D environment with the map. They will remain in place on screen if the map is repositioned. @Gerar: Adding marks and tokens is an excellent idea. ;-)

    ReplyDelete
  23. Did anybody tried the May Beta? cause it wont Cook the code for me, it just launches de default UT game, and now all of a sudden, the march beta wont cook it either ¬¬ and i havent changed a thing!

    ReplyDelete
  24. This is what im getting, tottally new form me, hadnt happened before

    Warning, Mismatched Guid while merging guid caches for package Core, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package Engine, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package GameFramework, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package IpDrv, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package GFxUI, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package UnrealEd, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package GFxUIEditor, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package OnlineSubsystemSteamworks, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package UDKBase, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package UTEditor, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package UTGame, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package Pickups, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package CH_Gibs, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package Envy_Effects2, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package battlemapHud, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package BattleMap, overwriting with Other
    Warning, Mismatched Guid while merging guid caches for package BattleMapAssets, overwriting with Other

    ReplyDelete
  25. I occasionally have seen that message for package BattleMap but the cook process still results in SUCCESS. If yours is not cooking, try running the Frontend tool as Administrator and see if that makes a difference.

    I have also had issues with compiling/cooking through the Frontend if the UDK Editor is also running. Closing the UDK Editor down usually cleared the error in the Frontend.

    ReplyDelete
  26. the cook is a succes, but doesnt run it with the Battlemap code, and when i run it from the editor it just goes blank and crashes :S

    ReplyDelete
  27. i Just cant beleive it.. i installed the april beta, fresh from start, and still wont build the script, its too freaking weird and im getting really upset :S i dont understand what could possibly had happened :(

    ReplyDelete
  28. I'd check all the .ini files to ensure you still have the BattleMap references in place.

    Also verify that you have included the correct URL for the launcher.

    ReplyDelete
  29. I successfully upgraded to the May beta. Here's the steps I took after installing: * Copy /Development/Src/BattleMap * Copy /UDKGame/Content/Maps/(mine) * Copy /UDKGame/Content/Misc/(mine) * Copy /UDKGame/Flash/BMHud * Backup /UDKGame/Config * Edit DefaultEngine.ini * Edit DefaultGame.ini * Edit DefaultInput.ini. One that got me was forgetting to add +ModEditPackages=BattleMap to DefaultEngine.ini after adding SystemSettings. My BattleMap scripts wouldn't compile until I added that.

    ReplyDelete
  30. the inis are all ok, thats what i found very strange, it shouldnt have any problems, i was using it just fine and didnt change a thing before it went crazy, idk, ill try and see if i can fix it this weekend and keep u guys updated just in case somebody else has this weird problem :S
    thanks for ur help

    ReplyDelete
  31. I successfully updated last night to the May Beta. I pretty much followed the same steps as ZomBPir8Ninja.

    The only other steps I took was to create new desktop shortcuts for the Editor and the Launcher (pointing to the the new target directories) and to update the Launcher options.

    Scripts compiled through the Launcher first time but the first cook took ages to complete (it was just sat there not indicating any progress for a while). When cooking I get the following warning message in the log however it eventually finishes successfully and the game launches with no problems.

    Warning, Mismatched Guid while merging guid caches for package BM-DnDMap, overwriting with Other

    ReplyDelete
  32. Finally, after some long long hours of uninstalling and reinstalling, lots of trial and error and lots more of desperate crying and asking "why are you doing this to me?" to my computer i found out that the error is caused by the flash file, i have yet to find out what exactly make the thing to crash, but i managed to get it up and running again with an old swf file i had lying around (importing to the editor, then fully rebuild and recook). Strangely enough, the grid now fits even better than before.
    My computer is a weird bitch, i know.

    so i got BattleMap running again but for now, no placeable zones, ill make a completely new flash file and tell you guys how did it go, thanks for all your help. And i really hope no one has the same problem as me, cause its frustrating... some times it would show the map from the top-down view, but the "battlemapplayercontroler" wouldnt be called, it was hard to figure out what was wrong at all

    ReplyDelete
  33. Sounds like maybe the Actionscript got corrupted in the SWF. Have you tried running the SWF under the Flash debugger?

    Glad you have isolated the problem though, nothing more frustrating than a rogue problem. Best of luck restoring.

    ReplyDelete
  34. yup, apparently the swf file was corrupted somehow, i got it back up and running now luckily :) zones and all.

    I did noticed a bug, when u click a zone when already "holding" a torch, the torch sticks to the cursor and its impossible to click it away or delete it, is it just me, or did this happened to somebody else?

    it wouldnt be really bad, except if u do it by mistake, then its really annoying having the torch follow the cursor all the time

    ReplyDelete
  35. I don't get that problem Gerar. If I am holding a torch and select a zone, the objects are swapped. I end up holding the zone and the torch is placed where the zone was. I can repeat this in reverse to.

    ReplyDelete
  36. try selecting a torch very near to a zone

    ReplyDelete
  37. Ah yes, if i place a torch and a zone down near to one another, clicking on one selects the torch and it becomes stuck to the pointer as you indicated.

    ReplyDelete
  38. Hey guys i was talking to my players the other day and one of them came with a pretty cool idea that u may be able to pull out.
    We were thinking maybe it be possible to add a start and end point for a special effect, like magic missile or an arrow, as the pointer is already knowing whats under it maybe press "home" or "start" at one point and then add a final point by pressing "end" and the effect will travel from one point to another, u think thats maybe possible?

    ReplyDelete
  39. Just to update:
    I followed everyone's advice here and read through all the old posts and comments a couple of times, and I couldn't figure out what I was doing wrong. I completely uninstalled UDK and started over form scratch. (I through tons and tons of debug logging into the code, and I just wanted to start over clean.

    So, going through everything again, I think I found what my problem was. In the DefaultInput.ini file, I put the BattleMap bindings at the end of the file, instead of after the Editor Bindings. When you put them after the Engine.UIDataSource_InputAlias bindings, they don't work at all. Wow, rookie mistake.

    I also discovered another fun fact. I'm using 1920 x 1200 resolution. I made the flash file 1920x1200 and updated all the appropriate files for that resolution. If in flash, I fill up the entire area with a grid of lines spaced 20 apart, the grid will not show in flash. If I just use half of that, it works fine. If I use 75% of the space, I can get it to appear, but if I scale it up a few times, it disappears. I wonder if the UDK has some maxium size for a HUD?

    Anyways, I was able to follow along with all the blog posts, and I got everything working.

    Now, I just need to learn the UDK better for building levels. I need to get some walls going to block the light.

    This is a really great project. I hope to start using it in my home games.

    ReplyDelete
  40. Gerar - That would be a nice bonus feature. I have been tinkering with similar concepts and am working on area effects like Wall of Fire, Death Rays, Poison Gas clouds etc. etc. My only concern is having enough keyboard commands to map to all the effects I would like to have!

    I am hoping its possible to create an in-game menu (accessible by right-button mouse click and using ScaleForm UI) that allows for a wider range of effects to be spawned. It would be great if ZomBPir8Ninja could provide a view as to how difficult this would be.

    Todd - Glad to hear you found the issue and have got it all working. Not sure about the Flash problem with the resolution setting perhaps one of the other more experienced Flash users here can assist.

    With regards to learning UDK. I can highly recommend the Buzz tutorials on the UDN (http://udn.epicgames.com/Three/VideoTutorials.html). I found them to be very good, well structured and easy to follow. They walk you through the majority of the basics of the UDK Editor as well as covering more advanced topics like Lighting, animation (Matinee) and logic control (Kinsmet).

    In addition I also found the showcase examples on the UDK website (http://www.udk.com/showcase) to be really useful. Aside from learning new level/game creation techniques they offer a wealth of assets.

    Dungeon Defence is especially nice as its Dungeon theme is well suited to D&D however I have also found the following showcases very useful:

    - Epic Citadel
    - Jazz Jackrabbit
    - The Ball
    - Bounty Arms

    Hope that helps.

    ReplyDelete
  41. Great info there DrZeuss i really appreciate that (specially the showcase page ;) )

    idk if that many keyboard commands are necesary, maybe with the already implemented command to switch between zones it can be used to change the colour of the clouds, or something like that.
    I was thinking on doing the clouds along with the zones, but i didnt want the clouds to look "cartoonish" (thats why i wanted the old square zones code with the text inside, could be use for tons of generic stuff, like marking trapped squares among so many others)

    ReplyDelete
  42. A quick question, can we share our created maps with one another or does the UDK license agreement forbid it?

    ReplyDelete
  43. RE: Zone Interaction Bug - working on a fix for this. It turns out, it's only working as-is now due to a different bug. Fixing that bug caused another mess, etc, etc. The BMInteractObject() function may need to be rewritten from scratch.

    @Todd: Glad you got it working! Yes, HUD resolution is still an issue on our whiteboard to resolve.

    @Gerar: That is a cool idea... as long as we can keep it quick and simple. What we struggle with during our D&D sessions is the time it takes to resolve combat. That's why the few effects we have in there now are all single-click effects - to keep them quick and simple. And I don't even use those every round. But that's certainly something we can look into.

    @DrZeuss: As far as I remember, as long as you didn't remove the UDK logo or charge for it you could package it up and give it away. But I'll double-check on the licensing and get back to you.

    ReplyDelete
  44. ZomBirP8Ninja - Thanks.

    I use Fantasy Grounds II to manage combat encounters. Whilst its primarily setup for VTT remote play I find it a very useful GM tool for real-world round game tables.

    I essentially use to manage my campaigns but as it includes a Combat Tracker I use it for managing turn order, determining hit/miss rolls, tracking effects etc. etc.

    At $40 for the Full Version its a steal for the value it offers. 4E Combats now run as fast as the older versions of D&D.

    ReplyDelete