AoE Reinvented: Crafting an epic Tower Defense Mod!



Description

#AgeOfEmpires  #TowerDefense #GameModding


Welcome to "AoE Reinvented: Crafting an Epic Tower Defense Mod!" ๐Ÿฐ

In this video, we embark on a journey to transform the beloved classic, Age of Empires, into a thrilling tower defense game. Dive into the rich history of AoE, and witness a fresh twist that brings siege warfare and tower defense strategy into an exciting nexus.

๐Ÿ”ฅ What's Inside?

A step-by-step guide on how to utilize the content editor for this mod.

Exclusive gameplay showcasing epic siege battles and strategic defense placements.

Tips and tricks to optimize your defenses and conquer the enemy.

A sneak peek into the inspiration behind "Siege of Empires" and the potential future of AoE mods.

From crafting intricate defense systems to battling relentless waves of invaders, this mod offers a fresh challenge to both Age of Empires veterans and new players alike. Are you ready to redefine how you play AoE?

Join the revolution, and let's defend our empires like never before! If you enjoyed the content, don't forget to like, share, and subscribe for more modding magic. ๐Ÿ””

Transcript

have you ever wanted to make your own tower defense game if so then today is your lucky day follow along with me as I teach you how to do it my name is Devon and this channel is for gamers who are learning how to code in this video we're building a mod for Age of Empires 4 let's get into it the first step before we can build the game is we need to brainstorm and research to figure out what rules and design we want for our game my favorite place to go for Gathering ideas is Warcraft 3 in particular there are a lot of custom games that have been created and especially Tower Defense games so I went online and downloaded as many to defense mods as I could find and I spent several hours testing them all out some of my favorites were pumpkin TD and heroic Origins Galaxy TD among many others now this is an Age of Empires modding tutorial Not Warcraft I just did this to gather ideas for example in pumpkin TD you can see that the maze where the creeps travel around your Towers is already predefined some tower defenses require you to organize your Towers into a maze structure to cause the creeps to get confused and waste their time that mechanic is fun for a few minutes but it gets really tedious so I prefer that the maze is already generated for you like pumpkin another issue I have with some tower defenses is they seem seem to have a very specific build path that is considered optimal and the only way to win the game is to follow that path it's not so much a strategy game as it is a puzzle you're trying to figure out what that path is because the game is not balanced to where any other build path can work I dislike that something pumpkin does is it randomizes your Towers so that you can't use the same build path every time now it has almost too much random for me what I like about heroic Origins is although it has some Randomness you still have to strategize within the random choices for example two different Towers synergize together and are stronger if you have both of them in your base so you need to be careful not to take every random Tower you're offered but instead to carefully select which ones you keep one final thing that frustrated me with some Tower Defense games was the difficulty levels were not set up correctly even if I put it on easy mode I could only pass a couple of waves before I lost the game and I suspect they were designed to not work with single player and to require an entire team playing together so that gives me some ideas that I want to implement as well as some pitfalls I want to avoid so during my research I wrote up a long document of notes of what I want to accomplish in my game I'm not going to read through all of these rules I'll just explain them as I'm coding it but if you're making a game you definitely want to go through some sort of brainstorming and design phase before you start coding anything and it might surprise you but team fight tactics which is a mod on top of League of Legends also has some mechanics that are similar to Tower Defense games this is one of my favorite games and I want to incorporate some of its design as well so let's get started first I'm going to open up the Age of Empires 4 content editor I'll click create a new mod and I've already gone over these options in a separate video so I won't go through them again today but I'm going to start with a crafted map and afterwards add a tuning pack to that crafted map and the crafted map I start with will be blink so it will be quite similar to a game mode where it has its own win conditions you don't destroy the enemy base to win and you don't build an entire civilization you're just constructing Towers to destroy the creeps so let's pick crafted map next I'm going to call my mode Siege of Empires now I'm a big fan of this terrain layout tool it's a great way to get started in a map because it allows you to draw at a very high level what you want the map to look like I won't use it in this case because it's not granular enough for what I want for this map but I suggest you try it out it probably will be a good fit for your map let let me just show it to you real quick if I pick terrain layout and hit next I can essentially pick a tile from the pallet in this case it says Hills low rolling and then I can draw at a high level what I want the terrain of my map to look like so in this example I want a small area in the Middle where you can place your units and then I want a pathway that the monsters walk down down and around your Tower and away so that you have time to kill the creeps so this will be the basic look of our map but the reason I'm not going to use it is the smallest size it allows is micro and that would require me to scroll the camera as I'm playing the game back and forth in order to see the creeps spawning unless I just ignored the majority of the map and only used the very Center and in addition each of these tiles is quite large so it'll create a walking path much bigger than I need for that reason I'm going to just draw the terrain completely from scratch but one nice thing about this once I click next is for a typical map it works well because it will also generate resources like stone gold trees berries and it will randomize the slope of the terrain to feel natural so I'll just click next so you can see what the generator produces based on my drawing this is how it turned out and you can see it roughly matches my sketch if there were a way to shrink this to a smaller size I would use this tool for my tower defense but I could not find a way to make it work there are tools under scenario resize and under generators scale world but neither of them quite worked how I wanted and the only other option I could have come up with is zooming the camera out really far but that requires some extra steps I first would have to rightclick terrain to add which creates a camera mesh and then I would have to modify the mesh to allow the camera to zoom out further but then by zooming out even though the landscape would look correct all of the 3D models for trees and units and buildings would be much too small and I would need to scale them larger so so this is just not a good option since I really want a tiny map so let's quit out of this and instead do a blank map from scratch file close mod don't save file new mod okay crafted map next Siege of Empires and instead I'll do from scratch not the terrain layout tool I'm going to click advaned this will allow me to set a different size for my map for terrain size I'll pick 28 and for playable area I'll pick 96 the playable area is smaller so that the camera can show terrain on the outskirts of the map without the player being able to move their units to those edges just for visual appeal so you don't feel like the World is Flat and ends abruptly I'm going to leave it at two starting positions because the editor will refuse to compile my map if I don't have at least two however for now I'm just making it a single player game I'll deal with multiplayer in a future version so the second starting position will just be ignored I'll explain the chunk size in just a second but I would suggest leaving it at the default of 16 click okay next and under mod description this is what the community will see when they look at your mod before downloading it so you want to describe your mod well enough that they know if they're interested in trying it out I'll be lazy for now and just say tower defense game but when I'm all finished I'll update this with a better description click finish and you'll see I have a completely blank slate now something I should have shown previously with the generated map is if you go to scenario switch camera and instead of tool camera which allows you to zoom in and out as much as you want if you switch to game camera it will zoom into what the player will see and so in this instance you can can tell that when I'm fully zoomed out if I scroll I very quickly get to the edge of the screen and that's exactly what I want so that the player essentially does not need to scroll they just always see the entire map while they're playing you can still zoom in with this mode but only as much as the real game would allow you to zoom that's useful for testing without loading the full game but I'll stick with the tool camera for now I mentioned chunks earlier if you go to scenario display chunks a green grid will show up on the map this is useful when you're drawing terrain yourself to make sure you have straight lines and because I chose the size of 16 which was the default if I pull up a calculator my map size was 128 but my chunk size is 16 if I divide that I get eight chunks and my map is a square so it's the same on either axxis because I have eight chunks if I count these green squares I have eight on either direction 1 2 3 4 5 6 7 8 these other grid lines are just for convenience if you want to line up your train within a chunk and keep your drawing straight so if I want to find the center of my map visually just guessing it would be hard to know but but if I just count my chunks 1 2 3 4 this is the center and then again 1 2 3 4 this is the center so let's draw this I'm going to expand terrain and then expand tiles and right now I only have one tile I need to import the tiles I want to use so I'll rightclick and say add and then on the right side under properties there's a blueprint I'll click the three dots which gives me a popup up where I can select a tile I'll type grass in the search window and I don't know that I necessarily care which grass I choose so I'll just pick one at random let's do tall Lush tiger okay on the right side after I picked my blueprint I can see a preview but next I want to actually paint it I'm going to hide this properties tab just so I can see the render you better I'll keep this paint tab open the painting tools have a left and a right brush the purpose here is if I left click it can do one operation and if I right click can do a different one I have to pick my options first but I can make my left click be grass and my right click be water that just makes it easier to paint quickly without switching back and forth between different tools but to avoid that complexity I'll just stick with the left click for now I want to select this paintbrush not the Eraser and I'll put the size as high as it'll go I'll change the tile to my grass and then I'll zoom out so I can see my map better and I'll just left click and paint you'll see that it very quickly Paints the entire map because the size of my brush is so large okay there's my grass now if I wanted it to feel very realistic I'd want to mix multiple types of grass and add slopes to the Terin but I'm not an artist and I don't think it's necessary here next I'm going to add a separate tile rightclick add and then on this blank tile I'll go to properties and choose a different blueprint this time I want some type of road so let's search for Cobble which is kind of like a stone path again I'm not sure it matters too much which one I pick let's just go with English ag2 now back to my painter window I'll switch from grass to Cobblestone and I'll switch from a circle to a square and I'll change the size much smaller I think maybe size four is good and I'll leave the center four squares as the location for your Tower so I'm going to draw the path around it for the creeps to walk and I'm going to try to match the chunk line as close as possible you can also go into scenario overlay and add add a grid or grid lines if you don't want to use the chunk lines but it's a similar result okay let's keep drawing it's not going to be 100% accurate since I'm not snapping to the grid lines I'm just doing it visually but I think it will be close enough so I'll keep going until I've drawn a box around the entire Center Square and this will be the path that my creeps walk along and then I'll also add an indicator afterwards where the start and end of the path will be to indicate the spawn point as well as the ending point where you lose a life if you have not killed The Creep by that point of the path okay I think that looks pretty good so I'm imagining the creeps will spawn here on the left they'll walk straight across and at that point your Towers will most likely not be doing any damage unless they have extremely long range that's just to give the suspense of seeing the monsters coming and also to give you time to make any adjustments before the battle starts once they get to about this corner your Tower should start attacking they'll walk all the way around your Tower and then afterwards walk up and when they get to the edge of the map at the top is when they will despawn and you'll lose a life the rest of the outskirts of the map I'll add neutral objects that you can interact with for upgrades reading instructions Etc and actually my plan is to only have one Tower in the middle which you won't choose to construct it will always be there you'll actually recruit units and there will be synergies between the units and for them to attack you Garrison them inside of your Tower so we'll see how it works before I do anything else you always want to save frequently in case the editor crashes so you don't lose your progress so I'm going to hit file save and in addition I recommend you use github.com to upload your code so that you can keep track of changes and you always have a backup you can fall back to in case you make a mistake and need to recover to a previous Baseline you happy with for example if I click here on Commit you can see each individual change I've made to each file along the way for example here I had a typo I misspelled the word Siege and so I corrected that because I have a history if I made a mistake I could go back to the previous version to interact with GitHub I recommend installing a tool called git extensions what it does is if I right click on a folder it has all of these options that connect to GitHub and the most frequent one you'll use instead of in the submenu it's right above called commit so if I click commit now it shows I have no changes but if I go back to the editor and I draw some random Cobblestone and save if I refresh the commit window it shows the specific files that were changed and if they're binary files it won't show you the actual changes themselves but for text files it will show you the actual changes then if you click this purple arrow down the bottom area is called the staging area these are the files you want to upload to GitHub so if I wanted to exclude a specific file and leave it at the top I can do that files at the top remain intact on your hard drive so you don't lose the changes but they're not uploaded to GitHub so if you ever revert it to an old backup in the future those changes would be lost since they're not uploaded that's useful if you're experimenting with something and you want to quickly revert back you can do so and choose not to upload because you know their experimental changes finally I would type some kind of message here this is just a note to myself so when I'm reading the history later I know what changes are contained here so I would type something like drawing a random cobblestone in an S shape something like that and then you would type commit and push commit by itself only saves to your local git repository a git repository is kind of like a database of code but because it's only local if your hard drive crashes you would lose it but it is still a full history that you can revert back to previous changes if needed I recommend always doing commit and push the push actually uploads the changes to GitHub so that even if your hard drive crashes it's available online and by default it's also being published to the world world as open source anyone else can see your code if they want to but you can change it to be private if you choose after I've published my changes if I wanted to review the history I could rightclick get extensions view changes and this shows me each separate publish that I did and when I select it it shows me which files were modified as well as what specific changes were made to that file so if I wanted to revert back to an old version I could right click on that version and say reset back to here this is not a git tutorial it gets much more complicated than this I can't explain it all in this video but I recommend you start using this tool and learning it for all of your coding projects since I don't want to keep this ugly path I drew I'm going to say file close mod but remember my changes were saved I'm only closing because I want to revert the files but the editor will crash if I revert the files while they're open because they're saved and I have not yet committed I can rightclick and say commit all of my changes show here I'm going to unstage all of them then I'll highlight all of them and right click and say reset now I have no changes at all so I can close this window and reopen my mod and it's back to how it was originally okay back to our map there's some changes I want to make in these scenario editor before we get too much further first under players I want to expand that and choose player two and then in the properties tab I want to change the status to closed that way it's always a single player game next under scenario I want to open the properties window and I want to scroll down to the wind condition and change it from default To None the default allows them to win by collecting enough holy landmarks or relics or destroying the enemy's buildings there are multiple ways to win I want none because I'm going to use a custom script to determine when they've won I don't want the game to automatically calculate that and next under options for win conditions I'll click edit and this just determines the defaults the player can still change this in the game Lobby before they start but I want to override the default map state and instead of concealed I want revealed that essentially gets rid of the fog of War now I could do that in a Lua script instead of selecting it here by choosing it here it only defaults the game Lobby the player can still override it I'm not doing it in the Lua out of laziness I'll do other things in Lua later but if they choose to modify this that's their own choice I think it would make the game less enjoyable because there's no purpose to fog of War for my map but I won't prevent the player if they want to do that okay next under object browser I want to drag in an outpost into the center of the map which will do the actual attacking the object browser has a list of templates each of these folders is a different type of template outposts are going to be within ebps which stands for entity blueprint units like villagers would be under sbps which stands for Squad blueprint squads also have an entity underneath but the squad has additional code related to their movement their formations their combat AI Etc since buildings don't have any of that they're just considered entities if I search for Outpost you'll see a whole bunch of them this is because each civilization has their own blueprint because their attributes may be slightly different one may have more Health one may do more damage one might cost more resources to build Etc in this case I don't necessarily care which civilizations Outpost I use because it's just for visual purposes and to allow the units to Garrison so I'll just pick one at random and drag it in now it shows these arrows which allows me to drag it on the screen in either Axis or if I move my cursor over the pink Square it changes to yellow and I can drag it from there in both axes I want my Outpost to be kind of towards the corner here because the rest of the grass area I want the player to use for organizing their units before they Garrison I might change that later but we'll see how it works and then these green spots are the player start positions for player one I'm going to drag it into the center for for player 2 since it's essentially disabled anyways it does not matter I can't delete it or else the editor won't allow me to compile the map but I'll just drag it out of the way since I know it's not useful however the type of starting position it selects by default is called shared territory that essentially gives them a town hall with a bunch of villagers a few htable sheep and a scout I don't want any of that so I have two options I can either in the templates search for a different starting position and the one I want is called No Town Center I can drag that in and then change its owner to player one or I can simply take the player one shared territory entity and click the three dots next to its blueprint and change it to the no Town Center version It's essentially the same thing in one case I'm deleting and adding a new new one in the other case I'm just editing the existing okay let's remember to save frequently and now I want to start working on the actual units that will Garrison inside this Outpost in order to do that I need to create a tuning pack and I want my tuning pack to be part of the map itself so that they're bundled together I don't want the players to have to download two separate mods to edit the unit attributes you go into attributes open attributes notice right now this menu has hardly any options after you click open you'll see that the content editor looks like it's loading a second instance of the program that's not the case it's just loading another module into the existing program but when it loads then the attributes menu has a ton more choices and these are all categories of data that you're able to modify inside of a tuning pack I mentioned earlier that ebps stands for entity blueprints where one example example would be an outpost which is a building and also sbps for squads where one example would be a unit like a villager so if I click ebps a new tab opens with a tree structure where I can edit all of the data so first I need to go back to my render screen and select my Outpost and look at the properties to figure out which type of outpost I actually added I can also expand my scenario window to see if as well the blueprint I chose hasore ABB that's the aasd civilization so when I go into the ebps editor I need to expand races and make sure I'm editing that specific civilization otherwise my changes won't take effect now the player can actually choose any civilization they want because I've specifically dragged in this exact building any player can have control of it since even if the player chooses a different civilization they will still control this Tower and it will still be the aasd civilization since I hardcoded it in the editor but if they went to construct a new Outpost with a villager it would be whatever civilization the player had so in this case I want to find that exact Outpost and edit it in my tower defense I actually want the player to be able to control all the different civilizations and recruit recruit units from each of them so they might have an English villager and a Chinese villager working together in the same Colony that's defending against the creeps but I'll get to that later when I design the actual units so in order to modify this Outpost I want to rightclick and say clone because you can't edit the data directly you have to modify a copy of it and that copy will override the base unfortunately it's disabled and that's because I have not converted my map to include a tuning pack so I'll go to file run asset Wizard and then choose attribute mod which is the same thing as a tuning pack and click next now this is not creating a brand new mod this is adding a tuning Pack to my existing mod so they will be a bundle and they will download together the player unfortunately can still choose to play the map by itself without the tuning pack or take this tuning pack and use it with any random map they're not going to like that experience because I have not designed this map or tuning pack to work separately but the game does allow them to do that if they want to experiment for my attribute mod name I'll just call it the same as the map itself Siege of Empires now before I click finish this is very very important do not mess this up the default radio button is the top option this option does not work at all do not ever choose it always choose the second one which is replace base game data with new data only one tuning pack can be active at a time I don't know why this top option exists I'm guessing either it's buggy or unfinished I think the intent was to actually embed the tuning pack in the map itself so that the player cannot separate the two and it's completely automatic but but unfortunately it just does not work at all none of your changes will take effect if you choose that option none of your custom units will be loaded so always choose the second option I'll click finish and now I mentioned that because the two are separate but bundled together the player could choose to play the map without the tuning pack or enable the tuning pack on a different map we want to prevent that from happening on accident so I'm going to tell the map to default to always select this tuning pack to do that I say edit copy mod GD then I click my scenario and go to properties and scroll down to tuning pack mod GD and paste it in now it will automatically select this tuning pack whenever this map is played now that my map has a bundled tuning pack I can go back to my Outpost in the attribute editor rightclick and say clone don't modify any of these default options it's a more Advanced scenario that I'm not going to explain right now but basically you want the top two checked and the bottom one unchecked essentially that means copy all of the values so that I can edit them do not inherit any of the values directly the reason you might want to inherit instead of copy is for example every civilization has an outpost but there's also a civilization called core that all of the civilizations inherit from this this gives a basic Outpost before any civilization specific modifications so if I wanted to create a brand new unit that had a different version for all 10 civilizations then I might make a core unit which clones and copies and then for each of the race specific units I would clone but inherit instead of copy and that way I can change the core unit it at any time and it will automatically propagate down to each of the civilizations unless it has been specifically overridden without the inheritance because the values are copied if I later change my mind about a specific value I would need to go into each of the races and change it I can't just change it from the core that's a useful feature but it's too advanced for what we're doing right now so now that I've cloned The Outpost I have a new folder with my mod name that has my own version of The Outpost on the right side it shows all of the properties of this entity and they're in a key value format so the left is the property name and the right is the value if I rightclick expand all I can see all of the attributes for now I just want to make sure my tuning pack is working correctly so I'm going to scroll down to the bottom and under UI extra info I'm going to change this description in instead of explaining the real rules of the game I'm going to change it to explain my tower defense rules so I'll say something like Garrison your units to attack the creeps which spawn each wave this will appear when the player in game clicks on The Outpost and mouse is over the tool tip so I want the game to be self-explanatory and Scatter the instructions throughout the game and I'll try to make this Outpost kind of the main place where all of the instructions are located so later on I'll modify these abilities at the top and give each of them custom icons and Tool tips to explain various rules of the game so the player has one place where they can get all the information they need but that should be good for now let's just drag in a random villager from Squad doesn't really matter which race race I pick just to prove that the civilizations can be different within the same player I'll choose French this time and grab my villager I'm not going to keep this in the final game I'll just use it for testing and I'll change the owner to player one I think we're at a good point where we want to just test the map make sure the changes we've made so far are what we wanted before we continue the rest of the map development so I'll do file save and then build build mod it takes a minute to compile the mod and you cannot do this if the game is actually running so make sure you quit out of the game first because otherwise the files will be locked and you'll get an error it's done compiling so I'll click okay and I'll load the game okay the game's loaded if I go to mods my mods you can see my mod is here as well as other mods which I have created and published it will default to enabled so I'm able to play it let's go back back to play Skirmish and for map I will change to a crafted map and choose Siege of Empires if I click back to map setup and then game mode you'll see that the map State defaulted to revealed because we told it to do that but I can still override it I hope the player chooses not to but that's their choice and then under tuning pack there is a tuning pack with the exact same name as my map and it has been pre-selected now I could ruin my experience if I instead switched it to a different Maps tuning pack this is a different mod I created and the tuning pack is not going to be useful for this map so again I hope the player leaves that setting alone and then finally because I close player 2 you can see I'm in a single player game I have no ability to add any AI or other players so let's go ahead and click Start and here's my map so far I think it's turning out pretty good so I have my villager and my Outpost and just to prove that the tuning pack is working if I select The Outpost and mouse over you'll see the bottom of the tool tip says Garrison your units to attack the creeps which spawn each wave now there are other parts of the tool tip which I need to change because it talks about fortifications and weaponry and line of sight which are not relevant to my map so I'll change that later there's really not anything else to test here I just wanted to make sure that what I changed so far was working so let's quit out and move on to the next step let's design the creep waves which walk along our path to avoid confusion I want the theme of The Creep waves to be more like Monsters and the units that you recruit into your army to be more like humans and infantry and to actually design the units I'll go into attributes sbps which stands for squads and also attributes e BPS which stands for entities but the problem is if I create a custom unit here I can't actually drag it in to the render screen the only way to visualize my new unit is to run the game and that will take a lot of time going back and forth in testing so before I actually create the Creeps in my tuning pack I want to just pick out which 3D models I'm going to use and the e way to do that is to pick them from the object browser because I can drag them into my map in the editor and just see what they look like unfortunately Age of Empires does not allow you to do custom 3D models so I have to use a model that's built into the game there are a few hacks I can do to get access to a few extra models but in general I kind of have to stick with anything inside of sbps or E BPS so let me show if you examples if I expand squads and pick a random race and drag in a unit like an Archer then I'll zoom in so I can see it I could use this 3D model for either my unit that I put in my tower as a Garrison to attack or I could use it for a creep wave and because it's a humanoid infantry I want it to really be more of an army rather than a monster but because it's under Squad it has animations and movement movement if I pick under ebps which is entities some of these have animations and movement and some do not for example buildings are under entity Blueprints and they have animations during construction but they're obviously not designed to move around so I could grab a building like an archery range I could also make a custom unit out of this if I wanted but because it's an entity I'll really need to convert it to a squad if I want to use it as a creep wave so that it can move around and obviously as a building it wouldn't make sense but there are other things inside of entities that are not buildings for example these animals here are some boes and deers you'll notice if I drag in one of these animals nothing renders and it's labeled a dummy unit that's because I'm in the entities instead of squads and so these are not fully set up if instead I go to squads and look at Gaia I have other choices of animals and if I drag in a boore you can see it has a 3D model so this is why ideally I want to stay within squads but if I can't find enough 3D models I'm happy with I can look at entities as well because it's easy to convert an entity to a squad you can also see on the left side here the icon is a little bit different this blue cube means it's an entity you can also see under the properties it says entity blueprint on the right side whereas as the boore it has an icon of three people next to each other and on the right side it says Squad blueprint so you can easily tell the difference now finally if I go into the art folder and expand to a random folder here you can see something with an eyeball icon and it's a camel if I drag that in visually this is a camel with no human attached to it so the real unit would be like a camel Archer or Camel Rider that has like a sword or a bow or something and fights while it's riding along the camel but because I'm within art I can get just the camel by itself but don't get too excited it's not that easy to convert this 3D model into a squad it may not even be possible it depends on the specific piece of art let me show you why so the icon is the eyeball and when I click on it on the right side you see it's called a visual blueprint well if I went into to attributes and open up Squad and entity blueprints when you look at the tree structure for the tuning pack if I search for example for Camel I can find the camel Archer and then if I rightclick extensions and expand all from the squad I can scroll down and find which entity is contained inside the squad it's going to have the exact same name but instead of going into entity and searching for that name I want to show the relationship of how they're connected so under search I'm going to type load and hit these arrows to go through my search results and the link between Squad and entity is under the squad Loadout extension under Loadout data there's a type which points to the entity now if I wanted to change it to a different entity I would just hit these three dots and it would give me a list of all of the entities and I could pick one because I'm looking at the base unit it does not let me change it I first have to rightclick and say clone to make my own version of the unit and then I could edit its type but for now I don't want to edit I just want to show you how they're connected so if I right click here and say go to reference it will find within ebps this camel Archer 2 and you see it here so within the entity I could do the same thing right click expand all but this time I could see how The Entity is linked to a 3D model and that is under entity blueprint so if I search for that you'll see here it has something called an animator attachment which has attachment core units unit camel 3 that's only one part of the 3D model there are a few other places for example if I search for hardpoint a hardpoint is kind of like a weapon so a unit might be holding a gun or a sword or even a tower might have arrows that it can shoot those would be all considered hardpoints and within the hardpoint there are additional animator attachments so here we can see it has the weapon for the camel Archer so this is actually taking two different 3D models and putting them onto the same entity So in theory we could clone this camel Archer and remove all the hard points and we possibly could get just a camel by itself or maybe a camel with a human writing it but no weapon but it's slightly more complicated than that and will not always work and let me show you why if I go to the squad and I clone it and then I go to the entity and I clone it and let's just say I rename it so that it's truly its own custom unit creep Wave 1 inside the entity and right click Reen name creep Wave 1 inside the squad then inside of my Loadout for the squad I'll make sure that the type is pointed at the entity for creep Wave 1 and as I mentioned earlier we can hit the three dots and pick any entity so these two are connected and in addition if I scroll to the very bottom there is this PBG ID which stands for property bag group ID a property bag is kind of like a collection or a diction AR or a hash table if you're familiar with any of those terms from coding so it's basically a unique identifier that points to all of the information about this unit because it's easier for code to look something up by a number rather than a name and in fact this name creep Wave 1 is not even necessarily unique because within each subfolder you could have an identically named unit if you wanted whereas this property bag group ID is unique now if I go back to the original camel archer in the a acid civilization you'll see that its ID is one with a bunch of nines that's just the number that was assigned to it when it was created it probably just increments by one every time you create a new unit my creep Wave 1 has that exact same ID so because it has to be unique my unit is actually replacing the original camel Archer because I cloned it but I don't actually want that I want it to be a brand new unit so if I just copy this creep wave right click copy and then right click paste I can delete my original creep wave right click delete yes and then rename my copy to the original name I liked rename creep Wave 1 okay now you'll notice this PBG ID is a completely different number so the original camel Archer is still intact and my new unit also exists uh it's important to pay attention to that because if the IDS stay the same you no longer have access to the original unit and if anyone in the game created that original unit by clicking on the building which constructs them and makes the unit it will not create the original version it will create your tuning packs version so sometimes you really do want to replace the original unit and sometimes you want a brand new unit so pay attention to that ID okay but now I've got my squad pointed at my entity and I should probably do the same thing with the entity making sure that the ID is different but here's the important point I want to make if I go to the entity blueprint and change the attachment I can pick a different 3D model but these 3D models themselves might actually be a combination of multiple models and animations in one piece so it may be that the camel for example already has the human with it and so you would have to go into the attachment list itself to remove the human or to set the correct animation because maybe the attachment list you pick like say I just search for something like a sheep it's possible that this sheep is fully intact with its 3D model and animation but it's also possible that this sheep is completely missing its animation and so when you choose it it will just be a 3D model that Glides across the screen W when it moves without any walking animation so the attachment list is another level after the entity where the 3D model and animation is set up but here's the problem in both entity and Squad I was able to rightclick and clone if I go into attributes attachments attachment lists and search for the sheep for example and expand it um I can see that it inherits from the Sheep inside of art but there's two issues here number one I cannot right click on the sheep and say clone because a tuning pack only allows you to modify some of the attributes in this drop down list it's probably half of them and attachment list is one that's read only even if you have a tuning pack you cannot modify it so if I'm happy with this exact version of the sheep I can connect it to my entity and my squad but I cannot modify it in any way and also when I was in the squad I could rightclick on this creep Wave 1 entity and say go to reference and it jumped me from Squad to entity and highlighted my unit but in attachment list even though I can see that it's pointed at the Sheep inside of art if I rightclick there is no go to reference there is go to template but that is different the template is the concept of the attachment list itself or the concept of the entity itself so it's more like a class definition in code for example the template of this entity blueprint will describe each of these properties but it will not have the actual values the instance of that class that has actual values would be the go to reference so attachment lists are not editable and the animations and 3D models inside of them are not editable either so what's my whole point if I go back to object browser if I pick something under art that's this eyeball and drag it in for reference to see if I like the 3D model or not even if I like the 3D model there is no guarantee I can actually use it in my entity because there may not not actually be an animator attachment that points at that 3D model and I can't create a new animator attachment so I will use the object browser to pick what 3D models I want to start with just to quickly identify the look and feel of the waves but I know once I actually create the squad and entity half of the models may not actually work and I'll have to scrap them but at least it'll give me a starting point without having to go back and forth into the game test in each creep one final note is this object browser does not contain everything if you go into squad or entity and search for browsable you'll notice there is this property called browsable in editor and that's true or false so there are some entities and squads that are built into the core of the game that have this setting set to false which means they will not show up in this object browser at at the bottom so you will not be able to find them and drag them in and unfortunately if you clone it and change it there is no way to load your tuning pack into the editor itself so that you can test it in the render window so in essence if you clone it and change this property it will have no effect at all you would have to actually change the base game files to set it to True rather than doing it in a tuning pack and obviously those base game files are not designed to be editable so the good news about that is there may be some 3D models that I cannot find in this object browser but I actually could select in the entity animator attachment so I may have a slightly wider selection of 3D models than I think in the end though I'm going to have to make concessions and pick 3D models I'm not happy with so hopefully that made sense I probably went way into too much detail but when I actually create the creep waves I think it'll make a lot more more sense so first let me delete these units I added to the screen and then I want to have about 30 creep waves of monsters so let me just search through the object browser for 30 3D models I like drag them in and then I'll start converting them to entities and squads and I'll just know that some of them may not work if I get unlucky so I'm going to start under squads Gaia animals and I already know that hierarchy because I've played around with the object browser a bit but if if you're not sure just click on the very top under templates and then just search for a term that you think might have a 3D model so I could search for deer and see what it comes up with and try lots of different Search terms because you don't know what the creators of the game chose to use so for example another word for a deer in English is stag so if I search for that there actually are a few there so same thing you could search for chicken but if you didn't find anything maybe you try poultry or if you search for dog and found something but then you thought maybe there's more you could change it to a hound and there's nothing but try try different synonyms for the words while you're searching and if I do search for a deer as much as possible start with a squad which is the three people Icon if you can't find one your second choice is a blue cube just know it's possible it won't work out and then your third choice is an eyeball and know that it's likely it will not work out but there's a small chance it might okay I'm not going to search I'm just going to go into the Gaia animals and I'm going to avoid these carcasses because that's what the villagers collect food from I just want the actual deer itself so that would be under huntable deer so that looks good I won't decide right now which order they'll go in but I want basically 30 so I'll probably want a sheep a boar a wild man a wolf a stag now this Dragon Turtle sounds really cool but when I drag it in you'll notice there's no 3D model I'm not sure if that's because it's intended to only exist in water but it's actually interesting because on the left side the name actually changed to Gaia monster water which is a little different than a turtle but I will show once I get into editing the squads and entities how to make this water monster work on land so I will keep that but in general I'd say if you drag something in and there's no 3D model it's probably not worth your time to troubleshoot just delete it and move on to something else and then this crocodile I'm not super happy with this 3D model it is called a prototype crocodile but you'll notice it kind of looks more like a bore oh my Game just crashed this is a good reason to remember to save frequently um I've noticed in particular that whenever you hold the ALT key and rotate around it seems to crash frequently like somehow the 3D model is not loaded right so since I had not saved I'm going to lose all of those animals I drawn on the screen unfortunately um but that's the idea right I'm picking 30 3D models I'm not going to bore you with me picking all 30 3D models especially since I have to repick the ones I just lost but I'll just fast forward to a point where I've already picked the 30 3D models okay so here's my 30 models I picked out now if I zoom in you can see I want my very first unit to be this chicken and then a dog sheep horse Etc and I'm trying to keep a theme where the animals get bigger and more complicated as it goes along and then I did switch to certain 3D models that really are not animals per se so like this is actually a statue of some kind of like unicorn mermaid I I don't know it's cool looking but it obviously is going to be a bit odd to see a statue walking along the path and have you attack it because it's not going to have a 3D animation for walking like a normal monster would but it's kind of common in tower defenses when you have a limited number of 3D models to choose from to just be creative and ignore the fact that some of the units don't really make sense in addition I've got boats but remember these things are going to be walking along this dirt Cobblestone path around my tower and then to the end so a boat really doesn't makes sense on a dirt path but I don't care this is just for fun and if You' played any of the other Age of Empires games you probably remember this Photon man he's pretty cool he's a cheat code and uh I I think I'll probably have him be like my last boss where you can't actually kill him and he's just more of like a DPS counter for kind of like a high score so if players want to compete against each other they can show you know look my tower did this much damage to the last boss but because he's unkillable you can't really beat that final wave it's just a high score anyways uh this is my lineup my thought is with the chicken for example because it's wave one I'll just have one single chicken with the dog I'll have two with the Sheep I'll have three so that kind of gives you an indicator of how far along in a game you are and so it feels more and more overwhelming each round so now let's actually convert these 3D models into real units remember on the left side here because in some cases I've used the eyeball icon which is a visual blueprint it's likely those ones are actually not going to work out but I'll at least try maybe I'll get lucky with some of them the squads which are the three people icons I'm 100% confident I can definitely make all of those work and then the ones that are these blue cubes which are entities I'll definitely be able to make them work as 3D models but they may not necessarily have animations to go along with them we'll see okay and then one final note is right now I'm in the editor camera so I can zoom out as far as I want zoom in as far as I want in the actual game that's not possible so I do want to test and make sure that the size of my 3D models is accurate so if I go into scenario switch camera and instead of tool camera I choose game camera I can still zoom in but only a small distance and I can zoom out but also only a small distance so it's pretty hard to see that this is a chicken when I'm zoomed out this far so I'm probably going to to want to expand the size on some of these 3D models so that they're a consistent size I want them to feel more like formidable overwhelming creep waves that they're real monsters not just this tiny little creep and also when you're building your army there will be bonuses based on getting units of the same type or the same civilization garrisoned together inside your Tower you'll be given a choice of several units each time and you'll draft and recruit the ones you want to keep so you have to be smart about which ones you pick so that they synergize well together for that reason I don't really want the units to be this small either because it's kind of hard to see what they are I want it to be easy to distinguish them so I may make the units a bit larger or maybe I just won't allow you to zoom out quite this far I'll kind of force you to be zoomed in more we we'll see so if I were to take this chicken for example and open up this tab for transformation and maybe just move him to the path and then click this scale button I can drag this and make him bigger so that's the way I could make the 3D model bigger but unfortunately this only works with visual entities that have this eyeball because they're basically just eye candy you cannot interact with them in any way in the game the squads and entities blueprints have to be edited inside of the tuning pack for their size and and unfortunately when I rescale here as I drag this bigger and smaller it does not even show me any number here so I can't even pick a number to copy into the tuning pack so even if I visually pick a size I like I don't know what number to put into my tuning pack so just know that the rescale is available there but it really only works for visual entities so unfortunately when I create the actual unit I will have to just kind of troubleshoot in the tuning pack and test it in the game but I'm kind of imagining something about this size and let's just pretend it was wave three there would be three of them next to each other kind of all marching along the line and they would go past your Tower down and around and then back up to the top and kind of want to hit this intersection is when your Tower would have enough range to attack so the first path is kind of just time for you to examine the unit click on it read its stats so you could think about whether or not you've built your army correctly and then you would kind of watch it attack around this entire square and then finally if you were not strong enough to kill it it would March to the top and that's when you would lose a life and in like version two of this map I'll have a whole bunch of different types of upgrades and so as it's marching around if you can tell there's just no way I'm going to kill this maybe you'd spend a bunch of gold to increase your damage or something but for this first version I want to keep it as simple as possible and so you'll really kind of make make all your decisions at the start of the round you'll click a button to say start the creep wave and then you won't really be able to make any changes until the wave is over and then you can rest strategize for the following round and the idea there is as programmers when we're building software we frequently have this Grand Vision of this most complicated game or application we want to build and our eyes get too big and we bite off more than we can chew and so there's several issues with that one is take a game like World of Warcraft or Call of Duty or something right these are not indie games that were built by one programmer in an hourlong session right these were games that were created by a huge team not just programmers but artists and game designers and storytellers a huge team they spent years working on it and it wasn't done in a day they made little improvements over time and kep testing it internally before they decided it was ready to go to the public but it probably didn't go to the public until it had been in development for a couple of years and then even after that the game that we may be love today probably is nowhere near the game that actually launched because these companies keep improving their software over time so maybe the original launch of World of Warcraft only had one realm and One race or something and then over a 10year history they slowly added more races and more Realms and Etc so I want to avoid that Pitfall of making my game overly complicated because otherwise I'll just give up before I ever get it finished I can always make improvements later and secondly when you think about balancing a game the more strategy elements you have the more difficult it is to balance so for example Age of Empires has wood and stone and food as different resources and so you spend wood to build buildings and gold and food to build armies and it's all intricately balanced but that took a lot of work and a lot of testing and calculations to figure out how to balance everything it does create more strategy elements for the player but it's also harder to design that way so in my game to start with I'm just going to have one resource which is just gold I'm going to exclude Stone and food and things like that in version two maybe I'll add more strategy elements and more resources so I I mentioned earlier you want to create a document that describes your game before you ever start building it that's your brainstorming phase well as you're brainstorming write down everything you can think of but then when you're actually ready to start coding narrow down your list to what you would consider a prototype or a minimal viable product cut out all the fluff and just pick what you think would be enough for a player to decide if they think it's fun or not and that's it right just enough to make it playable and start with that get feedback from your audience and then after afterwards add on one new feature at a time and get additional feedback so when you add the next game element you can ask did this improve the game or did this make it worse and then you can remove it or you can move forward and keep adding more features and that way as you iterate over the product it can become better without you accidentally just going a completely wrong direction because let's say you design this Grand Vision you build the entire thing and the feedback from your or players immediately tells you that you designed the entire thing wrong nobody likes any of it like you just wasted a lot of time start with the most basic get feedback and then add little features along the way okay that's a little project management rant let's get back to building our creeps so I'm going to undo adding these chickens and scaling them and now I'll go into my tuning pack under squads and I'll start making my creep waves so let's start with this chicken so under squads I will search for chicken because that was the name of the visual entity so I've already struck out in the squads which I expected because I probably would have a thre person icon instead of an eyeball but it's possible that maybe the chicken exists as a squad but it just wasn't set up to be viewable in this object browser so next let's go to entities again search for chicken okay I've struck out again so find final check is I'll just pick a random animal out of entities Like the Wolf and clone it leave the settings default which is the top two checked and the bottom one unchecked hit okay and then Under The Entity blueprint I will look at the animator attachment I'll hit the three dots and again search for chicken okay I've struck out three times this tells me that most likely there's no way to get the chicken to work at all the only Poss possible way would be if for some reason it was named differently so I could also try searching for poultry or bird or something else or just kind of scroll through the whole thing because we did notice that with the water monster under Gaia it was called Dragon Turtle but when we actually dragged it in it was called water monster so there's a slight chance of something like that with the chicken where the name is just wrong and that's why I can't find it by searching but at this point I'm going to give up and say the chicken's not happening and um I already know with this dog I'm going to have the exact same issue and and the reason why is because unfortunately even though you can pick a visual entity and drag it into the render screen we already learned that in the tuning pack we can't mess with visual entities because they are under attachment list which we have no access to modify but in addition even though I can drag one into my render screen if I click this icon for edit script even in my scar file if I start typing I could type something like entity and find code related to entity Blueprints and I could do the same with the squad however for visual blueprints I've searched the code and have not found any functions that will allow me to mess with a visual blueprint that's rendered on the screen so I you know I would love it if I could hack it in some way by just saying in script move this blueprint to a new location and then I could have a invisible Squad that follows along with it and that invisible Squad takes the damage and the visual is just there for the 3D model but unfortunately even with script I haven't found a way to mess with visual entities and when you're using modding tools you have to recognize that the game creators didn't necessarily think of every possible idea that the modders would want to do and so they haven't built their tools to easily do what you want necessarily so you have to experiment and hack a little bit to try to break the engine and do things it wasn't designed for um and so that is like a very creative solution right take the visual entity and use script to move it along with a fake invisible Squad to take the damage and although it's a pain to have to be creative like that I would be willing to do it if it allowed me to make my map better because I want to push the limits and do as much as is possible to improve the gaming experience but that's the downside to using an editor is it saves you time in a lot of ways but then also it forces you into hacks sometimes too but unfortunately even though that hack logically makes sense I could not find any way to do it with scripting so I'm going to avoid that maybe I'll figure out a hack to do that at some point in the future but I don't actually think it's possible with the current version of the editor okay so chicken I'm going to exclude the dog same thing but the Sheep I can do so if I go into squads and search for sheep I have two choices I've got a Mongol sheep and just the regular Gaia sheep doesn't matter too much which one I use I'll just right click say clone okay and as I mentioned before I'm going to rename it creep Wave 1 and then in order to get the property bag group ID different I will just copy and paste it right click copy right click paste okay so you can see that my copied version has a different PBG ID so I will delete the original and rename my copied one back to the original name so now I have a completely cloned copy of the sheep but it's not replacing the original sheep since it has its own ID so I could use the original sheep if I wanted or I could use my completely custom sheep and then next under ebps I will do the exact same thing and I just know that the name is usually the same so I just searched for it but the correct way technically would be to expand all inside the squad search for the loadout and double check What entity type it's using and rightclick and go to reference but anyways I'm going to clone this Sheep In The Entity leave the default rename it to creep Wave 1 and then to fix the PBG ID I will copy and paste delete my original and rename this one back okay now I should have my custom unit let's just make sure that the squad blueprint is pointed at the correct entity in its Loadout Squad Loadout type okay it's actually blank and that's because it was originally pointed to the real gash sheep when I cloned it it changed it to point to the one I called creep Wave 1 but then when I did the copy and paste and delete deleting it actually set this to null so if I tried to create the squad it would have no entity at all it' probably crash the game so I'm going to hit the three dots here or just double click and then I will search for my creep wave and select it save okay now I have a completely custom unit that's essentially identical to the real sheep and just to prove that it's really a custom sheep just like I did earlier for the tower I want to change a few visual elements so that when I test it in game we can see the difference so I'll expand all inside of entity and I want to search for the model's size so if I just search for size under entity blueprint there are several settings I can change there is the scale the animator scale and the precise size all of these are quite similar but the one I typically change is entity scale so I'll just make the Sheep twice as big as it's supposed to be 200 and then because I cloned a herble sheep there's a bunch of settings that are not going to be quite right for what I want for example I don't want the player to be able to move the Sheep around it's supposed to be a monster that walks around a predefined path that you have to kill so the problem with the fact that I cloned the Sheep is it's going to have those builtin pieces of code that make it htable and when I go to the wild man and clone him he's going to be different because he's not htable but he still is a neutral animal for example Like the Wolf it automatically will attack you if you walk next to it but a deer does not and then these boats are not Gaia they're not neutral animals they are civilization units and they're not even designed to go on top of land they're supposed to be on water so I kind of have two options here I chose to clone the Sheep I could have instead cloned the deer because maybe it performed a little closer to what I want and then just changed the deer's 3D model to match the Sheep it's kind of your choice which way you go both will work but maybe one path will require you to override a lot more settings than the other so just experiments and figure out what works for you but for example I'm going to want to search for herd inside of my creep Wave 1 and see what things make the sheep htable that I can override so for example under action tree opening Branch it has this selection of unit herble an action tree is kind of like the AI that tells the unit how to act and the opening branch is basically what part of the code to start with because different events could trigger the action tree to move to a different piece of its code so take a wolf for example when you get close to it maybe it attacks you when you run away maybe it stops attacking you those could be different AC actions or with a sheep because it's htable it has one action until you get close to it once you get close to it you recruit it and it becomes part of your army so then it switches to a new action and then um you can move it around instead of it just wandering on its own so the branches within the action tree are like different pieces of logic that the AI might choose to do and so the opening branch is just what it starts with unfortunately it's not obvious what the choices are because if if I double click where it says unit herble it just lets me type it doesn't give me a list and if I hit the three dots again there's no list so what I would have to actually do is find a different unit that performs more similarly to what I want and copy its value from its opening Branch so say under the search I typed deer and then take this huntable deer I can't search for herd necessarily because it's not a htable animal but I already know I was looking at the action tree opening Branch so this this one has unitor flea I don't know that I necessarily want my sheep to run away either but at least it's not htable so I'd want to see what the different options are and then pick the one I like the best another way to go about this is if I pick my deer and then I scroll down and I pick my creep wave but I don't just click on it I hold the control key to click on it it will actually select both so you can see my creep wave one is highlighted and if I scroll up my deer is also highlighted that gives me a view where I can see the difference between the units under the common column I can see all the values that are the same and then anything that's different so for example unit Flea versus unit herble it shows varies under the common so I could scroll through and basically anything that's bolded in black or that says varies as I scroll through I know those are the values that are different and then I could just kind of right click on the deer for example and do copy and then right click on the creep Wave 1 and do paste and that would allow me to copy that unit flea over or I could just double click and type it or however I want to do it but once I've changed this to unit flea under comment and it's no longer bold and it doesn't say that it varies so if I pick 30 completely different units for my creep waves and I clone them all from different base units there are going to be a ton of different stats that are not going to be what I want so I may want to select all 30 of my creep waves so I can visualize what properties are different and make them consistent cuz I don't want some of my creep waves to run away and some to walk the correct path and Etc so now let's finish making these creep waves and test them out so I have my creep wave one as a squad which is a sheep and luckily all the 3D model stuff is part of the entity so we can quite easily clone the squad and convert it for different waves with very minimal changes we don't have to copy that huge list of properties each time but within the squad I want to change the text that displays on the screen so that we know it really is error custom unit so I'm going to search for UI corex and within this extension I'm going to change it screen name and I'll just give it a funny name like Silence of the Lambs so that will be the name of the monster itself and then under extra text I will call it Wave 1 and then I'll just clear out the help text so that when you Mouse over the tool tip it doesn't really tell you anything and within the entity I already changed its scale to 200 so I think I'm happy with the Sheep now the important part we need to get this on the screen I wish I could go into render an object browser and find my sheep and drag it in that's not possible I also wish I could just take an existing Squad like this herble sheep and under its blueprint click the three dots and just change it to my custom creep wave unfortunately that's also not possible because this only lets me pick buil-in squads so I have to do it from script so to do that under object browser I'm going to search for scar scar is just another name for Lua Lua is a scripting language that a lot of game editors use and the company that made Age of Empires 4 is called Relic and they just renamed Lua to to scar and it stands for scripting at Relic but it's just Lua So within scar in the object browser there's something called scar marker I'm going to grab that and drag it onto the render screen the type does not actually matter I can just pick anything it's essentially like a comment for yourself as the coder to remember what the purpose of it is but it has no actual effect on the game so you can pick anything you want I'm just going to call it an enemy spawn and then the name I'll call call it creatore spawn and hit Okay so this little red circle that's where my units will spawn and this is just for testing purposes later on I'll move it down here to the bottom and have them actually walk around okay next I need to click on this edit script icon and that will give me my scar file to edit and this is just the basic code that it starts me with I can modify or delete anything I don't want but for now I need some kind of event to trigger in the game which will tell my code to run and spawn my creep in the final version of the game I want an ability on this Tower which you click the icon to say start the next wave but for now I'll just say anytime you give this villager any kind of action to just spawn the wave and I'll change that later so if I start typing a word in the editor it will autocomplete my code so most events in the game are going to be found under the rule prefix so I'm going to say rule add and I'll say player event so anytime a specific player does anything it will trigger an event and then the input variables to this function can filter for a specific type of event so if you look at the parameters it says the first one should be a function which is going to be the code that gets called when the player event occurs the second parameter is the player ID and the third parameter is the event type and then finally is a data table where I could pass in custom data to my function as like an extra parameter if I needed it so I'll create a new function and I'll call it spawn creep wave and I could have a table as a parameter for that extra data I mentioned but I'm not going to deal with that I'll just leave it empty and then every function needs an end PW to Define where all of the code of the function is between these and it's helpful to tab it in so that when you start typing the code it's obvious it's inside of that function I'm not ready to code this yet so I'll comment it out so spawn creepwave is the function I want to be called when this rule is triggered next I need to send it a player and luckily it already gave me this variable for player one and my map's a single player game so that will be perfect for me next I need to send it an event type all of the events are under G eore I think that stands for game event or maybe Global event now if you're not sure what code to type you have a few options under help view help this brings up a website with tutorials you can read as well you can go to script documentation and that gives you a list of all of the functions available in Lua and finally if you watch my other tutorials I explain how when you save a mod it creates a file with a sgaa extension and the game itself when it's installed you can search the files and find SGA files so here I have all of my game files now mine's under Xbox games because I use the PC games pass version of Age of Empires it's actually a little bit tricky to find these files if you have it installed that way because Microsoft tries to hide the game files and protect them so if you get stuck let me know in the comments and I'll try to help you but if you have the steam version it's much easier but anyways here you would type in star. sgaa which is wildcard sgaa as the file extension this shows you all of the built-in game mods not all of these are maps because the SGA file format used by the game can do other things like tuning packs and 3D models Etc but some of these would be campaign Maps so there are tools you can download online one is called the essence archive viewer and the other one is AOE mods. essence essence is the other name for the game editor so just type these names into Google and find them but basically if you open up the editor and then you pick an sgaa file you can find code examples for example here I opened the scenarios SP which stands for single player SGA file and I found a scar file this is Lua code that you could use as an example So reading through all the existing campaigns might be helpful you could also download game mods in the game itself from the community and then find their SGA files and open them with the same tool to analyze how they did things so I've gone through and extracted all of these SGA files into one folder that I've called Age of Empires for decompilation as well as a few other game files that I've decompiled and I like to use the tool Visual Studio code for searching files on my hard drive if I click the search icon and under files to include I put in my folder where I've extracted everything along with this wildcard doscar then I can search for any term and click on it and find an example scar file that uses that term so anytime you get stuck these different tools will help you figure out how to code what you're trying to accomplish so look at existing examples where possible so I've already done some of this research so I'll just code it and explain it as I go so under geore I'm going to choose player command issued so basically anytime I click on my villager and tell them to do anything it will cause this rule to happen and I'm not going to use the last parameter which is passing in a data table because that would just be to give me extra data when this function gets called to use in if statements or something if I want to custom logic um I'm not going to do that the reason that might be useful is if I were to copy and paste this line twice maybe the spawn creep wave gets called by both Events maybe one would be something like wave negative 1 and the other one would be wave positive one and instead of like command issued maybe the first one is they click redo which lets them try the same wave a second time and the second one they're saying go to the next wave so that would allow you to use the same function for both but just with a different parameter that tells that function to do something slightly different and so obviously you would have a different trigger in each of those cases but I don't need a data table in my example okay so now my function will get called whenever my villager is commanded to do anything so next I need to spawn my creep so first I'm going to take this player one and copy it into my spawn creep wave and in both cases I'll change it to local just in general I don't like Global variables as much as possible because I think it makes your code more buggy and error prone it doesn't matter for a simple program but when you're writing very complicated business software for multi-million dollar companies you learn to code things correctly and so I try to avoid Global variables as much as possible even though this is not critical software it's just a fun little game next the function to actually create my unit is going to be unit entry uncore deploy squads and first it needs a player which I already have next it needs an s s group an S group stands for Squad group and it's essentially an array or like a collection of squads so first I'm going to create that group so I'll say local sgroup equals and then the function I'll call is srore create if not found and I'll pass in the name and I'll just call it creep so if this function gets called two times both times it will call this function to create the S group but the second time it won't actually create anything because it's already existing that's why it's called if not found so the second time you it'll just return the existing array and I could call this anything I want technically I could do it like creeps uncore one creeps uncore 2 like a different name for each of the waves but I want to make the code AS generic as possible I don't want to copy and paste the code and change it for each of the Waves I want the same function to work for all 30 waves so that's why I'm using a generic name here and so I may have a global variable that says like wave number equals 1 where this Global value changes each time the function's called I know I previously said I don't like Global variables but I guess I'm just going to be lazy so for the second parameter to deploy squads I need to pass my squad group and I called it s Group which matches the parameter name that the function expects the names do not matter variables can be called anything you want I just chose to use that same name so maybe instead I'll call it srore creeps just to show that the names do not have to match but I do like having the name s group here prefixed so other languages like C which is my preferred language you have to define the data type when you create a variable so I would say something like int meaning an integer or a number counter equals 1 but you'll notice with wave number I didn't say that it was a number it's just whatever you assign to it with the equal sign finds what data type it is in Lua and so the issue with that is with creeps I can't like Mouse over it and see that it's an S group while I'm coding and the game will crash if you use the wrong data types so for example you can add two numbers together like counter you know I could say counter plus one and it'll become the number two but if instead it is a string meaning the number one as text I can't add the number one to it to make it the string of 11 I can't do that in Lua because the plus sign does not concatenate two letters together instead you use the period to concatenate two letters together and that's a difference in Lua compared to a lot of other languages most languages it's just a plus sign to add two strings together um and it's odd to think about the number one and the number one added together becomes the number 11 because when you think about them as alphabetic characters on the keyboard it makes sense that they just go next to each other but when you think about them as numbers you would expect them to turn into the number two so that's the difference between numbers and strings strings are characters in the alphabet so my point is that for creeps it's useful to put sgroup uncore in the variable name even though the variable name is ignored when it's compiled and executed Lua doesn't hold my hand as much as some other languages to tell me if I'm putting the wrong variable type into a function and so my code will just crash if I do things wrong whereas other languages would give you a compiler error so for that reason I'll try to name my variables in a way that makes it obvious what data type they are okay next for the units the documentation when I Mouse over the function name says it wants a table this is where the documentation is not very useful because a table is kind of like what I showed in the tuning packs like a property bag group it's basically a collection of key value pairs how do I know inside of that table what property names and what values to use that's where you're going to need to search existing code examples to find other maps that have called the same function and see what they used but in my case I'll just tell you the answer but it's not at all obvious you would not be able to just guess so strangely it's actually a table inside of a table in the inner table there's a property called SBP which stands for Squad blueprint and I need to pass it my blueprint so first I'm going to find my blueprint and I'll just call it sheep later on I'll make it more generic and I will find my sheep by saying bpor get guad blueprint and you'll notice there are three parameters I'll show you the difference between them but the first one wants the name of the property bag group the second option is the ID and the third option is a list of types so I'm going to use the name but I'll show you why if I go back to my tuning pack this PBG ID if I were to right click and copy this I should be able to paste it in here and change the function to by PBG ID unfortunately this function is a little bit buggy so in my case this creep wave 1 is a completely custom unit remember I mentioned how this ID number if it stays the same as the original sheep then it's overriding that sheep and I no longer have access to the original Sheep In My Map and I wanted it to be a completely custom just in case I wanted access to the original sheep still so I copied and pasted it after I cloned it in order to generate a new ID well for some dumb reason this function is buggy it does not search your tuning pack for the ID number it only searches the base game files and so if it's a custom unit that ID will not be found um however if you keep the ID the same as the original sheep you can still do this by ID and it will give you your custom version of your sheep because that tuning pack gets like inserted into the base game files when the map loads and so it does replace the original sheep so it won't find the old sheep it will find your custom version of the sheep so that's why I can't use the PBG ID is because this number does not exist in the base game files the other reason I would not want to use it anyways is because I want this code to be generic and unless my numbers just happen to be very consecutive where the sheep is 23 and the chicken is 24 and the dog is 25 where where the waves just increment one at a time then it's going to be hard to code this in a generic way I would much rather use the name creep wave1 because then my code can be generic I can take this wave number which right now is one and each time my function is called I can increase it by one and then I can generate this string on the fly so if I'm going to do the string I need to take off this by PBG ID and finally that version that said with type if you go into the squad and expand all the extensions there is a squad type extension and so for my sheep it's Gaia and herble and huntable and sheep these are custom names you can put in whatever you want you can modify them if you're making a custom unit so the reason that's useful is maybe I want a type that's just called infantry or Monster and it's like a generic term that just finds me all the blueprints of any monsters and that would be useful in the case that maybe I want my waves to be random so if I get all of the blueprints that are monsters I can just randomly pick one of them so that's the blueprint functions I'm just going to use the creep Wave 1 now there is a minor bug here I'll explain in a second but I'm just going to take this sheep and paste it in as my squad blueprint remember there's a big difference in the game between entities and squads so don't accidentally give an entity blueprint when a squad blueprint is needed or vice versa the other parameter that needs to be passed is numor squads and I'm just going to set it equal to one so that I only get a single sheep but in the future I'll change that to be wave number because I want one sheep two dogs three chickens Etc okay the last parameter that needs to be passed into this deploy squads is the location to deploy it to so back on my render screen I created this creep spawn scar marker and I gave it the name creep unor spawn so that is a variable I can use in my scar file so if I just type creep you can see it auto complete and I can even see the icon next to it that's the little flag that stands for the scar marker so this should work to deploy my sheep onto the screen now before I can test it I mentioned that there was a bug with this blueprint let me show you what I did wrong and how to fix it so if I would was using a name that exists in the base game like unit Archer 2 absd it would work fine because just like the by PBG ID version by default this is only going to search the internal game files it's not going to search my tuning pack but it will still find the overridden version of the unit but in my case I created a brand new custom unit that does not exist in the base game in order for the code to find my unit I need to say edit copy mod GD which is also the GD for my tuning pack and I need to paste it in here and put a colon in between them a GD is basically a very large random number and it's used to make a unique identifier for something so if two different people make a map even if they call it Siege of Empires they're going to have a different random number and so they will not conflict with with each other so by me copying my mod GD I'm basically saying give me the name of my map but not the human readable name give me the computer readable name that's guaranteed to be unique and this is just the format that Relic came up with but by putting that prefix and the colon it's saying search inside of the specific tuning pack for a squad blueprint called creep wve 1 now this will work but there's one last thing that's critical if I run the game right now there is a chance when it spawns my creep instead of showing a sheep it may just show a big red or green box with an error message that says the 3D model is not loaded and that's because the game has a whole bunch of different 3D models and in order to make the game load quicker it chooses not to put all of them into memory when the map loads instead it only loads the ones that it thinks your game is capable of using so for example if you play a game of Mongols versus English it's not going to load any of the Russ models because it knows there's no way that anyone could ever build a Russ unit so because I'm spawning this creep through code there's no way for the editor to know in advance that I'm actually going to allow this unit to be spawned and so there's a chance it never loads the 3D model at all and so then when the unit spawns it just gives you a big red or green box instead of the actual sheep model the way you fix that is in your scenario tab this database icon with a lightning bolt that's called the preash list if you click on that it will start as just a blank list while you can add elements to it the preach list is the set of units that you want it to be guaranteed to load at the start of the game so that the 3D models are available so if I right click and say add it will let me choose a type of object I recommend you always do the squad instead of the entity or the animator blueprint because all squads have entities inside of them and all entities have animations inside of them so if you pick the squad the whole unit is going to be pre-cached whereas if you pick just the entity or the animation it may miss pieces so I'm just going to pick Squad and then I can go back to my scar file and just copy and paste the same value but it's easier just to pick it from the drop down so if I had these three dots uh at first glance it's going to look like my units are not available because typically you have a separate folder for your tuning pack that keeps everything separated so for example if I hit cancel here and I go into my squad blueprint tuning pack you'll notice I have an attributes folder and I have a Siege of Empires folder inside of my Siege of Empires I have my creep wve inside of attributes I have all of the base game files so I would expect when I hit the three Dot I would have that same folder structure a separate folder called Siege of vampires and I don't that's okay it's actually not too hard to find so if I hit cancel here and go back to my squad blueprint what I need to do is just look at the folder structure so it's under races Gaia animals creep Wave 1 and I could even rename these to whatever I want to call them or drag this creep wave one into a different folder uh all this pre-cat list does when you hit the three dots is it's taking all of the squads from attributes and all of your custom some squads and it's combining them together and keeping that folder structure so rac's Gaia animal is where I should expect to find my creep wave one so if I hit the three dots races Gaia animal here it is and and you'll see that same GD prefix colon and then your squad name so it's not too hard to find them the other option is just click on the squad blueprint folder at the very top and then under search just type the name of your unit so if I type wave here's creep Wave 1 anyways select that and now in my pre-cache list I've got a single item which is my wave 1 blueprint now if I run the game there's no chance of getting that green or red box with the error so let's save everything file save all and then let's now build our mod and open up the game and see what happens and just a quick side note if you try to open the game and it does not work it may be that you need to close your editor first the issue is if you're on on the Xbox games pass version the Microsoft DRM which tries to prevent piracy it's designed to only allow you to open one copy of the game at a time and it thinks that the editor and the game are both the game and that's quite annoying if you have this issue ask me in the comments and I will explain to you how to fix it it's a little bit tricky the steam version should not have this issue but the way you'll know this is happening obviously the game won't load but also if you minimize the editor and then try to open the game it will just Maxim your editor again because it thinks the editor is the game and that it's already opened but here I've got the game launching what I hope happens is that when I play the map I pick my villager and issue a command that will cause my script to run which spawns a sheep at the point on the map that I pre-selected and that the Sheep has the custom attributes that I predefined like the larger 3D model and the Custom Tool tips okay map just loaded I'm going to pick my villager and just right click somewhere okay the game instantly crashed that says I did something wrong attempt to index a number value for the local unit it's a bit confusing because it says Cardinal doscar my scar file in my editor is called Siege of empires. Scar so it's probably actually a function internal to the game that I've called and also local unit local implies that it's a local variable I did not create any variable called Unit so I'm not entirely sure what I did wrong here but the easiest way will be to attach to the game and step through the code one line at a time so I'll hit okay and the game's crashed but that's okay don't quit out I'll just Tab out into the editor and I will say script attach now this will only work if you ran the game with the dasde which stands for development and that's easy to do a steam if you're on the Xbox game pass version you actually have to do some Advanced scripting just to make a shortcut that allows the dash Dev to get passed in because again you got to bypass the Microsoft DRM it's quite annoying so let me know if you get stuck with that but if I say script attach it should connect my Editor to my game so now if I go back to the game I can hit Escape restart yes and now my map will reload but it won't be crashed and before I continue on I want to tab back to the editor and I want to add some break points so first I'll add a breakpoint where this rule gets created that's not really necessary because I know it got past this because it did not crash until I moved my unit um but that will just prove that the editor really is connected to the game and then I'll also put a breako inside of this function my suspicion is that it's probably crashing when I call this unit entry deploy squads because it said that there's something wrong with the unit variable so I actually wonder if maybe the Sheep variable for some reason did not load my blueprint correctly so since I'm attached let's just get the break points to happen um okay I'm a little surprised the game loaded but it didn't even hit this break point to add the player event I'm not sure why that is I definitely am attached because I have a detach option available I wonder if maybe I added the break point after the map had already loaded and so I'd have to restart again but that's okay I'll just ignore that let's Breck our villager right click somewhere okay the game definitely froze but it did not give me the error message and crash so that's an indicator that the debugger has hit a breakpoint and I I can tell it's frozen because my villager is not moving around the animations are not executing and also when I click things nothing happens and in fact clicking too much makes it thinks the game is frozen so I'll just say wait for the program to respond don't kill it and I'll tab back to the editor okay so the I added the breakpoint previously by just clicking in this left gray area and it made the red circle that's the breako but now it has a yellow arrow meaning that that's the current line of code I'm on so now I can step through the code one line at a time and inspect my variables to see what's happening so first on the bottom section I'll change to locals so that I can see the values of each variable right now it's empty because none of my variables have loaded L is a scripting language so it's interpreted one line at a time it's not pre-compiled and so even though this variable is obviously right here until I step over that line it doesn't know the variable exists so then under script there is a step over step into and step out most of the time I'm going to use step over which is F10 into would go inside of a function and out would exit the function I'm in but I just want to go one line at a time with the step over so if I click that then now I have a player one variable in my locals and I can inspect the values inside of it so that seems fine I'll hit F10 to go over this group creation and it looks like my creep group was created just fine F10 again to load my sheep variable and it seems like it also loaded just fine so I'm a little confused if I Mouse over this creep unor spawn I see that it also has a value and if I expand it I can see the position so this is definitely my scar marker okay so I think I realized what I did wrong here very minor mistake but uh if I step over one line of code more it probably will crash on this function here and I think simply this num squads equals 1 was actually supposed to be inside of this inner table next to the sheep and the reason that this is a nested table is that each inner table is a separate Squad and so at the same time I could do two sheep and one cow and so the number of squads is specific to the Sheep so it needs to be in the internal table and then I could do a separate internal table as the second entry of the outer table which was cows with a different number so again the there is really no documentation for these type of functions it just says pass it a table and so you have to look at existing code examples and the compiler does not tell you when you make mistakes you've got to debug it and troubleshoot it yourself so I just misremembered these parameters that was my mistake so I'll hit F10 to step over this line okay now it gave me that error um unfortunately you cannot make changes to your map while the game is is open um and also something odd here I noticed when I hit script run it jumped to the top of my breakpoint again which is odd I only gave one player command to the Villager and yet it seems to have called this function twice so I suspect once I fix this line of code it's actually going to create two sheep because it's going to call the function twice that's okay for now since I'm just experimenting but uh that seems to be a bug here where it actually thinks two commands were issued so I'm going to hit alt f4 which quits out of the game alt together and now I can fix my code I'm just going to move this num squads equals 1 next to the sheep and here's what I was mentioning about doing multiple squads I could load a blueprint for a cow and then say three cows and I think that's why you have an outer table and then inner tables that are comma separated but I don't need that so I think this should work now so I'll say file save all build build mod and the reason I had to quit out of the game is when you click build mod this screen that popped up which is compiling the code it would give an error because it would try to replace that sgaa file in the actual game directory where mods are installed to and it would say that that file is in use by The Game and so it can't be replaced that's why you have to quit out of the game first so now that this is compiled I'll hit okay and relaunch the game this time I think it'll work okay my my map is loaded click play I'll pick my villager and just click somewhere to issue command okay there's my two sheep so it's working perfectly except they're acting a little bit funny I would expect to be able to select the Sheep right click somewhere and have it move to where I want but it's not doing that and instead it's just randomly gliding around the screen so that's because it still thinks that it's htable but that it has not yet been recruited by anyone so I need to actually move my villager up next to it and that's where I need to go back into my tuning pack and fix some of the settings to where it thinks it's htable and it shouldn't be that's going to require some trial and error to figure out what I did wrong and then secondly it's a bit odd it has no 3D animations it's just gliding across the screen instead of walking moving its legs um a few good things though the Sheep is very big compared to my villager so I think increasing the 3D model worked and also when I click the Sheep it does say Silence of the lands which I've actually never seen that movie but I picked that term just cuz it popped into my head it's a movie um I don't think it's actually about sheep I don't know what it's about and then it does say wave one so at least it was semis successful so let's quit out of the game okay I realized what I did wrong and it's actually a super easy fix I just wasn't as careful as I should have been when I created the Sheep so first of all because it's the 3D model and animations that wasn't working I can assume it's the entity blueprint that I did wrong and if I expand all on this and then I select the original heritable sheep while holding control I can compare them side by side and I know that if they are identical they should both work so whatever I did to break it is probably something that's in bold that says varies because something I changed so here I changed from herble to flea and I changed the scale to be larger which I know that worked fine and I changed the ID to separate the units so my sheep doesn't override the original sheep so I really only changed those three properties so obviously it has to be what I did to this opening Branch action tree my mistake was I copied unit flea from the deer and I thought that should be a valid value because they are both Gaia but that's not guaranteed to be the case because the action state tree is set as Gaia sheep so just because Gia deer has an option for flee doesn't mean that Gia sheep necessarily has an option for flea so if I want to copy a value from another unit I need to do a little bit more research to make sure that the value is valid for example unitor herble I want to know which types of units are capable of being herble so I'm going to right click and say copy value on unit herble and then I'll go to attributes and scroll to the very top and say find in attributes then under variable value I will paste in unit herble and I don't have to do this I could just hit okay but under variable key I'm going to say action tree opening Branch just in case this value is used for some completely unrelated variable and essentially what this is going to do is search all of the files in all of the attributes and tell me anything that's htable let's hit okay and then it found two entities that use herble and it is is the regular sheep and the Mongol sheep so if I put herble on deer it may not necessarily work so first i' want to click on each of these and look at what state tree they're using so one is action apply Gia sheep and back to my find result if I click on the other one it is Gia herble sheep action apply Mongol so I know both of those two State trees have a branch called Unit herble so let's search again and for flea attributes find instead of herble I'll say unitor flea hit okay so here I've got a deer and a stag a land monster a water monster so maybe this flea option is available to other types of State trees let's look at each one okay deer its state tree is Gia deer for the Stag it uses the exact same state tree so there probably is not a stag state tree but I know that within deer there is something called Unit flea so before I randomly assign unit flea to something I need to find out what state am I using and what branches are inside of its action tree okay so this just kind of shows you that there are certain hardcoded values that go together deer is always unit flea sheep is always unit herble and you can't necessarily copy flea from Deer over to sheep unless if I took my creep wave which I have unit flea if I changed it state tree from a sheep to a deer it would work and it would still keep its 3D model because this is just the action tree it's not the animation tree so don't be afraid to experiment but just expect that if things are crashing it's because you experimented a little too much and maybe you need to just revert back to the original base values and just tweak one little thing at a time and test it and don't get too crazy changing 100 different values without testing in between because then you'll have no idea what you accidentally broke okay so to fix this sheep I have two options I can either change this from Gaia sheep to Gaia deer so that the unit flea works or I can just change this back to herble so that should fix it and when I'm ready to actually code the combat mechanisms of my wave I'll go back into this entity and modify its hit points and armor and other things and that's really why I wanted it to be a completely custom unit so right now if I compare my creep to the Sheep really the only value I've changed is simply the scale and the ID but as I continue to design the unit I will change a whole bunch of other properties so let's just save this and build it and load the game just to prove that the animation is working and for now I want to take my other 29 3D models that I picked out create creep waves for all of them just to give the 3D models rendering and I'll deal with modifying their hit points and armor and things later once I'm happy with the 3D model rendering okay the map's loaded pick my villager move him somewhere okay great now I have two sheep they are doing their proper animation and I can move them around and they actually walk perfect let's quit out of here and I'm not going to show myself creating all 30 of these units because it will get kind of boring I'll just do a couple so I have a few options let's say I want to do this Enchanted stag next I can right click on creep Wave 1 and do copy and then right click and do paste and then just rename it rightclick rename creep Wave 2 okay and then I can take it and compare it to the enchanted stag expand all extensions and then just scroll through here and anything that says varies I can look at it and see if I think it might be related to the 3D model and if so copy and paste it and the benefit to that approach is if I initially get my Wave 1 set up to have the right hit points and armor and everything else that I want that's unrelated to the 3D model then each time I create a new monster all I have to do is just copy the 3D model across using this comparison tool the other option is I can take my stag right click and clone leave the defaults hit okay and then as before rename it creep Wave 3 and then copy and paste just to get the PBG ID regenerated delete the old and rename again and this way I know that the Stag 3D model has been copied correctly and instead I would just compare to wave 1 and instead of copying the 3D model across I would scroll through and look for values like hit points armor Etc and copy those across so you can kind of do it in either direction I would say that the 3D models are the more difficult thing to copy across since they are possibly contained in like five different extensions and they all have to match up for it to work so I would say it's maybe easier to clone the original entity so that the 3D model stays intact and then afterwards compare just to kind of reset the hit points and armor and everything so what I want to do is essentially create all 30 units this way and I'll set them all to just like a default hit point default armor and then later on I'll scale those values as I'm testing the combat because I don't really know what numbers I want yet anyways and then I might also just restructure this a little bit so as I clone if I take something like an elephant from the sultanate civilization and clone it it's not going to show up under Gaia animals and I don't want like this really convoluted folder structure so I might also just create a new folder called creep waves and just kind of highlight them all and drag them over to keep them a bit more organized and I'll do the same in the squad blueprints as well and that will also help so that when I go into my pre-cache list and hit the three dots I'll have a folder called creep waves where all my units are contained so they're much easier to find so I'm going to pause recording and I will make all 30 of my units so that you can fast forward through it and I'll just show the end results okay I am all finished that actually took a couple of hours it was a lot of working quite frustrating I found a couple of weird bugs so one in particular is I wanted to to rename the cow after I cloned it to creep Wave 2 but for whatever weird reason the entity blueprint if it was not named exactly Gaia herble cattle Mal for malan civilization it would just crash the game so there must be some kind of weird spaghetti code where it's hardcoded to expect this exact value somewhere in the game engine or it doesn't work that's a bug Relic needs to fix I should be able to call this anything I want luckily though the squad blueprint is still called creep Wave 2 and in my Lua code I really only reference the squad not the entity so it doesn't make me have to do anything weird in my code I just have to remember I can't rename that entity so for that reason I put it into a folder called creep Wave 2 instead just as kind of a note to myself but the squad inside of its Loadout just points to the creep Wave 2 folder with the cattle inside of it and it works fine and these squads were quite easy to create they were basically just copy and paste and rename and that was almost it other than changing this type the entities took forever because everything was very temperamental and I would change one little property that felt innocuous to me but the game would crash or the 3D model wouldn't load or the animation wouldn't render but that's okay I did finally get it working so I can move on let's just make a couple changes to our scar so that we can test test this out and then rather than showing you all the properties I changed I think the summary I gave earlier with the sheep gives a enough General instruction that you could reproduce it with any of these units so I'll just show you ing game so you can see what 3D models I chose so as far as the code goes all I need to do is where it says wave number one after each function call I need to increment the wave number by one so that the next time it's called it renders the the next unit and then I need an if statement for quitting out if the wave number is greater than 30 because in that case I don't have any more creeps and then instead of creep wave1 I'm going to delete the one and instead do the period to concatenate and use my wave number variable and even though it's a number the period operator in Lua automatically knows that if it needs to it will convert the number to a string but I could also call a two string function on it if I wanted that should be all I need to change in the script oh one minor mistake I said single period but that's actually two periods to concatenate strings so let's save and then build and actually one thing I want to do is I'm going to go into the pre-cache list I do actually have all 30 squads in here with each separate creep wave but I want to show you that green or red square real quick just so you can see what happens if you forget to do this in the preash so I'll rightclick on pre-cache items and say remove all and then I'll save and build now let's open the game and test this out so I expect maybe half of the 3D models will work fine and half will not work at all okay the map's loaded I should be able to select my villager and right click anywhere and it will probably spawn two units like before but they'll be different units since I'm incrementing the wave each time I still need to fix that bug so it doesn't spawn to it a time in theory I just need to select my villager and move him somewhere and it should spawn my wave but I have not fixed the bug yet where it executes twice so it will spawn two at a time but let's see what happens okay I got a sheep and a cow if I click on the sheep notice I have not named them yet so it says deer one and earlier I called it Silence of the Lambs but as I was creating these 30 in order to do it quickly I did a lot of copying and pasting and so I removed the name um by accident so the cow will be called deer 2 and then it's also called Wave 2 and the Sheep is called wave one so I need to go through and pick names for everything but I can select them and move them around and uh so let's just go through all the 3D models and see if any of them did not load because of the pre-cache issue so I'll move my villager again oh already we got it so here's this red box that says this model has not been pre-cached so that's the bug that will happen if you use an obscure 3D model that the base game doesn't just always load no matter what it makes sense that the deer sheep and cow just worked because probably every game has those 3D models so let's quit out real quick I will set the pre-cache back to how it was and test again so I'll just say edit undo remove all items they're all back now I can file save and build and load the game again okay let's just go through all the 3D models so you can see what I've picked out and then I'll also kind of discuss some of the bugs and issues I found and what I have to do to fix them so here's one slightly awkward one this horse I could not find any 3D model that was just a horse by itself without someone riding it that also had an animation so in this case it's a horse but it just Glides along with no animation it's unfortunate maybe I can figure out a way around that later but for now now I'm sticking with it so that's the issue with trying to use a visual blueprint by selecting the animator attachment instead of cloning an existing EVPs because the animation requires several properties to be consistent with each other and you're not going to be able to just guess that easily or maybe it's simply not possible because the editor locks you out of editing certain fields and maybe those animations just have not been created so that's one frustrating thing let's keep going so similarly I really wanted a camel by itself but I decided I was fine with the camel with a guy on top I I do want to avoid too much of just infantry units but as long as it's an infantry unit that is not common to every civilization I think it'll be okay uh because what I'm planning to Garrison inside my tower will be a subset of the Infantry for example I later on you'll see I actually have a few boats that will go across the walkway as well as a few like catapult Siege units like battering rams I'm okay with that because for the units that you recruit to Garrison inside your Tower I'm not going to have you Garrison a boat or a Siege unit inside your Tower so let's keep going so same issue there with the elephant I couldn't figure out an easy way to remove the Human off the top of it there's my boar and here I've got a wolf and a wild man notice their sizes are all fairly consistent but quite a bit larger than the Villager so I did mess with the entity scale on each unit to where I was happy with it here's the enchanted Stag and that water monster the water monster is kind of interesting as he moves around he sticks his head in the ground quite quickly and then you almost just only see his shell most of the time he rarely puts his head back above water I don't completely love that animation but it's fine I'll leave it and then I did decide to keep the crocodile which actually looks like a pig but it really doesn't have a 3D animation and then this is a bird and I made it quite large but it's a little Annoying the model kind of disappears and reappears occasionally and although it flaps its wing it doesn't really look quite right and its elevation off it's you know it's right on top of the ground instead of being up in the air so a few things I need to fix but for now those cosmetic things I'm not going to stress too much about I just want the game to work it's okay if it's a little bit quirky I think it won't drastically affect the game playay as long as the strategy elements are solid and fun to play next I chose a few strange 3D models just because I was trying to avoid infantry as much as possible and I decided to just be a little creative and use some weird things that I randomly found while looking around so these are some logs that are not animated this is a fish but it has a bird on top and I really just wanted the bird so I made it really big now here's a kind of strange bug when you select on it because I made it so big its circle is big as well I really just wanted the 3D model to be big so I'll probably modify the selection Circle in the tuning pack later that is a property that can be adjusted I just haven't bothered with it so when you change the entity scale it automatically scales up the circle as well and also I wanted to remove the water so it looked like just a bird but I couldn't figure out how to do that next some more strange objects I've got some barrels and a Target dummy and another weird bug most of these units if I just grab a big Square to select them all of them have the same like wolf icon that's because I did a lot of copy and pasting and I'm actually fine with that cuz they're all just monsters so a generic icon is fine but you'll notice even though I drew a square over the whole group only like five of them got selected and that's because some of them them have odd selections so for example this target dummy if I click directly on the target dummy I can select him but if I draw a box around him it does not select him like it wants to select the deer next to him but it does not want to select the dummy itself and so that's the issue where I mentioned earlier you've got two choices you can find an entity that you like and clone it in order to keep its 3D model intact and then go back and reset all the random values like hit points and armor or you can do the opposite you can start with a base unit that has the right hit points and armor but then copy over the 3D model and both ways are difficult because with a 3D model you may have five different properties that have to copy across and if anything's off it's not going to work but then because you copied the blueprint although you have the 3D model now you've got weird things like the selection Circle that don't work right or for example in the case of the Wolf by copying the wolf it naturally wanted to attack everything and and so I had to find the property that made it attack and remove that property so that's what made this frustrating and why it took multiple hours just to get 30 3D models I was happy with is because in both directions I found random bugs that were difficult to fix and and I think that's because the way Relic designed the editor is like super objectoriented and customizable and so there are just a million properties for everything I wish instead just like the 3D model itself was encapsulated in one value and that 3D model contained the animation and everything so that you could just swap that one value and everything visually would work that's how the Warcraft 3 editor Works which I'm more familiar with but that's not the case with this editor so learning every random property is quite difficult okay other 3D models I've got a random cart its wheels don't turn because it came just from a visual and not a full entity blueprint but this Siege weapon does actually have its wheels turning which is nice and I've got a battering ram a boat luckily the boat actually seems to render just fine above ground I did have to change the some properties there there's a property that tells it to snap to the water or not that I had to change but with the water monster I did the same thing but he still wants to stick his head under the ground there may be a property to elevate something which I'd like to do with the bird I'm not really sure okay I've got another boat and another Siege engine okay these are a little bit weird um I found just this random set of spheres and then this is just a little torch so you'll notice in the beginning they're mostly all actual animals then it gets slowly more and more weird I tried to put a little bit of linear progression with it so for example before you got to the wooden enemies like the boat I put in just the random logs and then my thought here with these metal spheres is they come right after this cannon so they kind of look like they're the cannonballs that go with it so I'm sure nobody would follow my logic it doesn't make any sense but like this fire comes after the cannonballs with the idea that it's kind of like melting the metal so afterwards the metal changes so I got a few more of the weird metal and then it switches to like the photon man who's kind of Space Age so it's a bit weird but it gets progressively and more weird as you beat the levels um but I think this is the last boss here the treasure chest is 29 and the photon man is the 30 so that's kind of the end I can always swap out some of the models later but I'm okay if it's quirky uh and then this Treasure Chest has this awkward like yellow string coming up again I'm not entirely sure how to remove that if I messed around with the properties I could probably figure it out but it's good enough I think so the idea here is you would obviously only have one at a time but wave one is the Sheep so you'd have one single sheep wave two I believe was the cow so you would have two cows and they would just walk along this path the tower would attack them once they die it gives you your next round of recruiting infantry that you gearon in your Tower um each set of Monsters has more hit points and maybe how quickly they walk and things might adjust and if anything gets all the way to the end of the path without you killing it you'd lose a life and so it gets harder and harder as it progresses and as I mentioned before when you get to the last boss which is photown man there's actually only one of them instead of 30 and you can't actually kill him so it's just a DPS counter but I think I'll probably make him super big so that he fills like Gary boss and I might make some of these objects a little smaller we'll see but that's kind of the idea so I think what I have left is just to give these names so you know the Sheep I'll call Silence of the Lambs and I'll try to come up with a funny name for each and then I'll modify their stats I'll add a button on the tower for you to start the next wave and then I'll code it for them to walk around in the circle and then I'll make all the rules for how you draft the inventory and Garrison them into your Tower each round and that will kind of be the gist of it but this video's gone on kind of long so I think I'm going to stop it here so back to my original units that you see here on the right you'll see I didn't 100% follow my my original design I wasn't able to get the chicken to work or the dog to work I ended up with a completely different horse model that has no animations I ended up with the elephant that has a person on top of it unfortunately same with a camel I chose not to do multiple horses and multiple elephants this Falcon I really wanted to use this is actually the Scout Falcon from the mongle I believe but for some reason even though here it's quite large when I tried to select it as an animator attachment it made itself super small and I was not able to scale it up and it wouldn't just fly in place it would go all over the map and so I couldn't make it feel like it was actually following this pathway so I decided to get rid of it and then these monuments I could not even find them in animator attachments at all which was the same issue with the dog and chicken So Not only was there no entity blueprint but also there was no animator attachment so even though it exists as a visual entity I cannot select it for the entity blueprint and so similarly with the boat I just picked different boats and I was able to find the cart but I couldn't find the pumpkin cart in an animator attachment or the grave or the N the um Treasure Chest I did find but it was an open Treasure Chest which I guess is fine and then the torch I did find and luckily it did have an animation so I actually get fire here whereas the original torch when I dragged it in as a visual entity did not have the animation so that's what I came up with and then although it is a little bit buggy for example with this target dummy that I have to click on it instead of dragging a box around it some of those things I may not worry about because you're not actually controlling the creeps they're just going to walk around but I will try to fix a few of those bugs and then let me just show you for example the wolf what I had to change so if I tab back to the editor and go to entity blueprints uh I guess I need to find what number the wolf is so if I click on the wolf it says wave n so under wave 9 if I expand it previously had this property called Allegiance override and so it had the value of enemy to all and I changed it to none so that was kind of interesting I don't know why they would hardcode something like that because in essence all Gaia are kind of enemies to all um I feel like they could have just made sheep and deer just not have hard points so they can't attack um but that's okay so that's some of the kind of weird troubleshooting I had to do and then finally let me just show one last thing when I went into the squad and edited the names you'll notice for example here for wave 20 says screen screen name deer 20 well on the left side under asset Explorer there is a file under lock DB the lock stands for localization which is like trans translation so the CSV file which stands for comma separated value you can open that up in a text editor or Excel this is basically translation data so if you wanted to have an English version of your map and a Spanish version of your map you could make two separate files so that's why it has this underscore en for English so I wanted to very quickly kind of copy and paste uh the values of wave 1 through 30 and the way to do that in Excel is if I just delete everything from 3 down to 30 I can just highlight two sets of rows that are similar but different and then on the bottom right corner here there's this little green square I can click on it and drag it down and it will automatically notice the differences between them so extra text is the same on both so it'll stay the same all the way down but it realizes that Wave 1 and two the only difference is the number and the ID four and five the only difference is the numbers and it notices that they're incrementing so it'll just automatically follow that pattern which is pretty cool I could have also done it directly in the tuning pack just clicking one at a time and changing the value but if you do that directly in Excel you need to also edit the XML file for the tuning pack directly so for example in my asset Explorer you can see there's an attribute folder and then there's entity and Squad so if I go into Squad I've got all my creep wve XML files here if I rightclick open containing folder and then open these up in notepad just drag it in then if I search for something like screen name you'll notice it does not actually have the English value here it has the number 34 which if I go into my CSV the number 34 translates to Deer 1 so if you edit the files directly there's a couple things number one you need to close the editor first before you edit Direct irly because otherwise it will just crash when it notices anything was changed directly on the file system secondly you need to be careful because with something like XML if you mess up the formatting at all then the editor won't be able to understand the format and it won't be able to load your map but then also you kind of have to understand the internals of the file format so in this case with the extra text or the screen name you got to recognize it's like the key in the CSV file not the text itself so just a little tip if you're trying to edit the files outside the editor and that's where I would recommend like I mentioned in the beginning use git so that you can look at your history as you're making changes so that you can undo mistakes that you make along the way but anyways I think that's a good stopping point for now the things I've left remaining I'm going to do in a part two video and hopefully by the end of part two we'll have a fully working map for a tower defense game let me know in the comments below if you have any questions and I'll see you in the next


one

Popular posts from this blog

AoE4 Mod Tutorial: Making a Crafted Map in the Content Editor

TeamFightTactics - Rules & Strategy - Coding an AI - Part 2

Intro to JavaScript - Coding a TFT AI - Part 3