project reality header
Go Back   Project Reality Forums > PR:BF2 Mod Forums > PR:BF2 Community Modding > Modding Tutorials
08 Sep 2024, 00:00:00 (PRT)
Register Developer Blogs Members List Search Quick Links
Modding Tutorials Information and tutorials related to modding BF2.

Reply
 
Thread Tools Display Modes
Old 2023-01-13, 14:31   #1
Outlawz7
Retired PR Developer

Outlawz7's Avatar
Default [Tutorial] Creating and editing GamePlayObjects

1. Introduction

In this tutorial I'll describe the work flow for creating GamePlayObjects or GPO for short. GPO are spawn points, object spawners and control points that together make a layer for a specific gamemode and size.

There are four layer sizes named 16,32,64 and 128 in backend, which in BF2 denoted intended player count, while in Project Reality the frontend are named Infantry, Alternative, Standard and Large.

This tutorial assumes you've completed the tutorial on Setting Up the BF2 Editor for PR Mapping/Modding

To add to point 7 of above tutorial, there are 7 gamemodes and 4 layer sizes possible in Project Reality however the editor dialog window is only capable of properly displaying 9 entries which is two less than total.



To avoid this disable two lines with the 'rem' command before running editor. Do pay attention to which gamemodes and sizes you'll want to work on beforehand.

Quote:
rem LayerManager.CreateDefaultFilter gpm_coop Coop
rem LayerManager.CreateDefaultFilter gpm_gungame Gungame
LayerManager.CreateDefaultFilter gpm_cnc Command_and_Control
LayerManager.CreateDefaultFilter gpm_cq AAS
LayerManager.CreateDefaultFilter gpm_insurgency Insurgency
LayerManager.CreateDefaultFilter gpm_skirmish Skirmish
LayerManager.CreateDefaultFilter gpm_vehicles Vehicle_Warfare

LayerManager.CreateDefaultPlayerFilter 16
LayerManager.CreateDefaultPlayerFilter 32
LayerManager.CreateDefaultPlayerFilter 64
LayerManager.CreateDefaultPlayerFilter 128


2. Setting up layers

We're starting with a map in need of GPO. To begin, first set up all the layers you'll want to add to this map. You'll find them on the right side of editor while running in Level Editor.



Name your layers accordingly ie. ins64 or insurgency_standard. Shorter names fit the user interface better, remember the backend/frontend, Advance and Secure is still called cq_ from BF2's Conquest and aforementioned sizes.



Once you've named the layers, pick the gamemode and size. For our Insurgency 64/Standard layer we'll pick Insurgency and 64.



Multiple layers can save into one or several gamemodes and sizes. It's practical to have one layer that saves ammo caches to all Insurgency layers, for example.




3. Combat Areas

Combat Areas or CA, 'DOD' or 'dome of death' in Project Reality, define the playable area within our map.

To place a CA, select the CA tool while in Level Editor:


The rule is to place counter-clockwise (I forget why). A usual CA in Project Reality is four points at four corners of map defining the entire map as playable. Smaller layers such as Skirmish, Gungame and Co-Op have more varied CA sizes.

Right click anywhere on viewport to begin placing CA points:


(Copy and Paste can be used on a completed Combat Area once you have one.)

Right click again nearby to add a second point. Once two points exist, a green line will appear.



Continue right-clicking or alternatively, hold down Alt key and left-click to continue placing points.
Press Backspace to remove the point that was placed last.

Once you want to complete your CA, click on the first point you've placed. The editor will prompt you if you want to close the CA.



Clicking Yes, you've completed your first CA. A selected CA will color blue, unselected will be red.




To place a 'DOD', defining a safe area for one team, repeat the process. Once done, select the CA and look at Tweakbar.
Two lines need to be defined to turn a Combat Area into a 'Dome of Death', Inverted must be ticked and a team (1 or 2) must be selected. The team is the one that isn't allowed inside this area, f.e. to protect team 2, DOD must be team 1 and inverted.




4. Control Points

In Level Editor, with either Select or Move tools active, right click in viewport and click on 'Create Control Point':


You'll be prompted to name your Control Point/CP to begin. For Project Reality maps please adhere to our naming convention to avoid naming conflicts.



