Author
Topic: Outpost 2 Coding 101: Week 1 (Read 11008 times)

Hey everyone! Today we're going to learn about giving OP2 important data it needs to run your level and create our first unit. We're going to use the Multiplayer "Skeleton" template (bare-bones needed to compile a working, but empty, level) rather than the Hooville template. Open the project file (OP2Script.dsp, unless you renamed it). You should be looking at some code. Hopefully, you'll see something like this near the top of the file:

This just tells OP2 which map file to use. For example, on6_01.map is the map Pie Chart uses. For now, I want you to change this to "on4_01.map" (La Corrida's map). The map is just the terrain (hills, cliffs, plains, rocks, etc.) that your mission uses. Multiple missions can use the same map file. When I get the chance I'll provide a list of all default maps and their corresponding mission(s).

This tells OP2 which techtree your mission will use. Techtrees specify what players can research, how long that research takes, which lab the research takes place in, etc. For extremely detailed info, check out this post by Hooman.

Here's a list of default techtrees and a description:multitek.txt: Standard techtree used by most (if not all) standard multiplayer missions and colony games. Has almost all techs available. The best choice for most projects.edentek.txt: Techtree used by Eden campaign missions. Missing several Plymouth-only techs. Not recommended for multiplayer missions.ply_tek.txt: Techtree used by Plymouth campaign missions. Missing several Eden-only techs. Not recommended for multiplayer missions.tutortek.txt: Techtree used by the tutorials. Missing a lot of techs. Definitely not recommended for any mission.basictek.txt: Modified version of multitek. Basic Lab available at start, Basic Lab techs must be researched before Standard Lab available.

The DescBlock deals with a couple things. We'll go over them slowly. I'll list what each thing does and tell you what it is in the example DescBlock.

First option (MultiLastOneStanding): Gametype. This tells OP2 what kind of mission this is (colony game, tutorial, space race, etc.). Available options are:Colony - Colony GameAutoDemo - If you don't know what these are, open up OP2 and wait at the main menu for awhile. You won't be making these too often.Tutorial - Tutorial mission. You won't make these often either.MultiLandRush - Multiplayer land rush game.MultiSpaceRace - Multiplayer space race game.MultiResourceRace - Multiplayer waste of time... I mean, resource race game.MultiMidas - Multiplayer lame Midas game.MultiLastOneStanding - Multiplayer LoS game.Note: Should you one day make a campaign mission, the gametype should be the mission number. Example: For Eden Mission #3, the gametype would be 3.

Second option (6): Number of players. One through six. No further explanation needed.

Third option (12): Maximum tech level. For the most part, this will probably be 12. Changing it is really only useful for campaigns, since you usually want people to be able to research the entire techtree in multiplayer/colony games.

Fourth option (0): Unit mission. You remember those missions where you just had a couple of units and no base? Set this to 1 to make a mission like that. Usually you'll leave it at 0 though.

I'm going to separate this into two posts, so stay tuned and we'll have you making your first unit!

Note: If you did not read the intro, you may not understand what I'm talking about. The intro, as well as a link to further instructions, can be found here. Feel free to ask questions about SDK setup there.

« Last Edit: January 11, 2017, 08:49:23 PM by Sirbomber »

Logged

"As usual, colonist opinion is split between those who think the plague is a good idea, and those who are dying from it." - Outpost Evening Star

Try compiling. If it works, move the DLL into your OP2 folder and run it through the debug menu (press D on the main menu, press the RUN SCRIPT button and look for your new DLL in the list).

Wait a minute! The CC isn't in the right place! What's going on here?!

Well, OP2 is weird like that. It has invisible "buffer" tiles off the sides of the map (31 tiles off the left and right sides, 1 tile off the top and bottom). Just because we can't see them doesn't mean we don't have to deal with them, though. So how do we compensate for this? Add 31 to the x position and subtract 1 from the y position!

A: Unit handle. Don't worry about this for now. Just make sure you have that "Unit x;" line and set this to x for now.B: Unit type. This specifies what kind of unit it is (Command Center, ConVec, etc.). I'll attach a list of valid unit types later.C: Location. Try to remember you don't write it x, y but rather LOCATION(x, y). Also, for standard maps don't forget the offsets (x+31 and y-1) or your units will not be where you want them! For world maps/wraparound maps like Axen's Home and Around the World, the offsets are (x-1, y-1).D: Owning player ID. Player ID = Player number minus one. So player 1 is 0, player 2 is 1, ...E: Unit cargo. Used only for ConVecs (put structure kits inside them), combat units, and Guard Posts (equip them with a weapons turret). Note that this is NOT used for setting Cargo Truck cargo! I'll explain that at a later date.F: Vehicle rotation. This sets the direction the vehicle is facing. Obviously, unused by structures.0 = East1 = South-east2 = South3 = South-west4 = West5 = North-west6 = North7 = North-east

Maybe we should move those posts somewhere else? These tutorials are designed for people who don't know anything about programming. We don't want people to read those, assume they're relevant, get confused, and give up on the tutorials.

I can't figure out how to try and play my colony game. The filename is less then 7 letters and im trying to get it set up as a colony game but it isn't showing up.I would like soome help as soon as you posibly can. ThanksI think I know whats wrong, im using the code not the .dll file, and i need to find it. If you guys could give me any advice on were it should be at it will help a lot.