Home   Help Search Login Register  

Author Topic: What the hell is game logic?  (Read 1406 times)

0 Members and 1 Guest are viewing this topic.

Gooner861

  • Guest
What the hell is game logic?
« on: 12 Jul 2003, 19:25:02 »
The title explains all, what is game logic? This may sound stupid to most but i dont ave a clue wot it is.

Captain Winters

  • Guest
Re:What the hell is game logic?
« Reply #1 on: 12 Jul 2003, 20:42:07 »
a game logic is an invisible unit that is used to create explosions, units, soldiers ect. Can also be targeted by triger cams

Tanks! 8)

Offline SpecOp9

  • Members
  • *
Re:What the hell is game logic?
« Reply #2 on: 13 Jul 2003, 18:48:56 »
LMAO,

I was JUST about to post the exact thread with the exact same thread title.

But how do we get the game logics to work?
How the heke do you use them?
With all those Multiplayer maps in the pending list...
Somebody is gonna get a heart artak ;) lol!!!!!

gadolinite

  • Guest
Re:What the hell is game logic?
« Reply #3 on: 13 Jul 2003, 19:58:45 »
 >:(do me a favor in the future, try and refrain from using the  :gunman: four letter words.

It dishes out impatient feelings.

 :)About gamelogics

What is the point for the gamelogic waypoints (the and or ones).  How do you use them? What do you use them for???

Gooner861

  • Guest
Re:What the hell is game logic?
« Reply #4 on: 13 Jul 2003, 20:24:55 »
Ive used the gamelogics as a target in my cutscenes. Name the logic sumthing like logic1, so wen u get round to settting a target 4 ur camera u can use the logic.

OFP-SpecOps

  • Guest
Re:What the hell is game logic?
« Reply #5 on: 13 Jul 2003, 22:57:48 »
Can you use game logic as a target to aim weapons fire? A platoon of tanks blanketing an area with fire for example even if the enemy is still hidden to simulate recon by fire?

Offline KTottE

  • Former Staff
  • ****
Re:What the hell is game logic?
« Reply #6 on: 13 Jul 2003, 23:25:29 »
Units won't fire on game logics afaik, so you'll have to use the invisible helipad item instead (works a treat).

"Life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather to skid in broadside, thoroughly used up, totally worn out, and loudly proclaiming 'WOW What a Ride!'"

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re:What the hell is game logic?
« Reply #7 on: 14 Jul 2003, 00:32:52 »
Quote
so you'll have to use the invisible helipad item instead

as much as i remember dey wont fire on dat also :P

@ gonner n specops

GLs get lots of uses - i know u cud search 4 da thread dat had 2 Tuts bout dat - but da search function is f00ked up (or shud i say - its seems dat it went 2 heke :P - sry gad but i just had 2 do it ;) ;D)

just got da search workin  8)

here r qoutes form da thread i was talkin bout

from chris death

Quote
Well, the "logic groups" i've mentioned above isn't the
one by Sefe, therefore here are Sefe's words from the
old forum:

Code:You may have asked yourself what's the use of the game logic units. Most mission designers use it to get positions on the map (eg. Position = GetPos NameOfTheGameLogic).

But the game logic units have a much higher potential! You can use them to implement complex conditions to your missions without using any scripting. But you have to understand the behaviour of game logics:

1. Game logics have a position and can activate triggers just like any other units. Take a look at the condition box of a trigger. There you will find the option "game logic present". You can also group the game logic and the trigger and set the condition to "vehicle present". In this case the trigger will only be activated by the presense of this game logic.

2. You can define waypoints for a game logic unit. The waypoint type can be AND or OR (unlike the waypoints for a 'regular' unit that can be MOVE, HOLD, SEEK AND DESTROY etc.). I'll come to the waypoint type later. As soon as the mission starts, the game logic will go from waypoint to waypoint. But unlike all other units the game logic will not move to the waypoint but 'jump' immediately to it's position.

3. Like for all other waypoints you can define a condition, a timeout and an OnActivation code for a game logic waypoint. When a game logic reaches a waypoint it will perform these actions (in this order):

Wait until the condition is TRUE

Wait until the timeout is passed