cpname_ is self-explanatory
map_folder_name_ is the backend/folder name of your map f.e. PR's 'Shijia Valley' is 'shijiavalley' in backend.
gamemodesize_ must be the correct gamemode name and size for the layer this control point is on:
aas
skirmish
insurgency
vehicles
gungame
cnc
coop

and 16/32/64/128. For example: aas32, insurgency64, skirmish16 etc.

control_point_name is whatever you want to call your control point ie. 'village' 'usmain' etc.

Once placed, select it and look at TweakBar. We have quite a few settings available:


ControlPointID: unique number assigned to this control point. Spawn points and object spawners are tied to this CP by CPID. Can be manually changed after creating, changing it connects/disconnects spawners with same/different CPID. Two or more CPs with same CPID leads to conflicts and crashing in editor, avoid duplicates.

Absolute Position: XYZ coords, placement can be changed here but moving the control point in viewport is simpler.

Layer: the layer it's on

Team: can be 0, 1 or 2. 0 is neutral, teams 1 and 2 are defined in init.con

Radius: capture radius in meters

RadiusOffset: offsets center of radius from the center of CP

AreaValueTeam1&2: how much AreaValue this CP gives to the team that owns it. A total value of hundred is needed to start a ticket bleed for the opposing team ie. AreaValueTeam1 100 bleeds team 2.

TimeToGetControl: time in seconds to capture flag. In Project Reality Team 1 Capture/Neutralize time
TimeToLoseControl: time in seconds to neutralize flag. In Project Reality Team 2 Capture/Neutralize time

DisableIfEnemyInsideRadius: no idea, leave as is
DisableWhenLosingControl: no idea, leave as is
LoseControlWhenEnemyClose: leave as is, likely means you start losing ownership of CP if enemy is on it ie. the default behaviour for a control point
LoseControlWhenNotClose: no idea, leave as is

UnableToChangeTeam: makes the CP uncaptureable, used for main bases

OnlyTakeableByTeam: makes the CP only captureable by one team. Command works but editor doesn't save it, needs to be added manually.

MinNrToTakeControl: minimum number of players need to start capturing, leave as is, Project Reality gamemodes set this value.

EnemyTicketLossWhenCaptured: what it says, leave as is, gamemodes set this value.

ShowOnMinimap: shows or hides the CP on minimap. CP and its spawns will still exist in world.

IsUnstrategicControlPoint: no idea, leave as is

ControlPointName: what we named the CP at start, can rename here

SupplyGroupID: this value sets the capture order for CPs in Project Reality's AAS gamemode. Will be explained in detail further in this tutorial.

HoistFlag: set if the flag moves up and down the flagpole when being captured/neutralized.

HoistMinMax: set how much the flag moves

FlagTemplateTeam0/1/2: set a custom flag to be used for each team instead of the default flag

IsHemisphere: not sure, but CP capture area is a sphere so maybe this makes it a hemisphere? Leave as is

ForSoldierOnly: only infantry on foot can capture this flag

HasGreyCapturingState: no idea, leave as is

MinimapNameOffset: offset the CP's name from CP on minimap on X and Y axis. Value is pixels at 800x600 screen resolution

Flagpole: the object to be used as flagpole, defaults to 'flagpole'. Can be cleared but editor will continue showing 'flagpole' as entered value until next time you run editor


5. Spawn Points

To create a spawn point, repeat the process for creating a control point but this time choose 'Spawn Point':


The spawn point will be created tied to nearest control point, bearing its name. You'll be prompted to name it, but default name is good enough:


We have a couple of TweakBar settings available to us. The horizontal green plane shows the direction a player or bot spawning on this spawn point will face:


AbsolutePosition: same as with CPs, position can be changed here but using Move tool is simpler.

Layer: what layer its on

ControlPointID: ties the spawn point to the CP with this CPID

Group: grouping spawn points means they'll show up as own spawn point icon on minimap f.e. lower and upper spawn on US carrier

SpawnPreventionDelay: no idea, leave as is

SpawnAsParatrooper: BF1942 legacy command where it opened player's parachute on spawning. Does not function in BF2

IsVisible: no idea, leave as is

EnterOnSpawn: if an enterable vehicle is near the spawn point, the player will spawn into that vehicle

AIEnterOnSpawn: same as above but for bots

OnlyForAI: only bots can spawn on this point

OnlyForHuman: only players can spawn on this point

MinSpawnHeight: no idea, leave as is

ScatterSpawnPositions: spawns the player in a random position around the spawn point, does not check for collision so players may end up inside objects. Usage not recommended

AllowSpawnCloseToVehicle: if left unchecked, vehicles may block the spawn point preventing spawning. Mandatory in PR to have this enabled to prevent spawn blocking.

There is not much more to spawn points past placing them down, so players can spawn into the game world. Care should be used when placing them to make sure players can spawn into a safe, unobstructed spot and at least several spawn points should exist to give up to 50 players enough room to spawn in.

6. Object spawners

Repeat process from before and this time select 'Create ObjectSpawner':


The object spawner will be created tied to nearest control point. A window will prompt you to select the type of spawner you want from a list.
This list is controlled by ObjectSpawnerDef.con inside LevelEditor folder in same directory as LayerInit.con



Other than spawning objects editor doesn't recognise as spawnable objects, such as pickup kits, this list is useless. Press Cancel and continue to the name prompt.

Object spawners will bear the name of the nearest control point, same as spawn points. This time take care to give the spawner a unique name to avoid naming conflicts and to differentiate it from other spawners.


TweakBar gives us options for an object spawner:


AbsolutePosition, Layer and ControlPointID are same deal as before.

VehicleTeam1: the object that will be spawned for team 1 if team 1 owns the CP controlling the spawner

VehicleTeam2: the object that will be spawned for team 2 if team 2 owns the CP controlling the spawner

SpawnDelayAtStart: if checked, the spawn will be delayed

TimeToLive: how long in seconds before object starts decaying and dies. In Project Reality this value should be 99999.

Distance: distance in meters from object spawner's position at which the object will start to decay. Practically cancelled out by TimeToLive being 99999, so don't bother setting this.

Team: the team this object belongs to, should be set to same team as VehicleTeam

MaxNrOfObjectSpawned: how many times will this spawner spawn the object defined in VehicleTeam. The delay between spawns equals the respawn delay. f.e. setting it to 3 and if the object has 5 minute respawn will result in three objects being spawned once every 5 minutes. The additional objects wont begin to spawn until first one has been moved off the object spawner's position.

Radius: no idea, leave as is

MaxSpawnDelay: the respawn delay

MinSpawnDelay: should be set to same value as MaxSpawnDelay unless SpawnDelayAtStart is enabled in which case it defines the spawn delay time

UseButtonRadius: no idea, leave as is

IsVisible: no idea, leave as is

DamageWhenLost: leave as is, possibly the damage value for the decay

HoldObject: the spawned object doesn't interact with game world until entered by player

VisibleTeam: no idea, leave as is

TeamOnVehicle: team lock the object

Outlawz7 is offline
Last edited by Outlawz7; 2023-02-14 at 16:42..
Reply With Quote
Old 2023-03-19, 09:12   #2
Outlawz7
Retired PR Developer

Outlawz7's Avatar
Default Re: [Tutorial] Creating and editing GamePlayObjects

7. Flag routes

Flag route tutorial can be found here, but I will give a quick run down on setting it up in this section.

Flag routes are determined by numbers in control point's SupplyGroupID as mentioned earlier in this tutorial.

The base rules are that team 1 main base must be number 1 and team 2 should be -1, but can also just be the last/highest number. A flag with -1 should be an uncap else it won't show ingame AFAIK.

There are several ways of doing flag routes.

Single digit SGID: you simply use numbers from 1 to 9, with -1 as the possible tenth flag for team 2 main base.
This can be found on maps with single flag route such as Muttrah or Kashan.

Double digit SGID: you add a second number to determine random flag choice and amount of.
For example '23' means 3 flags will be picked in group 2 out of X possible ones (X should be higher or equal 3 flags in this case for best behavior).

Triple digit SGID: also known as AASv4 in above linked tutorial. You add a third number to determine routes.
Used on most maps.

And newest addition is six digit SGID. This allows having more than 10 flags in route and has been used so far on Fields of Kassel/Korbach. The value cannot be entered in editor's UI as it gets cut off at four digits/value of 1000, but can be entered via editor's console or manually with Notepad.

Six digit SGID works by expanding the three digit SGID to six places, ie. ABC becomes AABBCC.
Single digits need to have 0 in front ie. 102 becomes 010002


8. Creating main bases

