Results 1 to 11 of 11

Thread: The World of Wrack Modding

  1. #1
    Administrator Carnevil's Avatar
    Join Date
    Jun 2011
    Posts
    532

    The World of Wrack Modding

    I think it’s time we talked about one of the finer points of Wrack – its modding capabilities! As many of you know, my previous project was Skulltag – a Doom expansion which adds client/server multiplayer; new game modes (such as capture the flag); and a slew of new weapons, items, and monsters.


    It also adds imp sex. Lots and lots of imp sex.

    Skulltag, as well as Doom in general, continues to thrive years after its release largely thanks to all of the great maps and mods people have created over the years. My hope is for Wrack to be the same way. I think most would agree that the ability to make new maps is the most important aspect of modding. To do that, you need a great map making tool. Wrack’s map editor, WrackEd, aims to be just that (and if it falls short, I’ll fix it, dammit!). It’s a powerful tool that aims to be fairly intuitive to use. It has three 2D views which allow you to create and manipulate your level geometry and placed items on any plane, and a 3D view which shows you exactly how your level is turning out in real time.


    Wrack's map editor, WrackEd

    Maps are saved to a file called .map (makes sense, right?). These files can simply be dragged and dropped onto Wrack.exe (or opened with Wrack.exe) which brings up a menu asking if you’d like to play the map right away, play it after setting your skill level, or just going to the main menu (you can also set it to remember what you picked). This makes it ultra easy for people to play custom maps – something I hope people make a lot of!

    The last thing I want to touch on is the straight up modding of Wrack – adding a new monster, editing an existing one, replacing a sound, etc. For starters, all of Wrack’s data is defined externally. What does this mean? Wrack has no idea what the hell a crawler, crusher, or even a DOOR is. All of these things have been defined through a series of text files, which can be manipulated by you. You can build your own monsters, weapons, face actions, etc. all using the same tools we’ve used to make Wrack. You can even build off of what we’ve got!

    Not only can you define your own properties for objects (ex. how tall it is, or how much damage it does), but you can also define the behavior for most everything as well. For instance, all monster behavior is done through scripting. Here’s a (simplified) example of a section of the crawler’s script:

    Code:
    //-----------------------------------------------------------------------------
    state Chase
    {
        int    iTicks;
    
        event( "struck wall" )
        {
            // If we hit a wall, try to turn and move towards our target.
            // If we can't move towards it, first try to walk along the
            // obstruction.
            FaceTarget8Way( true, false );
    
            if ( CannotMoveForward( ))
                changestate( WalkAlongObstruction );
        }
    
        event( "target died" )
            TargetDied( );
    
        OnEnter
        {
            // Play our movement sound.
            PlaySound( "crawler_move.wav", 100, SFXF_LOOP );
    
            // Set this state's animation.
            SetAnimation( "chase", -1, ANIMF_LOOP );
    
            iTicks = 0;
        }
    
        MainLoop
        {
            // Attack once we get into melee range.
            if ( TargetWithinAttackRange( ))
                ChangeState( Attack );
    
            if ( iTicks == 0 )
            {
                // Change directions.
                FaceTarget8Way( true, false );
                iTicks = rand( 1, 2 ) * FPS / 4;
            }
            else
                iTicks--;
    
            // Move forward.
            MoveForward( );
        }
    }
    I’ll explain how scripting works later, but you can probably figure out some of how this works already (for instance, PlaySound() probably… plays a sound!). This should give you an idea though of just how much flexibility you have when it comes to modding Wrack.

    That’s it for right now! Do you have any questions? Do you plan on doing any Wrack modding? If so, what do you plan to do?

  2. #2
    Reminds me of Hammer. Does it have the same concept?

  3. #3
    You can count me in for modding. This sounds great,and it looks like replacing things is nice and simple, but how would it be to add new things? Say I wanted to make a weapon mod, but rather than replace weapons I'd like to add weapons into any given map without having to specifically edit the map?

    Of course I would need to figure out a way to add the weapons (perhaps something like find a certain type of weapon pickup and find an empty place so far away from the pickup), but would this be doable?

  4. #4
    Administrator Carnevil's Avatar
    Join Date
    Jun 2011
    Posts
    532
    Yeah, it's pretty easy to just replace something in Wrack. Say you have your normal pistol definition here:

    Code:
    //-----------------------------------------------------------------------------
    PistolPlaced : MeshMapObject
    {
        // Properties.
        script = "pickupitem_norestore.txt"
        giveitem = "pistol", 1
        giveitem = "BulletAmmo", 24
        radius = 16
        editorcolor = 240 240 0
        +pickupitem
        pickupmessage = "PISTOL"
        mesh = "pistol.x"
    }
    
    //-----------------------------------------------------------------------------
    Pistol : MeshWeaponObject
    {
        // Properties.
        scalex = 2.5
        scaley = 2.5
        scalez = 2.5
        script = "pistol.txt"
        radius = 16
        editorcolor = 255 64 64
        mesh = "pistolfp.x"
        offset = 16.0 -28.0 55.0
        ammouse = BulletAmmo
        sortorder = 2
        knockback = 48.0
    }
    To replace it, you'd just do:

    Code:
    //-----------------------------------------------------------------------------
    YourWeaponPlaced : MeshMapObject replaces PistolPlaced
    {
        // Properties.
        <your properties here>
    }
    
    //-----------------------------------------------------------------------------
    YourWeapon : MeshWeaponObject replaces Pistol
    {
        // Properties.
        <your properties here>
    }
    Finally, if you want to inherit your properties from the pistol AND replace it, you'd just do:

    Code:
    //-----------------------------------------------------------------------------
    YourWeaponPlaced : PistolPlaced replaces PistolPlaced
    {
        // Properties.
        <change whichever PistolPlaced properties you want here>
    }
    
    //-----------------------------------------------------------------------------
    YourWeapon : Pistol replaces Pistol
    {
        // Properties.
        <change whichever Pistol properties you want here>
    }
    Hope that helps!

  5. #5
    Well that certainly looks simple enough. But how about if I wanted to have an additional item pickup spawn some specified distance away from all pistol pickups? Just make the pickup segment run a function to spawn the new pickup? Would that be possible?
    Last edited by Captain Xavious; 05-12-2012 at 12:16 AM.

  6. #6
    Administrator Carnevil's Avatar
    Join Date
    Jun 2011
    Posts
    532
    Yeah, it should be. In the object's script (which in this case, is pickup_norestore.txt), they can respond to the event "picked up". Normally, it looks like this:

    Code:
    event_instant( "picked up" )
    {
        // Give the player who picked us up the item.
        if ( GiveItem( ))
        {
            // We're all done here!
            DestroySelf( );
        }
    }
    You could give the object a new script and have it do whatever you want in response to that event - including spawn items.

  7. #7
    Ah, awesome. And I assume I could have it run trace checks or some equivalent to determine if some randomly chosen area is an open and unobstructed place to spawn the pickup (assuming there isn't a better method to determine valid areas like UT's path nodes)?
    Last edited by Captain Xavious; 05-12-2012 at 03:05 AM.

  8. #8
    Administrator Carnevil's Avatar
    Join Date
    Jun 2011
    Posts
    532
    If not it could certainly be added.

  9. #9
    Alright, that is good to know. I got lots of ideas forming in my head now for possible mods.

    BTW UT's path nodes are placed all over maps to show valid paths for AI to go, looking at the snippet of code for the monster AI you posted, I would assume you don't have an equivalent or a need for one. However, since I think this game recognizes when a player enters Secret areas, I think there would be some sort of Zone info that detects when a player is in or at least passes by some marker that determines the area is a secret. I could see that being a useful area reference placed in maps as part of their regular design I could use for determining where to spawn extra items.

  10. #10
    Administrator Carnevil's Avatar
    Join Date
    Jun 2011
    Posts
    532
    Yeah, there aren't any nodes or anything. It's part of the philosophy of Wrack that things shouldn't be overly scripted and that it should be really easy for mappers to create maps without having to go through a bunch of hassle (like placing nodes). The monsters just go at you and respond to bumping into walls and stuff.

    It's funny you mention "zones", because Wrack actually has that (and they're called exactly that) and they let you basically define a region of special activity on a map. They're not used to define secret regions though as they're mostly an episode 2 thing with some fun gameplay mechanics... which I won't get into right now!

  11. #11
    Haha, well I was using UT terminology, and in UT zones do a multitude of things, from handling water physics to making areas hurt you when you enter them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •