PDA

View Full Version : Information when Replacing or Adding (un)used units


TheNomad
06-11-2008, 2:33 AM
How many times didn't you want to change unit stats, graphics, or even add some new units to the game ?

First off, I will start with the bad news: it isn't currently possible to literally add new units, unless you're a Blizzard employee, or, unless you got your hands on the source-code (and there are no plans to make it possible).

To explain this simply, that is because units are stored in a table array, a list. That list has a fixed size. A simple way of making you picture that is by imagining the units.dat file. It has 228 "physical" units, but around 249 real units. The rest are part of the system, stacked in memory. The "physical" units are Marines, Zealots, Drones, Mutalisks, Khalis Crystal, Terran Beacons, Nexus, Spawning Pool, Disruption Web (yes, that's a unit) etc. The "system" units are the replay buttons, the groups (cloakers, burrowers etc.), the build buttons (the list with what buildings you can make) etc.

First of all, imagine a Hard Disc that has 1000 bytes. Say the disc is made up to hold 11 files, but their total will sum up 1000 bytes. That is the maximum your HD has and can't go over that. Or simply said, info over it would be lost. Same here. Adding more units would mess it all up since the game would either not be able to read it all (best case scenario), either because it would mess up all memory offsets by pushing stuff in front of it to make room for your extra units. While this doesn't seem much of a problem, it is.

This would also mess up all its memory allocation for specific units, as, if you noticed in DatEdit, there are some things attributed strictly to buildings (i.e. only buildings can have add-ons) and while the game MIGHT let you make an infantry unit into a building or vice-versa, that doesn't mean that the game likes it.

Still, enough introduction, let's get to the fun part. Having said all this, that doesn't mean that all is lost. Blizzard helps us by keeping in special units we call "Heroes", such as Fenix, Raynor, Zeratul, some "hero" buildings, such as Crashed Norad II, Ion Cannon, Overmind etc. or, even better, a few unused buildings (Repair Bay and StarBase).

When adding or changing new units, you must keep in mind the original unit's attributes (i don't mean stats). For example, making a mod where you replace the Mutalisk and Marine, if you'd want to do it properly, is not as easy as changing it's name and HP and graphics. If you want to make a serious mod, you must also keep in mind about its flingy.

Flingys are used by the engine to determine movement and a small part of physics. Basically, the simplest way to explain is by telling you that what you are ordering around is a bunch of code that you can't see. Same for when your units shoot. That wouldn't be too much fun, now would it ? To make it "realistic", those bytes you move around in memory get some graphical attributes to make you recognize the unit and admire the graphical effects. This is where the flingy comes in. All stored in flingy.dat.

The flingy has a corresponding Sprite which is strapped onto the flingy, so to speak, and gives you all the nice juicy graphical effects. It's what also controls the actual movement of the unit or projectile. The reason I said it isn't "easy" to change a unit is because, if, for example, you'd want to make a highly versatile unit from the Mutalisk, and a highly mobile unit from the Marine... things might not turn out that well for you. Why ? Look in flingy.dat, in DatEdit. A Marine's flingy doesn't use preset values, but they're instead interpreted by iScript. A Mutalisk's physics, is, however, controlled by the flingy 100%.

For those of you that missed the point. Ever noticed how some units "drift" on the battlefield and are more mobile than others ? Mutalisks, Scourge, Vultures, Guardians. They moved fluidly and can basically strafe, in a way, while other units, such as a Marine just moves in a straight line. If you still haven't noticed what I mean: try evading a psionic storm. Which unit will have more mobility ? A Marine or a Guardian ? This "mobility" is controlled by the flingy. Note that some projectiles that require to "move" to their destination also use flingys. There is a bit more talk about movement and animation here, but it's not the point of this tutorial. It was a short discussion to explain the basic difference in-game of units controlled 100% by the flingy and those controlled by iScript. An important thing to keep in mind when modifying units. Also note that you can change the way a unit's movement is controlled.

The second thing you want to keep in mind is special abilities and technologies. As you know, all energy units can have upgrades to reach 250 energy. This is hardcoded and can't be changed (at least not until Blizzard will help out :P).

Here is the Energy Upgrade List list:

Energy Bonus #19 Sets Energy to 250 for Unit ID #9
Energy Bonus #22 Sets Energy to 250 for Unit ID #8
Energy Bonus #21 Sets Energy to 250 for Unit ID #1
Energy Bonus #23 Sets Energy to 250 for Unit ID #12
Energy Bonus #31 Sets Energy to 250 for Unit ID #45
Energy Bonus #32 Sets Energy to 250 for Unit ID #46
Energy Bonus #40 Sets Energy to 250 for Unit ID #67
Energy Bonus #44 Sets Energy to 250 for Unit ID #71
Energy Bonus #47 Sets Energy to 250 for Unit ID #60
Energy Bonus #49 Sets Energy to 250 for Unit ID #63
Energy Bonus #51 Sets Energy to 250 for Unit ID #34

Special Abilities:

Technology #3 Adds +3 mines to Units: ID 2 and ID 19

A very neat feature in StarCraft is the ability to upgrade unit stats, such as speed, range, sight range etc.

Here is the Speed Upgrade List list:

