Jump to content

variables are a thing now (also playable example map)


Fey

Recommended Posts

heya

variables

here's the test map. player is Harkonnen. MAKE A BACKUP OF YOUR EXISTING "dune2000.exe" and enjoy the test map, but read on in this thread if you want details on how everything works n stuff
EX SAMPLE.zip

as usual, unpack the zip to your d2k directory. the subfolders in the zip should have subfolders there to merge with

edit: Kipp kindly tested this mission the prior version of this mission. what's new since then? buncha stuff, but the biggest deal for balance is 'repeat queueing.' anyway, here's his run on hard mode:

Spoiler

my comments:
Kipp gets some amazing mileage out of his starting units here! he snipes the rigs on the outskirts of the central outpost and the Starport at the top right. the heal crate he used works not only to repair an injured army after it makes a more dramatic attack (the one on this map is a full-map heal), but to get a lot of mileage out of starting units too. what a sick play :D heal crates are one of Klofkac's inventions, not something in the vanilla game, so it's good to see a heal crate go to such use. I feel encouraged to use them more often

the Spice balance is meant to further encourage expansion, particularly holding islands with Mining Rig build locations on them. even with tons of Refineries and Harvesters back at his main, but no Carryalls, Kipp runs out of funds at one point! he approves of the Spice setup, so any other maps in this format I draw will have similar Spice balance. Mining Rigs look to me like they could use some buffs though... their power cost could be removed, their Solaris cost reduced, and their build time could be reduced. it's not like they're spammable, the player can only build them at specific locations, so they could be more reliable and impactful

a Refinery further out from his main was lost around 7:30, which contributed to running out of funds :P just goes to show how the new expansion / concrete balance warrants protection of whatever islands are taken. can make things more intense that way, there are consequences to unit positioning or putting only one structure on a given island

by expanding, Kipp gets factories closer to the enemy and can then put more tech / eco back in his main, like lots of Wind Traps and more Refineries. by the end of the mission, he has a fairly substantial build speed boost. take the Autogun Tank at 16:22 for instance; on NORMAL difficulty, with one factory and without the power bonus (explained under the last spoiler in this thread or in the mission briefing), they take 44 in-game seconds to build. hard mode on this map makes stuff take 10% longer for the player to build, but Kipp's Autogun Tanks were being built in only 21 in-game seconds. that's like 9% over the old limit from vanilla!

Flame Tanks and Quads are an amazing combo, FYI. Kipp doesn't go that route in the tech tree here, but Flame Tanks require a High Tech Factory and are produced from the Heavy Factory, while Quads require an upgraded Light Factory just like in vanilla. Flame Tanks are not good against fire-resistant structures like concrete walls, turrets, silos or rigs, but Quads can round out that weakness and there are few units capable of completely annihilating enemy Wind Traps or factories quite like Flame Tanks

this map is designed more for, like, tech 4 or 5 as opposed to tech 7, but everything up to the Palace and Death Hand Missile is available regardless. due to the size of the map and the strength of the enemy forces, it's fairly natural that the map ends around mid tier tech as opposed to ever going up to Devastators, Rocket Turrets, Death Hand, etc. if you're taking new territory and snowballing. if you're turtling up, teching up is more likely to happen, and that is meant to be quite viable as a strategy too. I simply want to encourage more aggression in my map design without ruining tried-and-true turtley strats

if anyone else who tests this has feedback to offer about how the balance is, if you agree with my assessment or suppose something else is the case, I'm all ears. poke me here or in the Landsraad. thanks!

full map image:

Spoiler

FMI.thumb.png.46d028d68bba16d1b53a5830bd6c26fd.png

look familiar? yeah lol this map is an expanded version of O5V1. for comparison:
O5V1.thumb.png.5e261dda1cfa5382e635a2c2d2096d45.png

if you run into any problems starting up, you're probably missing some other file, i guess. make sure you have either the 1.3 mission launcher or dunemaster full package. related threads:

Spoiler

I'm told the test map is kinda difficult, so maybe play on easy mode. there's a high eco w/ early defense build order in the mission """briefing.""" don't forget to build Mining Rigs on spots where they're buildable (you'll see Atreides rigs there) and use MCV repacking to build factories or turrets closer to the enemy, keeping your Harvesters safe in an area in front of your initial base location. good luck

anyway, why are variables cool? details on some of the new stuff below:

Spoiler

in the original game, every reinforcement drop, every reveal-radius-around-tile, everything had a specific set of coordinates. we've had ways to make things happen in different locations for a while now like through stuff like random chance conditions, but a different way of accomplishing such a thing merely scratches the surface of what variables are capable of. the very way in which events are executed in d2k has been changed. praise Klofkac, lord of all things new and interesting for sending unto his disciples the mighty variables, hallowed be his name

i listed some good shit in the 'briefing,' some summaries of some new shit, but we gotta look at the, uhh... how it's done, so imma document it here. cuz it's not about the specific new things that are implemented as an example in this map, but to showcase that variables are an entire new system upon which new behaviors may be built

take for example the mining rigs you might have seen in Flippy's campaign (prior to a recent update), or Summers' Solstice. prior to the new system, each of these rigs had to be accounted for in the form of ownership, coordinates, etc. with variables, we can just say "hey, take the amount of rigs owned by a faction, multiply it by 25, and give that much Spice to the faction." easy:
flippy.png.8c835086eafaf9f686f0be3147f49b78.png

new thing simplifies old thing. variables like this make it very easy to set up events across multiple maps. no specifics, no nonsense, just a system that accounts for whatever the setup might be on a given map. you could design a single campaign map's variable events and then just copy all those events over, having totally new gameplay across multiple maps by doing work on merely one

okay, but what can we do that's, like, deep end shit? how about we recalculate build speed of stuff? in the original game, building a 2nd factory of the same sort achieves 150% build speed for related units. the 3rd, 200%. that's it, that's the limit. however...
hookunitbuildspeed.png.30c04aaea3efd1589981190a32c80a0e.png
hookbuildingbuildspeed.png.7cb8b50dca57b35ecd99a2c9d953df25.png

here's a multi-faceted recalculation of build speed. it works the same for units and structures, so I'll break it down:

first, let me clarify there are some variables that are reserved by hook blocks. var0, "Result" is the variable you set within your events as the final build speed percentage in this example. var1, "Arg1" is the side ID (faction) the build speed is being computed for and var2, "Arg2" (applying only to the UNIT build speed hook block event, not structure) is the unit type for which the build speed is being computed for

for doing our new calculations, we set some variables as a baseline. SpeedAddition and FinalSpeed will account for the number of factories a faction has, and the bonus those factories provide. refer to events 5-11 in the first screenshot or 28-33 in the second

"Loop Buildings" and its related events can run multiple times in a single tick, so ONE factory will run the loop once, adding SpeedAddition to FinalSpeed to bring it to a value of 100. SpeedAddition is divided by 2 afterwards, so when the player builds a second factory and when SpeedAddition is added again the 2nd time the loop is run, it brings FinalSpeed up to 150. a 3rd factory only brings FinalSpeed to 175 because after the 2nd time the loop was run SpeedAddition was once again divided by 2, and so on... so this system has diminishing returns for the bonus factory count provides the player

this obviously can't reach the limit vanilla could of 200% build speed. that's boring on its own, so screw that. how do we spice it up? let's make the amount of power the player has a factor too, so the more power he has, the faster his units or structures build... however, this would be really overpowered because by spamming Wind Traps, you could get a really, really high power%. we have to implement a limit of some sort for fairness' sake

refer to events 12-25 in the first screenshot or 34-47 in the second

we start by telling the game to acknowledge the power% of the faction we're calculating the build speed for, as well as its number of Construction Yards, Mini Wind Traps and Wind Traps.

in this mod, Construction Yards provide 100 power, Mini Wind Traps provide 50 and Wind Traps provide 200. for the purpose of accounting for them in math, let's leave Mini Wind Traps alone (so they have a value of 1), multiply ConYards by 2, and multiply normal Wind Traps by 4. we'll add ALL of these values to the TrapCap variable, which is 400 at a baseline, and then divide the result by 4. this will be the cap on how much the faction can benefit from power% in build speed

what does any of that mean in plain english? let's say you have 3 normal Wind Traps and a Barracks. that will make TrapCap a value of 412, which is then divided by 4 to get 103. so even though the player has a bajillion power% because the only building eating up power is the Barracks, he can only get 3% extra build speed on his infantry

this maintains Wind Traps as an economy structure you don't want too many of. just like you shouldn't build infinity Refineries if you don't have the factories to spam units out of fast enough, you shouldn't spam Wind Traps because more factories is the greater bonus until your base is rather large

to wrap all this up, we set the Result to the FinalSpeed value calculated by the factory count, CapMax the Power variable by TrapCap, and then MulPercent the Result by Power

in effect, this system makes it harder to get to 200% build speed on anything, but the player is able to exceed the vanilla speed limit of 200%. he's encouraged to build an even larger base and in building the power to support that base, he naturally achieves a much higher TrapCap

another cool thing we can do now is repack a ConYard into an MCV. related events:
MCVrepack.png.9f09c2f59686cd831861ec4f0195a13f.png

were we to try this sort of thing in the prior stage of the exe, we would have to account for any possible position a ConYard could be in on the entire map. that's simply not feasible lol

this was the first example of variable usage ever, which Klofkac designed himself. I added caveats that only the primary ConYards can be repacked, meaning other ConYards can be sold while the primary cannot be. similar to Result, Arg1 and Arg2 in hook block events, you can assign variables to certain parameters in something like a Loop Buildings block. in this example, [Player] is the faction and [Index] is the ConYard we're doing stuff with

besides making sure the player doesn't get cash or infantry from a repacking ConYard, we also have to get the minimum coordinates of the structure (the top left tile the structure occupies) and add 1 so we spawn the MCV in the right place. we also do a little math involving the ConYard's max HP and current health to spawn the MCV at the correct amount of health. finally, we set the facing of the spawned MCV to 30, which is the direction an MCV faces when it deploys, and despawn the Concrete spawned by the ConYard

if the player can just repack his MCV and move all around the map though, doesn't that make exploiting AI inability to target concrete really, really easy to do? you can get build radius wherever you want. this is the sort of question that comes up when a new behavior is designed, so we answer that question with even more new stuff:
concretewallsorfoundation.thumb.png.cafc378dba76cdf2338300ece721b242.png

the callable block is a block of events that can be executed at the command of another event. we execute this block at the start of the game, when a ConYard is deployed, or when a structure is completed. it sets all concrete foundation or walls owned by the player to Sandworm side

if you did this for the AI, it would probably mess something up because they always build concrete under their structures. the AI also doesn't know how to exploit it, so it's safe to let them keep their build radius

because of this behavior, the player actually has to hold whatever location he takes with structures the AI will actually target. expansion is still worth it to claim stuff like Mining Rig build locations, terrain to proxy factories closer to the enemy or hold the front ahead of your harvesting ops, or just to get more build space. it also makes an old exploit where you put concrete in the enemy base and build Barracks right next to their structures to spawn Engineers and capture them impossible

concrete build radius is really useful though, so to compensate we make use of yet another new behavior. no events involved! every structure in the mod is able to be placed further away via a byte in their respective building templates. Mini Wind Traps and Spice Silos build fast, so they're the new "I want to build on the other side of this rock island" thing. they're also the means by which the vanilla maximum build radius is maintained, able to be placed as far away as 3x3 concrete could reach in vanilla

building skirts still don't count, so the player always has lower build radius underneath a structure with a skirt as opposed to above or to the sides. this is not something I counterbalanced in some other way. it's simply a change by itself

the existence of this behavior probably means we don't have to delete the concrete under the primary ConYard when it packs back into an MCV, but that's a thing in this test map anyway

Harvester replacements are a classic behavior used even in custom maps. here's a new system for them:
harvreplace.png.6576058f1f8b899706d8718540b86bc5.png

the first unit loop has a check for non-deviated, intact Harvesters belonging to the side we're replacing a Harvester for. a replacement will only arrive when the last one is destroyed

if it's the last one, horray, you get a replacement! check for the primary Refinery location, set a bit in the Player# variable, and send that reinforcement

what's all the other stuff though? you may notice there's a [Delay] variable in the reinforcement event. if your last Harvester was destroyed, the replacement is instant, but it takes a minute for another replacement to be ready. if that first replacement lands and is destroyed, a [Delay] is set and the second replacement will arrive at the primary Refinery's location (whichever was set at the moment the prior replacement was destroyed) after that delay

variables are 32 bits, which means 32 flags can be stored in them. when Player# is BitSet by Player, it means bits 0-7 are set within Player# depending on which player triggered the event. this is how we account for a replacement already being on its way. when the Harvester replacement arrives, it's tagged, so we set its tag to zero and BitUnset the thing in Player#

as for the Delay variable, that references a variable by variable via the Get Variable event. as Set Variable is for writing, Get Variable is for reading. DS0 stands for Delay Side Zero. depending on the number of the side that triggers all this stuff, anywhere from DS0 to DS7 could be picked up for the Delay value. DS0 through DS7 are set to 1500 depending on side number after the reinforcement arrives, which is a minute in ticks. the value is reduced by 1 (subtract 1 capped at 0) every tick through the Loop Sides block, so they function as timers

the Loop Buildings at the bottom allows the player to set a primary Refinery by selecting a Refinery. there's another block elsewhere that forces a primary Refinery to exist for any side regardless of whether one was selected or not, but the player having the option to select his own primary is important

in a similar but substantially less complex vein, the player gets infinite reinforcements at his primary Outpost on this mission too:
reinforcements.thumb.png.d50b3b663a31f848eaab137101490629.png

this one's pretty self-explanatory if you're at all familiar with older events. the first Loop Buildings block sets the coordinates the reinforcements arrive at to just under the primary Outpost. the events not under a loop pertain to the reinforcements themselves, and the second Loop Buildings block... actually, that's irrelevant. whoops. that just gives you a free upgrade if you capture an enemy building you don't have an upgrade for yet

the enemy gets their own form of bonus units on this test map too. not just from reinforcements, but from 'autofactories' too:
autofactories.thumb.png.73dfd71b4ccb33d3ac1d45f31f750ff6.png

this is a concept that was used in Summers' Solstice, but it was very specific. the unit spawns could only happen at specific coordinates, so the AI couldn't rebuild them. once they were gone, that was it. now, it's possible to make AIs build from secondary, tertiary, etc. factories no matter what because the game can tell where they are and where to spawn the units in

events or variables can handle a lot of things conditions had to before. for instance, according to difficulty, a value is selected from events 187 and 188, then multiplied by 25 to set the unit spawning intervals. these events support two autofactories, but by simply changing the maximum value in the range being looped at 178, you can tag hundreds more factories if need be

the factories are on separate timers both using the same min and max values in a random interval. they also use the same group of units to spawn. however, that group of units changes depending on if the secondary prerequisite for Grenadiers is available. if the Atreides have lost or sold their Outpost, Riflemen or Troopers have a 50/50 chance of spawning

these autofactories require power, will only spawn units if the AI is above certain cash thresholds, and will subtract the cost of whatever unit is spawned. they look very similar to normal factories, but are not normal factories. the extra parameters help the player choke the AI out of funds or remove their extra factories by way of cutting off their power

this new stuff isn't meant to entirely replace old stuff. old stuff can be used in tandem with the new. for instance, flags fell out of use when autoblock became a thing, but they remain useful for stuff like this:
flagssystem.png.db3bf4021726faf36efd1ac79067c0a6.png

this system sets one generic flag when the player has selected a start location, and a specific flag depending on which start location was selected. the generic flag is used to fire off a bunch of 'start the map' events, such as freeing the enemy starting Harvesters or spawning a sandworm. the specific flags are used to determine which areas to drop some reinforcements for both the enemy and the player

variables, lists of values, and other stuff could have been used instead or in addition to affect where those reinforcements are dropped, but I simply duplicated the events a bunch of times, set a buncha different coordinates, and then assigned the appropriate flags. a true blend of old and new

I set up the MCV delivery like this though:
starport.png.538390075ab048f22f3263351f461fc4.png

why a run-once flag instead of autoblock? loops like to check for stuff. it'll check stuff and then block itself before it actually fires, so autoblock should only be used if there are other conditions that make the loop run at the time it's meant to. once a Starport is dead, an MCV will fly in at the right spot and there you go

since it's set up like this, the player can choose one starting zone, then go blow up a Starport in some other corner of the map to get an MCV there lol

------------------------------

new stuff! what the fuck is a "repeat queue"? we're working on a proper queue, but for now, check this out:
repeatqueueevents.thumb.png.bfb8fd693a68546effb293a5f67e73c1.png

what's that do? makes it so if you build something, that unit will keep being built until you cancel it or run low on funds. it's not your standard queue, but it's pretty cool all the same. I know the multiplayer folks don't really like queues, but us single-player enthusiasts have been looking for a system like this for a while. we'll keep developing it and see if we can't come up with even better queueing systems. thanks to this, normal folks have a chance of achieving 0.000000000000001% of Kipp's power, if Kipp were blind, deaf and stupid! unfortunately he's not, so we still can't achieve that power level yet, but maybe someday... in any case, the snowball rolls that much more smoothly

regarding the ConYard repacking, that's now done via click, just as if you were to set primary on the building. here's the behavior to detect and set the cursor:
deploycursor.thumb.png.6d0d2ebd94cc513e0ea3d6ccd07903e6.png

this is set up for the Refinery and Outpost as well now, so setting them to primary looks exactly the same as if you were to set a new Barracks to primary. being able to customize cursors opens up a lot of doors. wanna make the airstrike cursor display, click an area on the map and then reinforcements show up at that location? you got it! wanna make a 'superweapon' that kills the next five units or structures you click on? doable. yeppers

the actual ConYard repacking looks quite the same as before:
ConYardrepacking.thumb.png.5e3971eaaf159da1f2de07de9c2f29e1.png

I went ahead and disabled the event that removes concrete when you repack your ConYard since it doesn't provide build radius anyway. might as well leave it in

the only other stuff I added to this map was some in-game messages telling you a few things the briefing already mostly says, in case the briefing was TL;DR. they should help alleviate some confusion and help the player get into the snowball a bit more. regarding those Dune 2 units I converted for use in d2k, there's a purple crate on the center-left side of the map that spawns a bunch of them. it's easily accessible from the bottom-left start location (because that start location was kinda the worst lol so now it's more even). here's how they look:
Dune2unitsdiscovered!.png.51f98211837bd04cb01c6faca7f2114d.png

yeah, they're tiny compared to normal Dune 2000 units. that's the actual size of the original sprites. I'm not, like, doing anything serious with them, I'm just making the assets available. resize them if you want, idc

there are three Trikes, three Quads, two Combat Tanks and two Siege Tanks. they're pretty weak compared to Dune 2000 units, at least in terms of health pool, but a big group of them like that is enough to handily take one of the central islands pretty much right away, so have fun with that

umm

i guess that's all :P

we've been discussing this shit around the Landsraad server on Discord, so drop by if you want more whatever

that's all for now, go test the map already xD

edit: more advancements in manipulating the game behaviors have been achieved. also, i ported some Dune 2 units over to d2k. new details under the final spoiler there, below the dotted line near the bottom. many thanks to those who have already tested! good luck if you give it another go sometime

Edited by Fey
additional advancements made
  • Like 1
Link to comment
Share on other sites

OP updated with new download link. more new stuff. details on more new stuff in edited OP

as a side note, I'm almost done with the level 7's in the map expansions project. did I mention I was expanding the vanilla maps in a similar style to the O5V1 expand this test mission is built on? is coming along pretty well

anyway yeah

Link to comment
Share on other sites

  • 1 month later...
9 hours ago, Nyerguds said:

That's some amazing stuff, wow. Didn't even know anyone managed to add units to D2K.

it's all thanks to Klofkac! not only can we add new units or structures, but we can manipulate pretty much any byte in the game on demand :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...