Using earlier information in this tutorial on control points, object spawners and spawn points we'll create our first PR main base.

We'll begin by creating the vehicle depot spawner.

Give it a functional unique name, in my case 'vd' or 'vehicledepot' etc. Keep the flag name.



Set the correct spawner for the team and team lock, but do not set respawn time or decay. Vehicle depots cannot move or be destroyed so decay and respawn values do not need to be set (keep default values).



Now copy paste this spawner and name it 'acv' or 'commandpost' etc. This will be the team's command post where commander can access UAV. Change the spawner itself but keep the settings as same conditions apply.



Now we'll create out first actual vehicle spawner.
This time we'll need to set decay and respawn time.
Here I've created my first logi, set its decay to 99999 and gave it 5 minute (300 seconds) respawn time.



From here on out repeat this process until you're satisfied.



9. Cloning layers

Let's say you've created your aas64 layer and now want to create your aas32 layer using aas64 as the starting point.

With your aas32 layer selected, right click in viewport, go Duplicate Layer and select your aas64 layer.



You will be prompted to rename flags. Fix the start of the name to be 'cpname_' again and make sure you've changed 'aas64' to 'aas32' in this case. For multiple flags you can copy the text up to the actual flag name and paste it for subsequent renames to save time.





You will then be prompted to name spawn points and object spawners. Do not do this. They are named correctly. Simply keep clicking OK until prompts run out or you hit a flag that needs to be renamed.



You've successfully cloned the layer. Here is where correct naming matters, as duplicate names can lead to crash or error spam and in practical terms its easier to locate spawners.


Outlawz7 is offline
Last edited by Outlawz7; 2023-03-19 at 10:33..
Reply With Quote
Old 2023-07-01, 12:36   #3
Outlawz7
Retired PR Developer

Outlawz7's Avatar
Default Re: [Tutorial] Creating and editing GamePlayObjects

10. Setting up Gamemodes other than AAS

To begin, all non-AAS gamemodes (excluding Co-Op here) use AAS as base, so other than gamemode specific code rules they will likely fall back on behaving same as AAS.


Insurgency

Make sure your layer saves to gpm_insurgency (see 1. Introduction for more info).

Create two main bases, one for each team, with SGID of 1 for team 1 main and SGID -1 for team 2 main.

To add ammocaches, create a spawner that spawns an 'ammocache' object that's team locked to team 1 and doesn't respawn. Make it tied to team 1 main base flag or CPID of -1 as in picture:



Make sure there is enough room around the cache to spawn on it, it doesn't clip into objects, the position makes sense etc. Keep copy pasting this spawner to add more caches.

You can also add all the nonrespawn vehicles around the map the same way.

Spoiler for Internal Development Note:
A PR Build script converts these spawners to a JSON list of positions for optimization. Usage is heavily recommended as it lowers map load times.




Command and Control/CNC


Make sure your layer saves to gpm_cnc .

Create two main bases, one for each team, with SGID of 1 for team 1 main and SGID -1 for team 2 main. Assets should mirror AAS layers for best consistency. Do not use any other flags.



Vehicle Warfare

Make sure your layer saves to gpm_vehicles

This is AAS clone. Set up mains and flags same way as AAS but give both teams heavy assets on low respawn. Note that players are not able to build deployables or request kits other than Pilot&Crewman in this gamemode.


Skirmish

Make sure your layer saves to gpm_skirmish

Also AAS clone. Set up mains and flags same way as AAS but no assets this time. Create spawners with fixed_supply_crate at mains to allow for resupply and kit request.
Playable areas should be way smaller than AAS, focus on a particular point of interest on the map or otherwise infantry-friendly area of map.

Gungame

Make sure your layer saves to gpm_gungame

Create the playable area, should be something very small (see existing Gungame layers).
Create a team 2 main base flag that should have 'blufor' at the end of the name ie. cpname_albasrah_2_gungame16_blufor and make sure showOnMinimap is disabled.
The name matters in order for spawn point protection to work in this gamemode.

Start creating spawn points around the playable area tied to flag.
Once done, clone the layer on itself and rename the cloned flag for team 1 main and spawns, team 1 main should be called anything but _blufor and have SGID of 1 and showOnMinimap disabled as well.

Outlawz7 is offline
Last edited by Outlawz7; 2023-08-22 at 09:52..
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 02:18.