Execute the OnActivation code

Jump to the next waypoint


4. Like all waypoints you can synchronize a game logic waypoint with a trigger. That means that the game logic will not proceed to the next waypoint until the trigger condition is TRUE. Now we'll return to the type of the game logic waypoint (AND or OR). If you synchronize more than one trigger with the waypoint, the behaviour of the trigger will depend on the waypoint type. If it is an AND waypoint, the game logic will only jump to the next waypoint when all triggers are activated. If it is an OR waypoint it will proceed to the next waypoint when any of the triggers is activated.

5. Like all other waypoints you can also synchronize a game logic waypoint with any other waypoint. The game logic and the other unit will not proceed to their next waypoints until both of them have reached the synchronized waypoint. This is absolutely the same behaviour as if you would synchronize two non-game logic units. Of course you can also synchronize two game logic waypoints.

But what is that all good for? I'll give you some examples showing the whole potential of game logic units:

Example 1: Establishing radio conversations

To establish a radio conversation you would probably write a script that would look like this:

Alpha1 SideRadio "Message1"
~5
Bravo1 SideRadio "Message2"
~8
Alpha1 SideRadio "Message3"

Without a script you would do it like this:

You'd create a game logic and four waypoints

You'd synchronize the first WP with the trigger that will start the conversation

In the second WP's OnActivation field you'd write: Alpha1 SideRadio "Message1"

In the third WP's OnActivation field you'd write: Bravo1 SideRadio "Message2". Since this radio message has to be sent five seconds after the first, you'd set the timeout to five seconds

In the fourth WP's OnActivation field you'd write: Alpha1 SideRadio "Message3". You'd set the timeout to eight seconds.


As you can see, we can use the timeout of the game logic WPs to time events without having to call a script. While the timeout is equivalent to the ~-operator, the condition field is equivalent to the @-operator.

You can use this method also to create cutscenes without any scripting. In the attachment you will find an example mission that demonstrates a cutscene (radio Alpha) and a radio conversation (radio Bravo).

Example 2: Combining triggers to complex condtions

Now it's going to be a little more complex. What if you had three triggers. The third trigger should be activated if one of the two other triggers are activated. You could also express it like this:

