Jump to content

User:MaxsimGoratiev/sandbox

From Wikipedia, the free encyclopedia

1. Creating the Map Directory

[edit]

Create a series of directories in your "Homeworld2\Data\" folder, called "Data\LevelData\multiplayer\deathmatch\". This is where you should store all custom maps, since this is where HW2 will be looking for them.


2. Creating a “.level” File

[edit]

Open up WordPad. Save a new file as “<xxx>.level” where <xxx> is whatever you like. Tip: have Windows always open .level files in WordPad. Tip: don’t name it "Test.level". HW2 does not like this for some reason.


3. Adding In-Game Level Information

[edit]

This is stuff that will show up in multiplayer menus in-game. Add in this text:

levelDesc = "xxx"; maxPlayers = y;

Whatever you type instead of xxx will be the level name that is shown in-game. The value you type in for y will be the number of players required to play the level. Tip: while still testing the level, you should set the name to “A” so that it will be selected by default when you start a CPU skirmish (provided it’s a 2-player map, at any rate).


4. Adding Player Information

[edit]

Add in this text:

player = {}

player[0] = { id = 0, name = "Vaygr", resources = 1500, raceID = 2, startPos = 1, } player[1] = { id = 1, name = "Hiigaran", resources = 1500, raceID = 1, startPos = 1, }

If you want to have more than two players, just add extra players, and remember: id should always start at zero and increase by one for each additional player. startPos should always equal 1. raceID should oscillate between 1 and 2 (or more, if there are any additional races) like you see above. The other values should be mostly left alone, as they are handled by in-game selections. Tip: to add comments in your ".level" file, simply precede a line with two hypens: --

5. Adding Player Start Position Information

[edit]

Now add in this text:

addPoint("StartPos0", {X, Z, Y,}, {A, B, C,}); addPoint("StartPos1", {-X, Z, -Y,}, {A, B, C,});

“StartPos0” is the starting position for player 1, “StartPos1” is the start position for player 2, and so on up to “StartPos5” for a six-player map.

The first brackets, the {X, Z, Y,} ones, determine the location of each start point relative to the origin (the point where the crosshairs meet in sensors manager when the map first starts).

Notice the format of the coordinates: {X, Z, Y,}. X controls “side-to-side” position, Y controls “up-and-down” position, and Z controls height above or below the default plane of movement. Note: in HW2, X is to the left, Y is up, and Z is forward when looking at the 180 marker on the Sensors Manager pie-plate. In HW1, X is to the right, Z is up, and Y is forward when looking at the 300 marker on the Sensors Manager. Both games use a right-handed coordinate system. This is probably why Malignus has the order of the Y and Z coordinates reversed. -Mikail

So, suppose you want to start each player 51 km to the side of the origin, 9 km above the origin on the Y-axis, and in line with the default plane of movement. You’d type something like this:

addPoint("StartPos0", {-51000, 0, 9000,}, {0, 0, 0,}); addPoint("StartPos1", {51000, 0, -9000,}, {0, 180, 0,});

Simple enough, eh? Notice that the X and Y values are inverted to keep the playing area symmetrical. A 4-player map using those values might look like this:

addPoint("StartPos0", {-51000, 0, 9000,}, {0, 0, 0,}); addPoint("StartPos1", {51000, 0, -9000,}, {0, 90, 0,}); addPoint("StartPos2", {-51000, 0, -9000,}, {0, 180, 0,}); addPoint("StartPos3", {51000, 0, 9000,}, {0, 270, 0,});

Of course, this isn’t really symmetrical, since players one and three would be very close to one another, and so would players two and four. But you get the idea.

Keep in mind when setting distances that it takes a scout squad three and a half minutes of uninterrupted travel to move 100 km on conventional drives. That’s a pretty long time, and you can expect capital ships to take much much longer when traversing the same distances.

You can measure distance in the Sensors Manager by counting prongs along the movement plate axes. As you can see on the left, the distance between each prong is 5 km by default, or 10.5 seconds of scout traveling time. Plan distances accordingly.

The next bracket set, {A, B, C}, determines the angle of rotation of each player’s mothership. Only put in a value for B—A and C should be left at zero (if you change them, they’ll tilt the mothership at bizarre angles at the beginning of each map. It will then take 20 or 30 seconds to right itself).

Using B, you can set each player’s starting orientation (which way his carrier and mothership are facing). If B is set to 90, the player’s carrier and MS will hyperspace into the level facing towards 90 degrees on the Sensors Manager compass. Generally it pays to have your ships facing more or less towards the center of the map. Note: actually, by default the player faces the 180 degree marker on the Sensors Manager pie-plate. Then, as you change the value for B, the mothership is rotated in the opposite direction (i.e., counter-clockwise) than what the numbers indicate. Oddly, Malignus is correct when he states that setting B to 90 will point the mothership toward the 90 degree marker, as 180 - 90 = 90. -Mikail


6. Sizing the Map

[edit]

Now set the size of your map:

setWorldBoundsInner({0, 0, 0,}, {X, Z, Y,});

Don’t change the values in the first bracket! Those effect position, and may give you a lopsided map if changed from 0. The second bracket has the X, Z, and Y size values you want.

7. Adding Ships & Megaliths

[edit]

addSquadron("SquadronName", "SquadronType", {X, Z, Y,}, F, {A, B, C,} ?, H);

Default values: addSquadron("BigProduction", "vgr_shipyard", {0, 0, 0,}, -1, {0, 0, 0,}, 0, 0);

Use A, B and C to rotate the ship. Some ships (like vgr_planetkiller) will need to be rotated. In the case of the planetkiller, set its A value to 270. F determines who controls it. If F is -1, no one controls it and it is capturable. If it is set to 0, player[0] controls it, if it is set to 1, player[1] controls it, etc. H determines if the squadron should be created in hyperspace or in real space. It takes the values 1 or 0, respectively. SquadronName can be anything you want. SquadronType can be any of the following:

Hiigaran: These work: hgn_assaultcorvette, hgn_assaultcorvetteelite, hgn_assaultfrigate, hgn_attackbomber, hgn_attackbomberelite, hgn_battlecruiser, hgn_carrier, hgn_defensefieldfrigate, hgn_destroyer, hgn_dreadnaught, hgn_ecmprobe, hgn_gunturret, hgn_hscore, hgn_interceptor, hgn_ioncannonfrigate, hgn_marinefrigate, hgn_marinefrigate_soban, hgn_minelayercorvette, hgn_mothership, hgn_probe, hgn_proximitysensor, hgn_pulsarcorvette, hgn_resourcecollector, hgn_resourcecontroller, hgn_scout, hgn_shipyard, hgn_shipyard_elohim, hgn_shipyard_spg, hgn_targetdrone, hgn_torpedofrigate

These don't work: hgn_cloakingfrigate, hgn_drone_frigate, hgn_drone_frigate_2, hgn_drone_frigate_3, hgn_gunplatform, hgn_pulsarplatform, hgn_supportfrigate, hgn_battlecruiserionbeamturret, hgn_cloudexplode

Vaygr: These work: vgr_assaultfrigate, vgr_battlecruiser, vgr_bomber, vgr_carrier, vgr_commandcorvette, vgr_commstation, vgr_destroyer, vgr_heavymissilefrigate, vgr_hyperspace_platform, vgr_infiltrator_frigate, vgr_interceptor, vgr_lancefighter, vgr_lasercorvette, vgr_minelayercorvette, vgr_missilecorvette, vgr_mothership, vgr_mothership_makaan, vgr_planetkiller, vgr_planetkillermissile, vgr_prisonstation, vgr_probe, vgr_probe_ecm, vgr_probe_prox, vgr_resourcecollector, vgr_resourcecontroller, vgr_scout, vgr_shipyard, vgr_weaponplatform_gun, vgr_weaponplatform_missile

These don't work: vgr_artillerycruiser, vgr_listeningpost, vgr_transportfrigate

Keeper: kpr_attackdroid, kpr_destroyer, kpr_destroyerm10, kpr_mover, kpr_mover_capture, kpr_mover_salvage, kpr_sajuuk, kpr_sajuuk_nosensors

Megaliths: these are huge; they make great map props! meg_asteroid, meg_asteroid_nosubs, meg_asteroid_mp, meg_balcoragate, meg_bentus, meg_bentus_ruin_1 (up to 11), meg_bentus_ruined, meg_bentus_ruins_core_1 (up to core_3), meg_bigred, meg_chimera, meg_dreadnaughtberth, meg_foundry, meg_foundrydebris_chunk1 (up to 4), meg_foundrydebris_flake1 (up to 4), meg_gehenna_1 (up to 7), meg_misslefrigate (yes, spelled like that), meg_progenitorpowermodule, meg_progenitorpowertrigger, meg_progenitorpowertrigger_noui, meg_sajhulknose, meg_sajhulknose_ui, meg_sajhulkpanels, meg_sajhulkpanels_ui, meg_sajhulkturret, meg_salvagecollector, meg_tanis, meg_tanisstructure_medium, meg_tanisstructure_medium2, meg_veildebris_bit1 (up to 15), meg_veildebris_chunk1 (up to 5; alternate versions have “_nd” on the end), meg_veildebris_chunk_lighthouse, meg_veildebris_flake1 (up to 10)


8. Adding Resources & Clouds

[edit]

The following objects must be placed in the DetermChunk portion of your level file. These you can copy and paste into your maps. Just tweak the settings, assign coordinates, and voila—you have stuff in your map! FYI: The word "Determ" in DetermChunk refers to deterministic data.

Asteroids:**__

addAsteroid("AsteroidType", {X, Z, Y,}, RU, ?, ?, ?, ?)

Default values: addAsteroid("Asteroid_3", {0.0, 0.0, 0.0,}, 100, 0, 0, 0, 0)

AsteroidType ranges from Asteroid_1 to Asteroid_5, with 1 being the smallest and 5 being the largest. Only 3, 4 and 5 are harvestable—1 and 2 are purely ornamental. RU is a multiplier applied to the default RU amount contained by each asteroid type. The larger the asteroid, the more RU it contains by default. An RU value of 100 means 100% of this default RU count, 70 is 70%, etc. A value of 0 means that the asteroid contains no resources, and is purely ornamental. Default asteroid stats: Level 3 asteroids have 9000 RU, level 4s have 18,000 RU, and level 5s have 40,000 RU. Level 3s can support one collector, Level 4s can support two, and Level 5s can support three collectors at a time.


Salvageable Debris:**__

addSalvage("ChunkType", {X, Z, Y,}, RU, ?, ?, ?, ?)

Default values: addSalvage("Slv_Chunk_Lrg03", {0.0, 0.0, 0.0,}, 100, 0, 0, 0, 0)

ChunkType ranges from Slv_Chunk_Lrg01 to Slv_Chunk_Lrg05, with 1 being the smallest and 5 being the largest. You can also put in Slv_Chunk_Sml01 through to 08. RU is a multiplier applied to the default RU amount contained in each debris chunk. This works the same as with asteroids.


Dust Clouds:**__ these obscure sensors and can be charged with ion beams

addDustCloud("?", "DustCloudType", {X, Z, Y,}, {R, G, B, A,}, ?, Size)

Default values: addDustCloud("polySurface1", "DustCloud_NoRes", {0.0, 0.0, 0.0,}, {1, 1, 1, 1,}, 0.0, 0.0)

DustCloudType can be any of the following: DustCloud_0 DustCloud_NoRes DustCloud_NoRes_M05 DustCloud_NoRes2 DustCloud_NoRes2_M05 DustCloud_NoRes3 DustCloud_NoRes3_M05 DustCloud_NoRes_NoCharge DustCloud_Teal Note: using DustCloud_NoRes_NoCharge crashes the game. R, G, B is the RGB code (0 to 255). A is the alpha transparency (0 to 1). Size is the dust cloud's diameter.


Nebulae:**__ these damage ships!

addNebula("?", "NebulaType", {X, Z, Y,}, {R, G, B, A,}, ?, Size)

Default values: addNebula("Nebula4_OLD1", "M11_Bentusi_Radiation", {0.0, 0.0, 0.0,}, {1, 1, 1, 1,}, 0.0, 0.0)