Speed Bonus #17 Increases the Speed of Units: ID #02 and ID #19
Speed Bonus #26 Increases the Speed of Unit ID #42
Speed Bonus #27 Increases the Speed of Unit ID #37
Speed Bonus #29 Increases the Speed of Unit ID #38
Speed Bonus #34 Increases the Speed of Unit ID #65
Speed Bonus #37 Increases the Speed of Unit ID #69
Speed Bonus #39 Increases the Speed of Unit ID #84
Speed Bonus #42 Increases the Speed of Unit ID #70
Speed Bonus #53 Increases the Speed of Unit ID #39

When changing units keep in mind that some also have sight range upgrades:

Sight Radius Upgrade #20 Increases the Sight Radius of Unit ID #01
Sight Radius Upgrade #25 Increases the Sight Radius of Unit ID #42
Sight Radius Upgrade #41 Increases the Sight Radius of Unit ID #70
Sight Radius Upgrade #38 Increases the Sight Radius of Unit ID #84

... while others have attack range upgrades:

Attack Range Upgrade #16 Increases the Attack Range of Unit ID #0
Attack Range Upgrade #30 Increases the Attack Range of Unit ID #38
Attack Range Upgrade #33 Increases the Attack Range of Unit ID #66
Attack Range Upgrade #54 Increases the Attack Range of Unit ID #4

Miscellaneous upgrades:

Armor Bonus #52 Adds +2 Armor to Units: ID #39 and ID #48
Faster Attack Rate Bonus #28 Increases the Attack Rate of Unit ID #37
Transportation Upgrade #24 Adds the "Load" and "Unload" buttons to Unit ID #42
Hangar Count Upgrade #43 Increases the Hangar space by +4 for Units: ID #72 and ID #82
Hangar Count Upgrade #36 Increases the Hangar space by +5 for Units: ID #81 and ID #83

This would be the basic information to keep in mind when changing or adding new units. Please note that the Overlord hero always has the "Load" and "Unload" buttons. Removing the "Hero" property on Alan Schezar will just remove the blue trails effect, but keep the range. The rest of the upgrades are hardcoded for the hero units (except for the Armor upgrade for the Ultralisk Hero, the Speed upgrade for Raynor's Vulture and the Hangar upgrades). The "Hero" property will make the unit start with 250 energy.

If you found this tutorial useful and would like to contribute to it, feel free to PM me with the information you want to add. Also feel free to post here if you have any questions.

Konn
06-11-2008, 8:14 PM
How many times didn't you want to change unit stats, graphics, or even add some new units to the game ?]

So how did they add units in Water Craft (Dont think anyone has that anymore :cry:)

My guess is they changed the source code (Which would explain the water)

ForTheSwarm
06-11-2008, 9:43 PM
They probably just replaced some unknown units. By the way, do you have WaterCraft? I'd like to see it.

TheNomad
06-12-2008, 11:03 AM
I don't know it, but I seem to remember an attempt of a mod that wanted to make water critters. Walkable water is easy to do. But it has its downsides. You could replace a lot of units (including heroes, critters and powerups) and get quite a lot of unused spaces. But I'd have to see the mod to tell you for sure.

BroodKiller
06-12-2008, 3:35 PM
I never heard of "WaterCraft", but I do remember "Aquaneous Rift", an ambitious, but failed attempt at making water-specific units.

TheNomad
06-12-2008, 5:33 PM
That might be the one I saw pictures of... if it had water-only critters and a water ramp ripped from a cliff ramp :P

Konn
06-12-2008, 8:50 PM
Water Craft became Aquaneous Rift because of Copyright Laws but it added water and water units (Still had the normal units and such) But water was only walkable by water units, and unfortunatly I dont... A person that was working on it doesnt have it either =/

I was hoping someone else might have it, sigh thats the main mod that I want XC

EDIT1: They had about 3-6 units per race (Still had heroes and normal units, and I think the critters were still there too)

TheNomad
06-13-2008, 2:12 AM
They had about 3-6 units per race (Still had heroes and normal units, and I think the critters were still there too)


Hard to believe: click me (http://www.angelfire.com/sc/starcraft1998/wsc/hydroling.html).
That pretty much looks like Devouring One, the Zergling hero.

And it's the picture I remember :)
(well I thought it was a critter but apparently it was a hydralisk for water, but notice the water ramp I mentioned).

Konn
06-13-2008, 7:39 AM
Yeah, I saw the pics from that site... I really thought they kept the heroes and I know they kept the normal units

EDIT1: I woulda loved to have water units (Though how to make them, I do not know, but would like to XD)

TheNomad
06-13-2008, 9:17 AM
Well it currently isn't possible to keep them all and also add new ones. I mean it is possible, but with more work than it's worth it and chances are, something might break.

As for water units, you can't make them. What he actually did is make the water terrain passable/walkable. The current engine doesn't allow water units per se. I am not sure but I THINK there is a way to allow only certain units on water, but I am not 100% sure. Might have to do with elevation. I wanted to do a water-units tutorial for nirvanajung, but gave up cos there are way too many unknowns regarding the terrain\tileset format.

Konn
06-14-2008, 1:43 PM
Ok, that makes sense =D