Trigger3 = Trigger1 OR Trigger2 [do not use this syntax in OFP, it's just to describe the boolean correlation of the triggers]

To achieve that you can use a game logic unit:

Create a game logic and define two waypoints. Place the first waypoint outside the third trigger's area and the second one inside the area.

Set the first waypoint's type to OR.

Synchronize the first and the second trigger with the first (OR) waypoint

Draw a group line [F2] between the game logic and the third trigger. Set the trigger's condition to "vehicle present"


The whole thing will work like this: At the beginning of the mission, the game logic will jump to it's first waypoint. Since it's outside of the third trigger's area, it doesn't activate it. The game logic will wait at this OR-waypoint until either the first or the second trigger will be activated. As soon as this happens, the game logic will jump to it's next waypoint. This waypoint is inside the area of the third trigger and so it will be activated. That will cause exactly the effect we wanted.

Finally, let's get really advanced. This time you have four triggers. The fourth trigger should be activated on this condition:

Trigger4 = (Trigger1 OR Trigger2) AND Trigger3

Let's go to work:

Create a game logic, define two waypoints. The first one must be an AND waypoint. The second waypoint must be inside the area of Trigger4. Group Trigger4 and the game logic and set the trigger condition to "vehicle present". This is all similar to above (except that we now use an AND waypoint).

Synchronize Trigger3 with the first waypoint of the game logic.

Create a second game logic with two waypoints. Set the first waypoint to OR. Synchronize the second waypoint with the first waypoint of the other game logic.

Synchronize Trigger1 and Trigger2 with the first (OR) waypoint of this game logic.


But how the hell does this work?

The second game logic will proceed to it's second waypoint if either Trigger1 or Trigger2 is activated. That's the same as above. You could also say:

GameLogic2ReachedWaypoint = Trigger1 OR Trigger2

The first game logic will reach it's second waypoint and activate Trigger4 when Trigger3 is true and the second game logic has reached it's second waypoint:

Trigger4 = GameLogic2ReachedWaypoint AND Trigger3

If you combine these expressions, you'll get:

Trigger4 = (Trigger1 OR Trigger2) AND Trigger3

Voilà!

You can even create more complex condtions in your mission when you combine three or more game logics.
 

hope you forgive me Sefe that i kept you from typing that
all again by yourself  

~S~ CD

nd from tomby

Quote
btw, I found some stuff too, didn't keep the authorName, sorry 'bout that, and some of it may overlap what ole seffy wrote back then, but anyho' - here goes  :


Code:This tutorial explains how to use Logic groups in your missions.

Logic groups allow you to create a sequence of waypoints on the map that are not
tied to a physical group in the game. The logical groups behave like a group in
that it moves from waypoint to waypoint but there is no actual units
displayed in the game.


The demo mission uses these logic groups to drive the following conversations
in the demo mission :
Officer saying wait here and beginning of mission
Officer talking with the patrol
Officer talking to you while in the jeep
Officer talking while you are driving the jeep


The waypoints of these logic groups shadow the movement of the soldiers that are
having the conversation thereby allowing the mission builder to seperate the
conversation from the actual movement of the soldiers.


The following is an example of how a logic group is used in the demo mission.


NOTE : I haven't done much with logic groups yet so some of this might be assumptions.


Example : Officer talking in jeep during demo mission
At the beginning of the demo mission there is a point where the officer and your
character jump into the jeep and the officer proceeds to tell you about the mission
while he is driving. The entire dialog is handled with the LOGIC functionality.


Below is waypoint number 4 for the item11 group (the group consisting of the
officer and your character). This waypoint indicates that the group should get
into the assigned vehicle (in this case the jeep). Notice the synchronization field
set to 8? This indicates that the expActiv field will not be executed until any other
sensors or waypoints with synchronization equal to 8 have been triggered.
More about that in a moment.


class Item3
{
position[]={8110.902832,10.232186,5093.410645};
id=41.000000;
type="GETIN";
combat="AWARE";
expActiv="0 fadeMusic 0.22";
synchronizations[]={8};
class Effects
{
track="05demo";
};
showWP="NEVER";
};



Below is the logic group from the demo mission which is used to execute the dialog
within the jeep. Notice that the side field equals "LOGIC". It only needs a single
vehicle defined in this group and its side field is also set to "LOGIC" and the
vehicle field is set to "Logic". For any logic group you would create you would use
a similar vehicle definition.


The waypoints are where the interesting stuff is. Notice each waypoint has the
type field must be set to "AND".


Take a look at waypoint 0. Notice its synchronization field is set to 8?
This indicates that this logic group will not proceed to waypoint 1 until
waypoint 4 of the group the officer and your player are in has been triggered
(i.e. they both got into the jeep).


Okay, once the officer and your character are in the jeep then waypoint 1 is triggered.
Notice its expCond field is "off in jeep and aP in jeep"? No sense having a dialog if
both participants aren't in the jeep! If the condition is true then the game
waits 4 seconds (based on the values of the timeout fields) and the executes the command
in the expActiv instructing the officer to say something.


Waypoint 2 is then triggered. Again notice its expCond field is
"off in jeep and aP in jeep"? No sense having a dialog if both participants aren't
in the jeep! If the condition is true then the game waits 17 seconds
(based on the values of the timeout fields) and the executes the command in
the expActiv instructing the officer to say something else.


Waypoint 3 is then triggered.
Again notice its expCond field is "off in jeep and aP in jeep"?
No sense having a dialog if both participants aren't in the jeep!
If the condition is true then the command in the expActiv instructing
the officer to say something else is executed. Notice the syncrhonization field
is set to 9? That means the command in the expActiv field won't be executed until
any other sensors or waypoints with synchronization set to 9 are also triggered.
Read below to see the sensor with synchronization set to 9.
class Item23
{
side="LOGIC";
class Vehicles
{
items=1.000000;
class Item0
{
position[]={8058.157715,5.852848,5001.322266};
special="NONE";
id=87.000000;
side="LOGIC";
vehicle="Logic";
leader=1.000000;
lock="LOCKED";
skill=1.000000;
markers[]={};
};
};
class Waypoints
{
items=4.000000;
class Item0
{
position[]={8105.548340,5.450422,5001.322266};
type="AND";
synchronizations[]={8};
class Effects
{
};
showWP="NEVER";
};
class Item1
{
position[]={8143.950684,6.763751,5001.321777};
type="AND";
expCond="off in jeep and aP in jeep";
expActiv="off say ""S02v03""";
synchronizations[]={};
class Effects
{
};
timeoutMin=4.000000;
timeoutMid=4.000000;
timeoutMax=4.000000;
showWP="NEVER";
};
class Item2
{
position[]={8169.280273,7.815929,5001.321777};
type="AND";
expCond="off in jeep and aP in jeep";
expActiv="off say ""S02v50""";
synchronizations[]={};
class Effects
{
};
timeoutMin=17.000000;
timeoutMid=17.000000;
timeoutMax=17.000000;
showWP="NEVER";
};
class Item3
{
position[]={8190.720215,8.735840,5001.470703};
type="AND";
expCond="off in jeep and aP in jeep";
expActiv="off say ""S02v05""";
synchronizations[]={9};
class Effects
{
};
showWP="NEVER";
};
};
};



Below is a sensore defined in the demo mission. It is triggered when vehicle id 41
(i.e. the jeep) has entered an area surrounding position (7609,4807).
It has a synchronization field set to 9 same as the logic groups last waypoint.
This means that the officer will not say string S02v05 (from waypoint 3)
until the jeep has reached this area. The officer and your character (in the jeep)
will cause this sensor to trigger since their fourth waypoint (the one after the
GETIN waypoint) is very close to that position.


class Item19
{
position[]={7609.221191,28.079998,4807.668457};
a=20.000000;
b=20.000000;
activationBy="VEHICLE";
age="UNKNOWN";
idVehicle=41.000000;
text="Dorazili";
class Effects
{
};
synchronizations[]={9};
};


That is how the conversation in the jeep was scripted using LOGIC functionality.


The same thing could have been achieved by having multiple waypoints defined for
the officer and your character group from the time they get into the jeep
(waypoint 3) and the time they reach the village (waypoint 4).
Each of these new waypoints would then have the officer saying one of his
profound statements. By using the logic group though you are not tightly coupling
the actual movement of the jeep with the dialog but rather the dialog is occuring
at certain time intervals during the trip. This allows the mission builder to tweak
the movement path independent of the conversation.
-----------------------------------------------------------------------------------

You may have asked yourself what's the use of the game logic units.
Most mission designers use it to get positions on the map
(eg. Position = GetPos NameOfTheGameLogic).

But the game logic units have a much higher potential! You can use them to
implement complex conditions to your missions without using any scripting.
But you have to understand the behaviour of game logics:

1. Game logics have a position and can activate triggers just like any other units.
Take a look at the condition box of a trigger. There you will find the option
"game logic present". You can also group the game logic and the trigger and set
the condition to "vehicle present". In this case the trigger will only be activated
by the presense of this game logic.

2. You can define waypoints for a game logic unit. The waypoint type can be AND or OR
(unlike the waypoints for a 'regular' unit that can be MOVE, HOLD, SEEK AND DESTROY etc).
I'll come to the waypoint type later. As soon as the mission starts, the game logic will
go from waypoint to waypoint. But unlike all other units the game logic will not move
to the waypoint but 'jump' immediately to it's position.

3. Like for all other waypoints you can define a condition, a timeout and an
OnActivation code for a game logic waypoint. When a game logic reaches a waypoint
it will perform these actions (in this order):

Wait until the condition is TRUE

Wait until the timeout is passed

Execute the OnActivation code

Jump to the next waypoint


4. Like all waypoints you can synchronize a game logic waypoint with a trigger.
That means that the game logic will not proceed to the next waypoint until the
trigger condition is TRUE. Now we'll return to the type of the game logic waypoint
(AND or OR). If you synchronize more than one trigger with the waypoint,
the behaviour of the trigger will depend on the waypoint type. If it is an AND waypoint,
the game logic will only jump to the next waypoint when all triggers are activated.
If it is an OR waypoint it will proceed to the next waypoint when any of the triggers
is activated.

5. Like all other waypoints you can also synchronize a game logic waypoint with
any other waypoint. The game logic and the other unit will not proceed to their
next waypoints until both of them have reached the synchronized waypoint.
This is absolutely the same behaviour as if you would synchronize
two non-game logic units. Of course you can also synchronize two game logic waypoints.

But what is that all good for? I'll give you some examples showing the whole potential
of game logic units:

Example 1: Establishing radio conversations

To establish a radio conversation you would probably write a script that would
look like this:

Alpha1 SideRadio "Message1"
~5
Bravo1 SideRadio "Message2"
~8
Alpha1 SideRadio "Message3"

Without a script you would do it like this:

You'd create a game logic and four waypoints

You'd synchronize the first WP with the trigger that will start the conversation

In the second WP's OnActivation field you'd write: Alpha1 SideRadio "Message1"

In the third WP's OnActivation field you'd write: Bravo1 SideRadio "Message2".
Since this radio message has to be sent five seconds after the first, you'd set
the timeout to five seconds

In the fourth WP's OnActivation field you'd write: Alpha1 SideRadio "Message3".
You'd set the timeout to eight seconds.


As you can see, we can use the timeout of the game logic WPs to time events
without having to call a script. While the timeout is equivalent to the ~-operator,
the condition field is equivalent to the @-operator.

You can use this method also to create cutscenes without any scripting.
In the attachment you will find an example mission that demonstrates a cutscene
(radio Alpha) and a radio conversation (radio Bravo).

Example 2: Combining triggers to complex condtions

Now it's going to be a little more complex. What if you had three triggers.
The third trigger should be activated if one of the two other triggers are activated.
You could also express it like this:

Trigger3 = Trigger1 OR Trigger2 [do not use this syntax in OFP,
it's just to describe the boolean correlation of the triggers]

To achieve that you can use a game logic unit:

Create a game logic and define two waypoints. Place the first waypoint
outside the third trigger's area and the second one inside the area.

Set the first waypoint's type to OR.

Synchronize the first and the second trigger with the first (OR) waypoint

Draw a group line [F2] between the game logic and the third trigger.
Set the trigger's condition to "vehicle present"


The whole thing will work like this: At the beginning of the mission,
the game logic will jump to it's first waypoint. Since it's outside of the
third trigger's area, it doesn't activate it.
The game logic will wait at this OR-waypoint until either the first or
the second trigger will be activated. As soon as this happens,
the game logic will jump to it's next waypoint.
This waypoint is inside the area of the third trigger and so it will be activated.
That will cause exactly the effect we wanted.

Finally, let's get really advanced. This time you have four triggers.
The fourth trigger should be activated on this condition:

Trigger4 = (Trigger1 OR Trigger2) AND Trigger3

Let's go to work:

Create a game logic, define two waypoints. The first one must be an AND waypoint.
The second waypoint must be inside the area of Trigger4. Group Trigger4 and the
game logic and set the trigger condition to "vehicle present".
This is all similar to above (except that we now use an AND waypoint).

Synchronize Trigger3 with the first waypoint of the game logic.

Create a second game logic with two waypoints. Set the first waypoint to OR.
Synchronize the second waypoint with the first waypoint of the other game logic.

Synchronize Trigger1 and Trigger2 with the first (OR) waypoint of this game logic.


But how the hell does this work?

The second game logic will proceed to it's second waypoint if either Trigger1 or
Trigger2 is activated. That's the same as above. You could also say:

GameLogic2ReachedWaypoint = Trigger1 OR Trigger2

The first game logic will reach it's second waypoint and activate Trigger4 when
Trigger3 is true and the second game logic has reached it's second waypoint:

Trigger4 = GameLogic2ReachedWaypoint AND Trigger3

If you combine these expressions, you'll get:

Trigger4 = (Trigger1 OR Trigger2) AND Trigger3

Voilà!

You can even create more complex condtions in your mission when
you combine three or more game logics.
 



som'n like that  

l8rs  

Tombs

also u can find da thread here

http://www.ofpec.com/yabbse/index.php?board=6;action=display;threadid=9376;start=30

LCD OUT
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta