Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

Dev Diary #09: CS Event Engine

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Campaign Series: Middle East 1948-1985 >> Dev Diary #09: CS Event Engine Page: [1] 2   next >   >>
Login
Message << Older Topic   Newer Topic >>
Dev Diary #09: CS Event Engine - 6/28/2017 5:40:15 PM   
Crossroads


Posts: 17372
Joined: 7/5/2009
Status: offline
Berto suggested I'd start a new Developer Diary on CS Event Engine and what can be done with it to give the CS scenarios additional oomph. And why not. We're just out with the first CS Event Engine 1.0 code, so it's still early. But what better way to get everyone's thoughts and ideas in as early as possible than giving some living samples as what it can do already in this BETA stage.

So let us keep this interactive, and let us have those ideas coming in.

Berto will no doubt do a Coder Diary on Event Engine at some stage, giving out the details how Lua, the scripting language used in CS Event Engine, works. But in this thread, let us not get bogged down in technical details, let us talk scenario design instead.

With this in mind, I'll start with "Crisis in Sirte: 1. Prelude (H2H)" as the sample to use here.

At this stage, I've already got an initial list of ideas I want to try out. Here they are, in no particular order:

  • I'd like to give both sides a briefing in the beginning as what their key tasks are.
  • Later perhaps, I'd like to give the players feedback as how they are doing per achieving those tasks.
  • I want events too, of course. So how about a few events that can trigger the arrival of reinforcements. Given how things go, they might come sooner, or later. Or not at all.
  • For instance, I'll add a Libyan SAM site to the coast, and have some British SAS troops there to take it out. Only once its out can the Air assault begin.
  • The Brits paratroopers may be used to being surrounded, too, but I'd like to have their supply situation worsen throughout the game play, for one. Perhaps some other difficulties as well?
  • Losses might have an effect as well. Lose your commander, and everyone's Morale goes down?

    What else?

    In the Adaptive AI Dev thread, I fooled around with AI parameters. Those can be accessed from Event Engine as well, so that might be the proper place to do it.

    I'll get started little by little on this one. Meanwhile, any ideas, wishes, what ever, please chip in!

    So let us start by asking first what you'd like to see take place on that scenario?

    Let us then see if I can then have them take place


    < Message edited by Jason Petho -- 1/31/2018 10:14:02 PM >


    _____________________________

  • Post #: 1
    RE: Dev Diary #09: CS Event Engine - 6/28/2017 5:41:16 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    We've not yet really talked about CS Event Engine so much, so here's a little something from Sneak Peeks to get things started:


    quote:

    ORIGINAL: Crossroads


    quote:

    ORIGINAL: berto


    At latest count, over 120 functions in the new Campaign Series (Lua) Event Engine:



    So cool, so much more finesse can now be put into scenario design.

    For instance, with the Crisis in Sirte scenario "Prelude", what if the Libyan player just decides to vacate Sirte, saving his troops from losses and thus preventing his opponent to gain additional Victory Points for destructing enemy unis? Gamey tactics, even, if Sirte would be such a key port facility to deny the Brits have access to it in later Sirte scenarios.

    How about we give him reinforcements, then, should he succesfully hang into Sirte for the first ten turns? Now he'd have a reason to fight tooth and nail to keep the Brits out!

    Something like this perhaps?

    -- Early stuff, by the way! The CS Event Engine will be worth both Coder and Developer Diaries in due time, just not quite yet --








    _____________________________


    (in reply to Crossroads)
    Post #: 2
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 11:46:07 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Ok, so let us get this Diary on its way. First, here's the current set of CS Event Engine functions. They're at early 1.0 BETA stage, so expect to see some changes yet.

    The Event Engine functions come in two major groupings: trigger functions, and action functions.

    Trigger functions are something the game calls upon the particular event having taken place, they all start with on_* , for instance on_next_turn(turn); or on_next_phase(turn, side).

    It is these functions you first provide in your scenario specific .lua files, and within them you then have the actions you want to take place at the time. They provide some parameters for you to help on determining what's going on, for instance the on_next_phase() gives you the current turn and side.

    Trigger functions, as they currently stand, are:

  • on_air_attack (x, y, pid, name, side, nation, points, strength)
  • on_next_phase (turn, side)
  • on_next_turn (turn)
  • on_objective_capture (x, y, value, side)
  • on_startup ()
  • on_unit_kill (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
  • on_unit_reduce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader, loss)
  • on_unit_reinforce (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
  • on_unit_release (pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
  • on_unit_remove (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)


    Action functions, then, are the stuff you want to happen when one of the events listed above happened, and the respective function in your in your scenario specific Lua file is called .

    Action functions come in two flavors as well, one for getting more information from the game, and another for setting new values in place of the existing ones.

    On the first, say if you need more information about some particular things, you'd use some of the "getter" functions to get them. You'd then have "setter" functions to pass back to the game engine.

    For instance, you'd first figure out what the Ammo level is for the side your interested in by calling ammo_level(side), a "getter" function. As a parameter you provide it the side you're interested to learn about its current ammo level, and as a return value you get the said ammo level.

    Then you then want to set a new value for the side's ammo level, you do it calling the set_ammo_level(side, value) function, a "setter", as youd guess. There you provide the side you want to change and the new ammo value to take place.

    Here's the current set of functions, then: (list updated since I wrote this post)

    quote:

    ORIGINAL: berto


    LUA EE FUNCTIONS

    -------------------------------------------------------------------------------

    on_air_attack (x, y, pid, name, side, nation, points, strength)
    on_next_phase (turn, side)
    on_next_turn (turn)
    on_objective_capture (x, y, value, side)
    on_startup ()
    on_unit_kill (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
    on_unit_reduce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader, loss)
    on_unit_reinforce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
    on_unit_release (trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
    on_unit_remove (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)

    adaptive_ai (side, nation, index)
    advantage ()
    aggressiveness (side)
    ai (side)
    ai_index (parm)
    ai_parameter (index)
    air_support (side)
    ammo_level (side)
    arrived (id)
    arty_ammo_level (side)
    average_morale (side)
    counter_airlevel (trackid)
    counter_assault (trackid)
    counter_defend (trackid)
    counter_flags (trackid)
    counter_hq (trackid)
    counter_isairborne (trackid)
    counter_ishq (trackid)
    counter_isleader (trackid)
    counter_leader (trackid)
    counter_morale (trackid)
    counter_name (trackid)
    counter_nation (trackid)
    counter_oid (trackid)
    counter_orgname (trackid)
    counter_pid (trackid)
    counter_points (trackid)
    counter_side (trackid)
    counter_strength (trackid)
    counter_type (trackid)
    counter_x (trackid)
    counter_y (trackid)
    current_side ()
    current_turn ()
    current_visibility ()
    debug (text)
    event_points (side)
    fow (side)
    has_flag (flags, flag)
    hexcoor (x, y)
    inc_adaptive_ai (side, nation, index, increment)
    inc_advantage (increment)
    inc_aggressiveness (side, increment)
    inc_air_support (side, increment)
    inc_ammo_level (side, increment)
    inc_arty_ammo_level (side, increment)
    inc_event_points (side, increment)
    inc_luav (index, value)
    inc_morale_shift (nation, increment)
    inc_reinforcement_prob (id, increment)
    inc_release_prob (id, increment)
    inc_smoke_ammo (side, increment)
    inc_star_shells (side, increment)
    isai (side)
    isdisrupted (trackid)
    isfixed (trackid)
    isfow (side)
    isisolated (trackid)
    islowonammo (trackid)
    isnight ()
    losses (side)
    loss_points (side)
    luav (index)
    map_center (x, y)
    map_height ()
    map_side (x, y)
    map_slice (x, y)
    map_trackid (x, y, number)
    map_trackid_count (x, y)
    map_up ()
    map_width ()

    map_up_half (x, y)
    map_low_half (x, y)
    map_left_half (x, y)
    map_right_half (x, y)
    map_up_left_quadrant (x, y)
    map_up_right_quadrant (x, y)
    map_low_right_quadrant (x, y)
    map_low_left_quadrant (x, y)
    map_nw_quadrant (x, y)
    map_ne_quadrant (x, y)
    map_se_quadrant (x, y)
    map_sw_quadrant (x, y)
    map_north_half (x, y)
    map_south_half (x, y)
    map_east_half (x, y)
    map_west_half (x, y)
    map_above (row, side)
    map_below (row, side)
    map_left_of (col, side)
    map_right_of (col, side)

    major_defeat ()
    major_victory ()
    max_ai_index ()
    max_luav_index ()
    message (title, string)
    minor_defeat ()
    minor_victory ()
    morale_shift (nation)
    next_turn ()
    night (turn)
    note (title, string)
    objective_owner (x, y)
    objective_points ()
    objective_value (x, y)
    other_side (side)
    previous_turn ()
    random (x)
    reinforcement_flags (id)
    reinforcement_hexcoor (id)
    reinforcement_prob (id)
    reinforcement_scatter (id)
    reinforcement_turn (id)
    reinforcement_x (id)
    reinforcement_y (id)
    release_prob (id)
    release_turn (id)
    released (id)
    set_adaptive_ai (side, nation, index, value)
    set_advantage (value)
    set_aggressiveness (side, value)
    set_air_support (side, value)
    set_ammo_level (side, value)
    set_arty_ammo_level (side, value)
    set_event_points (side, value)
    set_luav (index, value)
    set_major_defeat (value)
    set_major_victory (value)
    set_minor_defeat (value)
    set_minor_victory (value)
    set_morale_shift (nation, value)
    set_objective (x, y, value, side)
    set_objective_owner (x, y, side)
    set_objective_value (x, y, value)
    set_reinforcement (id, x, y, turn, prob, flags, scatter)
    set_reinforcement_flags (id, flags)
    set_reinforcement_hexcoor (id, hexcoor)
    set_reinforcement_prob (id, prob)
    set_reinforcement_scatter (id, scatter)
    set_reinforcement_turn (id, turn)
    set_reinforcement_x (id, x)
    set_reinforcement_y (id, y)
    set_release (id, turn, prob)
    set_release_prob (id, prob)
    set_release_turn (id, turn)
    set_smoke_ammo (side, value)
    set_star_shells (side, value)
    set_victory (majordefeat, minordefeat, minorvictory, majorvictory)
    smoke_ammo (side)
    star_shells (side)
    strength (side)
    total_points ()
    total_strength (side)
    x (hexcoor)
    y (hexcoor)

    -------------------------------------------------------------------------------


    < Message edited by Crossroads -- 7/18/2017 3:33:27 PM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 3
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 11:55:26 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    quote:

    ORIGINAL: Crossroads

    Here's the current function set, then:

    quote:

    ORIGINAL: berto


    LUA EE FUNCTIONS

    ...





    Quite a few of them, already! So let us put some of them into use.


    quote:

    ORIGINAL: Crossroads

    At this stage, I've already got an initial list of ideas I want to try out. Here they are, in no particular order:

  • I'd like to give both sides a briefing in the beginning as what their key tasks are.
  • Later perhaps, I'd like to give the players feedback as how they are doing per achieving those tasks.



  • on_next_phase (turn, side)

    Let us start by giving both players a specific briefing in the beginning of the game. For this, we'll use the on_next_phase (turn, side) function, as we want to give each player a briefing on their first turn Side A and Side B phase.

    First, I create the lua file for my scenario. The name needs to match the scenario file name, which is "E01_Sirte1985_H2H.scn" , so the lua file will be called "E01_Sirte1985_H2H.lua".

    I start with an empty file, and place the on_next_phase() function template there. Now the game will have an event trigger it will call everytime a new phase begins in that particular scenario.

    The empty template won't do me much, so I'll put the code in to use the parameters I receive upon call. So first I check if it is turn 1, and if it is, I provide a message dialog for each side separately.

    The message text is quite long, so here it is as a whole (with '\n' markers for a newline to appear within the message dialog):

    quote:

    "Commander, the Sirte operation is on! \n \n Your first task is to secure the SAM site, west of Sirte, with the SAS teams already there. Once the SAM battery is out of play, the Air assault can proceed immediately. Otherwise, they would need to approach in a more cautious manner, which takes time that we simply do not have. \n \n Good luck, Commander!"


    And here is how it plays out. I put the new lua file to the \scenarios folder, fire up the game, and what do you know:




    Attachment (1)

    < Message edited by Crossroads -- 6/30/2017 10:17:19 AM >


    _____________________________


    (in reply to Crossroads)
    Post #: 4
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 12:16:53 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline

    quote:

    ORIGINAL: Crossroads

    And here is how it plays out. I put the new lua file to the \scenarios folder, fire up the game, and what do you know:



    So let us recap what we did so far:

  • I created a new, empty CS Event Engine file called "E01_Sirte1985_H2H.lua" , where the file name body matches that of the scenario file itself.
  • I put the first trigger event there: function on_next_phase (turn, side). Now, the game will call this function everytime a next phase starts, passing me two parameters to use: the current turn, and current side.
  • I then added the content to this trigger event, the stuff in the red square in the lua code. First I checked if it is turn one, and if it is, if it is Side A ("a", in lua code). If it is, I pop up a message for the Side A player (UK), if not it must be turn one but Side B (Libya), so he gets a briefing of its own. I will not touch the Libyan side for now, more of them later.

    So far so good. We have the player briefing. So what is the conditional Air assault the Side A briefing talks about?

    If you're familiar with the current Sirte 1. Prelude scenario, there's no events of course. In this new version, as you can see above, I added an SAS team already on ground, behind a ridge to a new Libyan objective, hosting a SAM Radar, Battery, and an understrength guarding unit.

    Obviously, the idea would be that the SAS team captures that objective. But first, let us look at other changes to the scenario. The Air Assault troops are now set to arrive in turn 5 as reinforcements. There's other reinforcements there, too. See:





    Attachment (1)

    _____________________________


    (in reply to Crossroads)
  • Post #: 5
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 12:41:31 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    quote:

    ORIGINAL: Crossroads

    Obviously, the idea would be that the SAS team captures that objective. But first, let us look at other changes to the scenario. The Air Assault troops are now set to arrive in turn 5 as reinforcements. There's other reinforcements there, too. See:


    on_objective_capture (x, y, value, side)

    Note the new value in the Schedule Dialog: the reinforcement ID. Yes, this can be used in the Event Engine to refer to a particular reinfocement, and to play around it.

    But where do we play with it? It is time to introduce another trigger function: on_objective_capture (x, y, value, side)

    Similarly, I add this trigger function template to my new scenario lua script, and provide it with some meat as well. What I want to happen, is that upon capturing the SAM site objective, the Brits will have their Air Assault reinforcements released earlier. If they miss out, at worse they arrive at turn 5 anyway, but important time - five turns out of eighteen - have been lost.

    So here's the code, and here's how it played out upon capturing the objective. Note: this function is called by the game engine every time an objective is captured, so there's work remaining to figure out if it was the SAM site that indeed was captured.

    Also, this time I the trigger function on_objective_capture() does not provide me with much of the information I need, so I need to figure them out by the "get" action functions:

  • First I figure out if it was the Brits who captured an objective, checking the side parameter passed to me by the function.
  • Then, I use the objective "x" and "y" parameters passed to me as well by the function to figure if it is the SAM site (at 26,4).
  • So far so good! Then, I check if the turn is four, or less, and if it is,
  • I set each of the Air Assault Regt reinforcements to take place next turn. set_reinforcement_turn() requires two input parameters, first the reinforcement ID (and this I need to know, see the Schedule Dialog above, the Air Assault reinforcement IDs are 1 through 5), and the turn the reinforcements are set to arrive.

    As you see on_objective_capture () does not pass me the current turn, so I had to call the current_turn() action to learn about it. I stored the turn information to a local variable, and create another one for next turn # by adding one to it.

    A bit more work this time, but here we are! By the way, I use a programmer's text editor that recognizes the lua syntax and color codes it for an easier read. Recommended, get one such as Notepad++ or JEdit, it will ease things up.

    As for the Sirte 1. Prelude, as I managed to capture the SAM site on turn one, the air assault will now begin on turn two. Yay!



    Attachment (1)

    < Message edited by Crossroads -- 6/30/2017 10:19:49 AM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 6
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 12:46:08 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline

    quote:

    ORIGINAL: Crossroads

    A bit more work this time, but here we are! By the way, I use a programmer's text editor that recognizes the lua syntax and color codes it for an easier read. Recommended, get one such as Notepad++ or JEdit, it will ease things up.



    And I stop here for now.

    As you see from the above sample, having reinforcements arrive as a CS Event Engine action required already quite some coding.

    We will provide lots of samples in the coming CSME 2.0, in form of documentation, and in form of being able to use existing scenario lua files as a basis, instead of starting from a clean slate.

    _____________________________


    (in reply to Crossroads)
    Post #: 7
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 1:15:58 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    quote:

    ORIGINAL: Crossroads

    And I stop here for now.



    on_unit_reinforce (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)

    Nah, let us introduce one more trigger funtion: on_unit_reinforce (x, y, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader). Quite a lot of parameters I get that one, so it will be an easier function to implement.

    This function is called everytime a reinforcement is called to arrive from Schedule Dialog. If needed, each arrival could then trigger something to happen. I'll do two things here.

    First, I'll have Air Assault HQ report the player his next task
    Second, I'll have the Lynx Gunship leader report that they've only got four ATGM missile loads (ie. I've provided no Lynx HQ where they could get a reload from). Vital information!

    To achieve this,

  • I place the trigger function template to my lua file
  • Just to do this in various ways, I first check if the reinforcement is the Gazelle flight who transports the Airborne Bq HQ (Platoon ID P096524 but omit the P and the leading zero), or if not, if it is the reinforcement set to arrive in hex (66,1), the Lynx leader.

    Each case gets its own message to display.

    And here we go, from previous screen capture I click the UK turn to finish, click over the Libyan turn, and click the UK turn #2 to begin:

    [1] There's the command report informing there's reinforcements (aha!)
    [2] Schedule Dialog tells me what to expect - see Air assault reinforcements 1 through 5 are now all arriving on turn 2
    [3] I click them to arrive one by one
    [4] HQ upon its arrival informs me of my next task as the UK player

    From Airborne HQ
    quote:

    "Commander, Air assault is ON! FYI: once we secure one of the Sirte ports, the first elements of the Landing Force will arrive to aid us! Godspeed!"


    [5] Lynx flight informs me they can't reload once they're out of ATGMs.

    From Lynx Leader:
    quote:

    "Lynx Alpha Leader to Sirte CP: Alpha One and Alpha Two are now entering the Sirte airspace. We only have ATGM loads for four missions per flight, use them wisely! Awaiting orders..."


    Neat, eh





    Attachment (1)

    < Message edited by Crossroads -- 6/30/2017 10:20:39 AM >


    _____________________________


    (in reply to Crossroads)
  • Post #: 8
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 1:17:11 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    OK, now I stop.

    Thoughts, comments, what else you'd like to see?

    _____________________________


    (in reply to Crossroads)
    Post #: 9
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 1:29:38 PM   
    dox44

     

    Posts: 668
    Joined: 5/7/2000
    From: the woodlands, texas
    Status: offline
    ok so far so good.

    opens up all kinds of stuff. never tried using lua and didn't know how anyway.

    i play another matrix game (Command) that scenario designers can use lua. really makes for some interesting
    situations.

    thanks for taking time to explain this.

    casebier

    (in reply to Crossroads)
    Post #: 10
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 1:43:51 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    quote:

    ORIGINAL: casebier

    ok so far so good.

    opens up all kinds of stuff. never tried using lua and didn't know how anyway.

    i play another matrix game (Command) that scenario designers can use lua. really makes for some interesting
    situations.

    thanks for taking time to explain this.

    casebier



    Sure thing casebier!

    There are so many possibilities. For the Air Assault reinforcement thing, I could actually have them originally arrive from the far eastern map edge, in order to depict them arriving while the SAM threat remains. So that's how I'd set it up in the Scenario Editor.

    But upon SAM site being taken out, in addition to have them arrive earlier, I could change their arrival co-ordinates to be directly above the SAS troops, to depict now they could have flown a more direct route into Sirte

    By the way, I had actually implemented one more trigger function.

    Here's the list of ideas I had in the opening post, with the ones not implemented so far showing up:

    quote:

    ORIGINAL: Crossroads

    At this stage, I've already got an initial list of ideas I want to try out. Here they are, in no particular order:

  • Later perhaps, I'd like to give the players feedback as how they are doing per achieving those tasks.
  • The Brits paratroopers may be used to being surrounded, too, but I'd like to have their supply situation worsen throughout the game play, for one. Perhaps some other difficulties as well?
  • Losses might have an effect as well. Lose your commander, and everyone's Morale goes down?


  • on_next_turn (turn)

    So, I had in fact provided the UK worsening supply situation logic in a lua file.

    Just to do it differently I put it to on_next_turn() trigger function, it could have been in the on_next_phase() one as well.

    Here's the code, to see it working check the above screenshot again: It is turn #2 and the UK supply levels are down to 78, while Libyan ones remain at 80




    Attachment (1)

    < Message edited by Crossroads -- 6/30/2017 10:22:15 AM >


    _____________________________


    (in reply to dox44)
    Post #: 11
    RE: Dev Diary #09: CS Event Engine - 6/29/2017 2:24:51 PM   
    berto


    Posts: 20708
    Joined: 3/13/2002
    From: metro Chicago, Illinois, USA
    Status: offline

    This is all a work-in-progress, still in the beta stage. In the message dialogs, you might see where at the end of some lines, in the display the line-ending word is clipped. A glitch. Will be fixed.

    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com

    (in reply to Crossroads)
    Post #: 12
    RE: Dev Diary #09: CS Event Engine - 6/30/2017 10:37:28 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Let us finish the to-do list from the opening post, two things remaining there, first the feedback event, then the unit loss event:

    quote:

    ORIGINAL: Crossroads

    At this stage, I've already got an initial list of ideas I want to try out. Here they are, in no particular order:

  • I'd like to give both sides a briefing in the beginning as what their key tasks are.
  • Later perhaps, I'd like to give the players feedback as how they are doing per achieving those tasks.
  • I want events too, of course. So how about a few events that can trigger the arrival of reinforcements. Given how things go, they might come sooner, or later. Or not at all.
  • For instance, I'll add a Libyan SAM site to the coast, and have some British SAS troops there to take it out. Only once its out can the Air assault begin.
  • The Brits paratroopers may be used to being surrounded, too, but I'd like to have their supply situation worsen throughout the game play, for one. Perhaps some other difficulties as well?
  • Losses might have an effect as well. Lose your commander, and everyone's Morale goes down?



  • Let us do the feedback event first, for the UK player.

    Recall in the opening phase he is informed he needs to clear the SAM site quickly, in order for the Air Assault to arrive (earlier). Let us check if he's done so by turn 3, and if not, let us give him a notification. For that, there's the objective_owner(x, y) function to check the side that owns the given objective ("a", or "b").

    This time, I used note() instead of message(), to have a smaller dialog for this one-liner of a hairblower treatment for the Brit player

    Note the UK supply situation has gone down to 76 by turn three. By turn 10 it will be 60. Things are getting tougher and tougher for them, if they waste too much time on getting their task done!!

    PS: if for real I'd probably need to add some additional checks, like what if the UK player indeed captured the SAM site on turn #1, then evacuated it for the Libyan player to recapture it. For the sample I am doing here, I am not going to worry about that level of detail for now.

    ^^ Edit: What the heck, added a check that the (first element of) Air assault has not arrived. That should fix the issue above




    Attachment (1)

    < Message edited by Crossroads -- 6/30/2017 11:48:54 AM >


    _____________________________


    (in reply to Crossroads)
    Post #: 13
    RE: Dev Diary #09: CS Event Engine - 6/30/2017 12:41:37 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline

    quote:

    ORIGINAL: Crossroads

    At this stage, I've already got an initial list of ideas I want to try out. Here they are, in no particular order:

  • I'd like to give both sides a briefing in the beginning as what their key tasks are.
  • Later perhaps, I'd like to give the players feedback as how they are doing per achieving those tasks.
  • I want events too, of course. So how about a few events that can trigger the arrival of reinforcements. Given how things go, they might come sooner, or later. Or not at all.
  • For instance, I'll add a Libyan SAM site to the coast, and have some British SAS troops there to take it out. Only once its out can the Air assault begin.
  • The Brits paratroopers may be used to being surrounded, too, but I'd like to have their supply situation worsen throughout the game play, for one. Perhaps some other difficulties as well?
  • Losses might have an effect as well. Lose your commander, and everyone's Morale goes down?



  • I still need to finish the final to-do item of an event triggered by a unit loss. There's a trigger function already for that too, called on_unit_kill (), which is called by the game engine every time a unit is reduced to 0 strength and removed from map as a total kill.

    There's a new version of it coming that I need though, so that will have to wait for the next week.

    Meanwhile, any questions or comments let me know!

    < Message edited by Crossroads -- 6/30/2017 12:42:48 PM >


    _____________________________


    (in reply to Crossroads)
    Post #: 14
    RE: Dev Diary #09: CS Event Engine - 7/1/2017 1:10:47 AM   
    budd


    Posts: 2972
    Joined: 7/4/2009
    From: Tacoma
    Status: offline

    quote:

    ORIGINAL: Crossroads


    quote:

    ORIGINAL: Crossroads

    At this stage, I've already got an initial list of ideas I want to try out. Here they are, in no particular order:

  • I'd like to give both sides a briefing in the beginning as what their key tasks are.
  • Later perhaps, I'd like to give the players feedback as how they are doing per achieving those tasks.
  • I want events too, of course. So how about a few events that can trigger the arrival of reinforcements. Given how things go, they might come sooner, or later. Or not at all.
  • For instance, I'll add a Libyan SAM site to the coast, and have some British SAS troops there to take it out. Only once its out can the Air assault begin.
  • The Brits paratroopers may be used to being surrounded, too, but I'd like to have their supply situation worsen throughout the game play, for one. Perhaps some other difficulties as well?
  • Losses might have an effect as well. Lose your commander, and everyone's Morale goes down?



  • I still need to finish the final to-do item of an event triggered by a unit loss. There's a trigger function already for that too, called on_unit_kill (), which is called by the game engine every time a unit is reduced to 0 strength and removed from map as a total kill.

    There's a new version of it coming that I need though, so that will have to wait for the next week.

    Meanwhile, any questions or comments let me know!

    quote:

    I want events too, of course. So how about a few events that can trigger the arrival of reinforcements. Given how things go, they might come sooner, or later. Or not at all.


    Sounds exciting. The highlighted above should go along way to balance things and keep scenarios/campaigns interesting, especially in PBEM.

    _____________________________

    Enjoy when you can, and endure when you must. ~Johann Wolfgang von Goethe

    "Be Yourself; Everyone else is already taken" ~Oscar Wilde

    *I'm in the Wargamer middle ground*
    I don't buy all the wargames I want, I just buy more than I need.

    (in reply to Crossroads)
    Post #: 15
    RE: Dev Diary #09: CS Event Engine - 7/1/2017 7:03:28 AM   
    76mm


    Posts: 4688
    Joined: 5/2/2004
    From: Washington, DC
    Status: offline
    This sounds awesome. And while the coding is important, please don't neglect the documentation, so that more average schmo players rather than coding gurus can figure out how to use it. This thread is a helpful start, but just sayin'...

    (in reply to budd)
    Post #: 16
    RE: Dev Diary #09: CS Event Engine - 7/1/2017 10:53:10 AM   
    berto


    Posts: 20708
    Joined: 3/13/2002
    From: metro Chicago, Illinois, USA
    Status: offline

    No worry. This will all be more than adequately documented, with copious examples and comments.

    _____________________________

    Campaign Series Legion https://cslegion.com/
    Campaign Series Lead Coder https://www.matrixgames.com/forums/tt.asp?forumid=1515
    Panzer Campaigns, Panzer Battles, Civil War Battles Lead Coder https://wargameds.com

    (in reply to 76mm)
    Post #: 17
    RE: Dev Diary #09: CS Event Engine - 7/6/2017 4:07:46 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    quote:

    ORIGINAL: Crossroads


    I still need to finish the final to-do item of an event triggered by a unit loss. There's a trigger function already for that too, called on_unit_kill (), which is called by the game engine every time a unit is reduced to 0 strength and removed from map as a total kill.

    There's a new version of it coming that I need though, so that will have to wait for the next week.



    ... and here it is!


    quote:

    ORIGINAL: berto


    In today's release, I have added trackid as a parameter to these on_unit_*() functions:

    on_unit_kill (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
    on_unit_reinforce (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
    on_unit_release (trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)
    on_unit_remove (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)

    If you have used any of those functions in your <scenario>.lua files, you will need to edit in those trackid references.

    Sooner or later, I will have to mass edit the scenario placeholder .lua files to do the same (also to introduce the on_startup() function).


    on_unit_kill (x, y, trackid, pid, name, side, nation, oid, orgname, points, strength, HQ, Leader)

    Missing piece, trackid, or Tracking ID, was now added to these trigger functions. Now it's possible to figure out the exact unit, based on the individual Tracking ID each of them receives in scenario specific *.PRG file. Be it a Battalion sized or Corps sized battle, each unit is now uniquely tracked!!

    Let us put this to use. In this quite busy screenshot, see the new function, (1) should a unit get killed, I first put a message out (2) as which unit (Organizational name, Tracking ID, and Platoon ID) it was that got killed. Then, I check if it was the British Airborne HQ, in which case the Libyans get 50 Event Points (3) added to their tally.

    Yes, with Events, it is not possible to assign Victory points as well




    Attachment (1)

    < Message edited by Crossroads -- 7/8/2017 9:14:12 AM >


    _____________________________


    (in reply to Crossroads)
    Post #: 18
    RE: Dev Diary #09: CS Event Engine - 7/7/2017 2:24:00 AM   
    Deepstuff3725

     

    Posts: 157
    Joined: 3/1/2014
    From: Indianapolis, IN, USA
    Status: offline
    Really liking the "events" enhancements being worked on. i like to create scenarios, and i can envision how this can take scenario creation to a whole new level.
    Will it be fairly easy to edit the messages from HQ for a scenario? I think it would be cool to create a scenario and be able to edit the messages a player will receive depending on triggers and how the scenario unfolds. For example, in Eastern Front III, if the Germans are not doing well in a scenario then messages might say things like "we're falling behind in reaching our objectives. You don't want to disappoint the Furor."

    In the messages, could it be possible to list the player's name? For instance a player can type in the name they want to use for the scenario, say Major Gerhard Schneider. Then as the scenario is played, the player will see messages referring to him as "Major Schneider" in the scenario.



    (in reply to Crossroads)
    Post #: 19
    RE: Dev Diary #09: CS Event Engine - 7/8/2017 9:19:29 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    quote:

    ORIGINAL: Deepstuff123

    Really liking the "events" enhancements being worked on. i like to create scenarios, and i can envision how this can take scenario creation to a whole new level.
    Will it be fairly easy to edit the messages from HQ for a scenario? I think it would be cool to create a scenario and be able to edit the messages a player will receive depending on triggers and how the scenario unfolds. For example, in Eastern Front III, if the Germans are not doing well in a scenario then messages might say things like "we're falling behind in reaching our objectives. You don't want to disappoint the Furor."


    Hello Deepstuff, yes, it is very easy to add a storyboard to the game, with the relative success (or the lack of it) results in various feedback. For instance with the sample provided here the UK player is first instructed to clear the SAM site quickly in order for the Air Assault to commence (and congratulated when he does so), and in the beginning of turn 3 it is then checked if the said objective is taken. If not, he's told to step on it!

    Similarly, it is quite possible to track progress with the various functions available and then based on that to provide feedback - good or bad - to the player. I agree this adds to the immersion of the scenario being played quite nicely.

    quote:

    ORIGINAL: Deepstuff123
    In the messages, could it be possible to list the player's name? For instance a player can type in the name they want to use for the scenario, say Major Gerhard Schneider. Then as the scenario is played, the player will see messages referring to him as "Major Schneider" in the scenario.



    While there isn't anything exactly like that at the moment, it is quite possible to fire up the Organization Editor and input one's own name to the scenario ORG file before playing that scenario, to replace the commander name there.

    Also, as part of designing a scenario, the designer can put whatever the commander name in place as he prefers, and then use that name on the player feedback.


    < Message edited by Crossroads -- 7/8/2017 9:24:16 AM >


    _____________________________


    (in reply to Deepstuff3725)
    Post #: 20
    RE: Dev Diary #09: CS Event Engine - 7/17/2017 1:56:55 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    And here's the final detail for the original event wish list I posted at the Opening Post: loss of their Battalion HQ will have a negative effect on British morale. I mean why not, can't be much fun to duke it out at Sirte with all contact to Malta base gone, and everyone on their own!

    This calls for a random() function too: not only will be the British morale hit, but it will be randomly reduced by a value between one and three. Hard!

    Here's the sample:

  • A new function: inc_morale_shift() is used to increment / decrement the morale level depending the value given. We're decrementing, hence multiplying by -1 in the code.
  • Another new function: debug() can be used to pop up a message but only if the lua file specifies it is used in debug mode, like here.

    See the Brits with their morale down by 1 in the snippet there. Lucky guys, could have been worse.

    Looking at this, maybe the Libyans should receive a little boost for their morale, for their achievement, too. That would spiff up the battle just nicely!




    Attachment (1)

    _____________________________


    (in reply to Crossroads)
  • Post #: 21
    RE: Dev Diary #09: CS Event Engine - 7/17/2017 1:59:18 PM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline

    quote:

    ORIGINAL: berto

    The Campaign Series Lua Event Engine is now up to 164 functions, and continues to grow in expressiveness and capability.




    Always busy busy busy, our Berto! I updated the Post #3 with the current function inventary. Trigger functions first, on alphabetical order, other functions then.

    _____________________________


    (in reply to Crossroads)
    Post #: 22
    RE: Dev Diary #09: CS Event Engine - 7/18/2017 9:46:51 PM   
    Warhorse


    Posts: 5712
    Joined: 5/12/2000
    From: Birdsboro, PA, USA
    Status: offline
    This is gonna be awesome!!

    _____________________________

    Mike Amos

    Meine Ehre heißt Treue
    www.cslegion.com

    (in reply to Crossroads)
    Post #: 23
    RE: Dev Diary #09: CS Event Engine - 7/20/2017 2:13:59 PM   
    Jafele


    Posts: 737
    Joined: 4/20/2011
    From: Seville (Spain)
    Status: offline
    Interesting, quite interesting.

    _____________________________

    Las batallas contra las mujeres son las únicas que se ganan huyendo.

    NAPOLEÓN BONAPARTE


    Cuando el necio oye la verdad se carcajea, porque si no lo hiciera la verdad no sería la verdad.

    LAO TSE

    (in reply to Warhorse)
    Post #: 24
    RE: Dev Diary #09: CS Event Engine - 1/27/2018 7:00:58 PM   
    mheard

     

    Posts: 25
    Joined: 9/4/2009
    Status: offline
    Is the Event Engine contained within Middle East Version 2.00? If not, will it arrive as V2.01 or?

    Many thanks...

    (in reply to Crossroads)
    Post #: 25
    RE: Dev Diary #09: CS Event Engine - 1/27/2018 7:12:49 PM   
    Oberst_Klink

     

    Posts: 4778
    Joined: 2/10/2008
    From: Germany
    Status: offline
    quote:

    ORIGINAL: mheard

    Is the Event Engine contained within Middle East Version 2.00? If not, will it arrive as V2.01 or?

    Many thanks...

    Martin

    check your \Campaign Series Middle East\manual folder and there should be the CSEEHowTo.PDF

    That explain how to modify/create the .LUA files for those events.

    Klink, Oberst

    < Message edited by Oberst_Klink -- 1/27/2018 7:13:53 PM >


    _____________________________

    My Blog & on Twitter.
    Visit CS Legion on Twitter & Facebook for updates.

    (in reply to mheard)
    Post #: 26
    RE: Dev Diary #09: CS Event Engine - 1/28/2018 6:57:13 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline
    Also, look for scenarios with [CS Event Engine Enabled] on their Scenario descriptions, then look at their *.lua files for samples if you wish.

    Those scenarios would be, off my head:

  • all five Bootcamp scenarios
  • all five Teaching set scenarios
  • all Crisis in Sirte scenarios
  • Long Road Home
  • Jerusalem48_csee as per CSEE How-To document Berto wrote, detailing what goes there.

    _____________________________


    (in reply to Oberst_Klink)
  • Post #: 27
    RE: Dev Diary #09: CS Event Engine - 2/9/2018 3:41:35 PM   
    athineos


    Posts: 146
    Joined: 1/6/2017
    From: Kansas City, USA
    Status: offline
    Thanks for the info. I would like dedicate a little time in the future to learn more about .LUA files as the only programming language I was ever exposed to was COBOL back in college. I have played very little of ME so far. Most of my gaming time goes to JTCS.

    (in reply to Crossroads)
    Post #: 28
    RE: Dev Diary #09: CS Event Engine - 2/11/2018 8:50:49 AM   
    Crossroads


    Posts: 17372
    Joined: 7/5/2009
    Status: offline

    quote:

    ORIGINAL: athineos

    Thanks for the info. I would like dedicate a little time in the future to learn more about .LUA files as the only programming language I was ever exposed to was COBOL back in college. I have played very little of ME so far. Most of my gaming time goes to JTCS.


    Go ahead, give it a try, start simple, perhaps copy one snippet from a scenario file that already has Events in place, and try it out. I know COBOL too, a special favourite of mine (with emphasis on word special, it is a very unique language). Anyone familiar with Basic, for instance, or Java, or what not in fact, should be able to get into these.

    Berto did a great job in abstracting most of the stuff, so typically you'd just need to understand which Event Function you want to be called, and what parameter it takes. Good luck!

    _____________________________


    (in reply to athineos)
    Post #: 29
    RE: Dev Diary #09: CS Event Engine - 2/11/2018 3:00:53 PM   
    athineos


    Posts: 146
    Joined: 1/6/2017
    From: Kansas City, USA
    Status: offline

    quote:

    ORIGINAL: Crossroads


    quote:

    ORIGINAL: athineos

    Thanks for the info. I would like dedicate a little time in the future to learn more about .LUA files as the only programming language I was ever exposed to was COBOL back in college. I have played very little of ME so far. Most of my gaming time goes to JTCS.


    Go ahead, give it a try, start simple, perhaps copy one snippet from a scenario file that already has Events in place, and try it out. I know COBOL too, a special favourite of mine (with emphasis on word special, it is a very unique language). Anyone familiar with Basic, for instance, or Java, or what not in fact, should be able to get into these.

    Berto did a great job in abstracting most of the stuff, so typically you'd just need to understand which Event Function you want to be called, and what parameter it takes. Good luck!



    You have recommended notepad++ as a text editor. Where is the best place to get that? Thanks

    (in reply to Crossroads)
    Post #: 30
    Page:   [1] 2   next >   >>
    All Forums >> [New Releases from Matrix Games] >> Campaign Series: Middle East 1948-1985 >> Dev Diary #09: CS Event Engine Page: [1] 2   next >   >>
    Jump to:





    New Messages No New Messages
    Hot Topic w/ New Messages Hot Topic w/o New Messages
    Locked w/ New Messages Locked w/o New Messages
     Post New Thread
     Reply to Message
     Post New Poll
     Submit Vote
     Delete My Own Post
     Delete My Own Thread
     Rate Posts


    Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

    1.344