NebulaType can be any of the following: M05_DustCloud_Nebula M05_NebualDustCloud_NoRes M05_NebualDustCloud_NoRes2 M05_NebualDustCloud_NoRes3 M07_Foundry_Radiation M08_NoDamage_Radiation M11_Bentusi_Debris M11_Bentusi_Radiation MP_Bentusi_Radiation Nebula01_Cream Nebula01_Teal Nebula_0 Nebula_Hiding Radiation. R, G, B is the RGB code (0 to 255). A is the alpha transparency (0 to 1). Size is the dust cloud's diameter. Note: for the NebulaType, "nebula" is often mispelled "nebual". Note: nebulae are only colored on the side that is lit by the local lighsources. -bobthedog Note: the misty fog will only be seen when looking toward the center of the nebula in a 90 degree arch left or right of center. If you look at a object in the nebula, away from the center of the nebula, the misty effect disappears. So this makes populating a map difficult, where all visable directions show a fog effect. You will need to put many nebulas, where the center is on the edge of the map and not in the center of the map. -iron_man123 Note: damage is done at about 200 HP per second. And, damage can't stack (i.e., overlapping several nebulae does not inflict more damage), though the effect of a dustcloud or nebula on an object's detectability via sensors does stack (i.e., overlapping several dust clouds or nebulae does make an object harder to detect using sensors).




9. Adding Pebbles & Clouds

[edit]

While it is true that the following objects may also be placed within the DetermChunk portion of a level file, they were not intended for this purpose. If they are not created in the NonDetermChunk portion of the level file, then they will be igored when saving the game (between missions, for instance).

Pebbles:**__ the little brown specks which show up in sensors manager but do nothing

addPebble("PebbleType", {X, Z, Y,}, ?, ?, ?)

Default values: addPebble("Pebble_0", {0.0, 0.0, 0.0,}, 0, 0, 0)

PebbleType can be any of the following: Pebble_0 Pebble_1 Pebble_2 Pebble_3 Note: using Pebble_3 crashes the game.


Clouds:**__ these do no type of damage whatsoever

addCloud("?", "CloudType", {X, Z, Y,}, {R, G, B, A,}, ?, Size)

Default values: addCloud("polySurface1", "Cloud_NoRes", {0.0, 0.0, 0.0,}, {1, 1, 1, 1,}, 0.0, 0.0)

CloudType can be any of the following: Cloud_0 Cloud_NoRes Cloud_NoRes2 Cloud_NoRes3 R, G, B is the RGB code (0 to 255). Note: "Colors are compounded when items overlap in the same locations. This intensifies the color effect. If you put two nebula's in the same location with different colors, the resulting color is a combination of the two with double the strength." -iron_man123 Note: "Clouds, dust clouds, and nebulae are only colored on the side that is lit by the local lighsources. Seen from the other side, they will appear to be black." -bobthedog A is the alpha transparency (0 to 1). Size is the dust cloud's diameter.


10. Adding Map Info

[edit]

Once you’ve set the size, you have gotten to the NonDetermChunk part of the map. This consists of: setting the background image, picking the music, choosing shadow color, deciding how far out and in you can zoom the sensors manager camera, and picking whether you want fog or a lens flare. Add this text:

setGlareIntensity(0); setLevelShadowColour(0, 0, 0, 1); loadBackground("X"); setSensorsManagerCameraDistances(MIN, MAX); setDefaultMusic("Data:sound/music/Y/Z");

Values for X can be any of the following: m01, m02, m03, m04, m05, m06, m07, m08, m09, m10, m11, m12, m13, m14, m15, planet, quick, singlesun, stars, tanis, taniswstars, black, white Note: using "stars" as your background will cause the game to crash. Y is one of the music directories, either “ambient” or “battle.” Z is the track name. Tracks in the Ambient directory include: amb_01, amb_02, amb_03, amb_04, amb_05, amb_06, amb_07, amb_08, amb_09, amb_10, amb_11, amb_12, amb_13, amb_14 Most of the ambient tracks are pretty boring, honestly, but if you want a relaxed atmosphere, they can work. Tracks in the Battle directory include: battle_01, battle_04, battle_04_alt, battle_06, battle_keeper, battle_movers, battle_planetkillers, battle_sajuuk, bentus_arrival Planet_Killers is pretty dramatic. Battle_Keeper, Battle_Movers, Bentus_Arrival and Battle_Sajuuk are pretty cool Arabic-sounding tracks. Battle_01, Battle_04 and Battle_06 are your typical menacing orchestral tracks. Min and Max are the minimum and maximum zooming distances. Note: despite whatever values you set here, the HW2 graphics engine has a threshold beyond which nothing will be displayed. If you make a map that is larger than this threshold, everything will still function properly. You can move from place to place, and the enemy fleets will continue to build and harvest. You can even zoom far beyond this threshold. However, anything beyond that distance (from the camera) will simply not appear, and will be painted black. -Mikail


11. Adding Fog - blood_angel, Sp3ctre, Mikail

[edit]

fogSetActive © fogSetStart (S) fogSetEnd (E) fogSetDensity (D) fogSetColour (R, G, B, A) fogSetType (T) fogAddInterpolator (buff, length, target)

The value for C is boolian. 1 enables fog for the level. 0 disables it. S is the start plane of the fog. E is the end plane of the fog. D is the fog density. R, G, B is the RGB code (0 to 255). A is the alpha transparency (0 to 1). The value for T is a string and must be contained within quotes. It can either be "linear", "exp", or "exp2". If "exp", then the fog will increase exponentially. fogAddInterpolator adds an interpolator for fog. buff can be one of these string values: "fogStart", "fogEnd", "fogDensity", "fogR", "fogG", or "fogB". length is the duration of the event. target is the final value of the modified parameter. Note: "Fog settings will act as a shadow effect on objects in a map. It does not produce any fog effect. This should be used when using a nebula on the whole map. The color setting should be the opposite color of the nebula surrounding the map. This would be true physics effects of colors and visual effects. An example is our sky color is light blue and the sun appears yellow orange. If the sky color were redish the sun would appear cyan in color. To show this in the color numbers using RGB, use {100,0,0} on the nebula and (0,100,100) on the fogSetColour command when FogSetActive(1)." -iron_man123


12. Level Thumbnails

[edit]

To add a level screenshot (thumbnail): add an uncompressed 24 (or 32)-bit ".tga" image with the same name as your map, plus "_thumb" at the end, into the same directory that your map is in (e.g., if your map's name is "4p_spacious_place.level", then name your image "4p_spacious_place_thumb.tga"). The final image must be at least 128 by 128 pixels, or some multiple thereof (e.g., 256 by 256, 512 by 512, etc.) 128 by 128 will look blurry; 256 by 256 looks much better.

The game will only display the top-left portion of the image, so crop accordingly. If your final image is 512 by 512 pixels, only the top-left 360 by 270 pixels of the image will be displayed. The rest can just be blank space. Also, the game will not display the image if your map file has an extra period in it. For example, "Big_Map_2.0_thumb.tga" will not display, whereas "Big_Map_v2_thumb.tga" will. Name your ".level" file and ".tga" accordingly.

Many image editing applications do not have an option to explicitely save a ".tga" file as a 32-bit image. However, any 24-bit image can be converted into a 32-bit image by adding a mask (or alpha layer) to it. The mask happens to be 8 bits; so, the result will always be a 32-bit image (because the sum of 24 bits and 8 bits is 32 bits).

For further instructions on how to create ".tga" files for Homeworld 2, read the Badge Tutorial. Also, read ЬberJumper's Muliplayer Map Thumbnail Tutorial Note: thumbnails will not transfer over GameSpy. Suggestion: mark the map's starting positions on the thumbnail using the Homeworld font Tip: for additional file-size savings, you can convert the ".tga" file to ".dds" using a .DDS Converter.


13. Compiling Your Level

[edit]

Once you've finished creating your level, you have the option of compiling your level using a program called LuaC. For instructions on how to compile your code using LuaC, see this page. Compiling your level has two clear bonuses, and an additional effect that could be interpreted as a major drawback: 1 compiling your map decreases its size. This means that other players will spend less time downloading your map when you host it over GameSpy. (Oddly, in many cases if you compress the compiled file using WinZip or WinRAR, the file will actually be larger than if you had simply compressed the uncompiled file.) 2 the compiled file is in machine language. This results in a slight speed boost, as the computer does not have to waste time translating the Lua (text) file into its own native language. 3 decompiling the compiled file is either impossible, or results in messy code. This depends on the command-line options you use with LuaC, and could be considered a boon if you do not wish other people to view your code. Note: to decompile a file, use Age2un's Lua Decompiler.


Map editor

[edit]

If you are just starting making maps you can download map editor [1] or [2] could use

Also it's recomended (with the auther of these article) to visit these web page [3] were you can find answers o most questions about the map editor. It's recomended to use the sierra comunity forum, you can find answers an many questions.


Also here you can find and download some free maps

[edit]

[4]