Jump to content
celludriel

Idea: CTI template mission

Recommended Posts

This is an idea that has been rummaging through my mind for the past days now.  I've been playing zbug's Liberation mission a lot and I do enjoy it, but on the other hand I also feel it's a tad to easy.  So I wanted to make some changes but a lot of the code is hardcoded to work with eachother which makes it hard to introduce new systems.  So I started thinking what is CTI ?  CTI is a mode where you enter a sector if you have the upper hand you win the sector if you win them all you win the game.  Sounds straight forward enough.  All the other stuff like a custom arsenal, ai counterattacks, ai spawning in the sector ... it's fluff ... it's mechanics to make the mode more interesting but in fact optional.  What if there was a mission that you could in an easy straight forward fashion expand with modules but at it's core is just capture the island ?

 

This might give some technical difficulties but maybe worth to explore.  I was thinking of following mission structure.

- core
  - server
  - client
- modules
  - revive_module
    - server
    - client
  - ai_spawn_module
    - server
    - client
mission.sqm
description.ext

core would contain everything needed to create a core cti game, the modules dir would get modules to expand on that gameplay in this example a module to handle revive and a module to handle how ai spawns in the sectors.  Ideally it would be just drag and drop the module in the modules folder and it works but considering the limitations of sqf I believe sometimes other files will have to be impacted.

 

Now to help modules to jack into the core, I was thinking of using an event like approach, these events would be triggered by the core mechanics and can be expanded in the modules.  Following events I believe are relevant

 

- GAME_INIT : The map has been booted and everything of the core has been loaded in now module scripts can run

- PLAYER_SPAWN : A player has spawned/respawned

- SECTOR_ACTIVATED : A sector is activated due to proximity of players

- SECTOR_ENTERED : A sector is entered by a player

- SECTOR_CONTROL_CHANGES : a sector changes hands

- SECTOR_DEACTIVATED : A sector is no longer active because no players are in proximity for at least x minutes

- GAME_END : All sectors are taken over and the game ends

 

each event would get a list of scripts that need to be executed when the event triggers.  These scripts would be stored in a global array fe: player_spawn_scripts, in a module on init you could do something like player_spawn_scripts = player_spawn_scripts + "modules\my_module\server\player_spawn_actions.sqf".  So the module extended the array and when the core game triggers the event this script would be executed on that event.

 

In this same fashion I was thinking of introducing a hearthbeat mechanic with a few heartbeast: each second, each five seconds, each minute, each half hour and each hour.  These are basicly scripts in the core that are sleeping for the amount of time and then executing an array of scripts that can be extended in modules.

 

I believe with just these mechanics you can create an easily extendable CTI mission without having to hardcode to many systems in it giving mission designers more flexibility on how they want to play CTI.

 

I do not have a lot of time atm to start on this idea but  what do you guys think is this worth it to even start it up ?  Or would I be waisting my time creating it ?

 

Made a trello board as an incentive to get me started :)

 

TRELLO

https://trello.com/b/ALCTNnYN/modular-cti-template-mission

 

GITHUB develop branch

https://github.com/Celludriel/CTI_template_mission/tree/develop

Share this post


Link to post
Share on other sites

I spent ~12 months working on a gamemode which was never released and will never be released, for a number of reasons.

 

Learned a lot, and I wouldn't consider it wasted effort

 

Basically, if you like what you are doing and are learning stuff you want to learn, then do it regardless of expected results.

Share this post


Link to post
Share on other sites

Well one of my first challenges would be to define what is a sector ?

 

In zbug's mission a sector is custom made by use of markers, it works, works great even but is this the best way to handle it ?  BIS has the sector module but what are the pro's and con's ?  How I would define a sector conceptually would be the following:

 

- A sector is a circle that can be owned by a particular side

- A sector can activate or deactivate

- A sector can be entered or exited

- A sector can be contested

- A sector can change side

 

This could result in the following user stories:

 

- As a mission designer I want to be able to place indicators that spawn a circle sized sector of a particular radius and/or type owned by a given side

- As a player I want a sector to get in activated state when I come within a set distance of the epicenter of a spawned sector

- As a player I want a sector to get in deactivated state when I"m further within a set distance of the epicenter of a spawned sector

- As a player I want to enter a sector when I come within a set distance, but closer then the activation distance, of the epicenter of a spawned sector.  If there are entities of the other side the sector has to become contested

- As a player I want a sector to change ownership if a particular side is the only side left in a sector

 

looking from a distance at this it doesn't seem to be a lot of work, if you know what you are doing.  However the question remains do I write it myself or use part of the module system of BIS ... dilemma

Share this post


Link to post
Share on other sites

I started early development, you can track my progress on github.  The repository is in the OP

Share this post


Link to post
Share on other sites

Hey, I will try follow your work here, maybe I can start understand better Bohemia scripting/logic.

 

So, while looking on your files on the github, I saw a small mistake in syntax:

file:CTI_template_mission/core/server/sector/sectorActivationHandler.sqf

line 10: if(_count > 0 && _setctorState == 'neutral') then {

It is about  _setctorState ... one extra t

 

Hope it will help,.

  • Like 1

Share this post


Link to post
Share on other sites

Hey, I will try follow your work here, maybe I can start understand better Bohemia scripting/logic.

 

So, while looking on your files on the github, I saw a small mistake in syntax:

file:CTI_template_mission/core/server/sector/sectorActivationHandler.sqf

line 10: if(_count > 0 && _setctorState == 'neutral') then {

It is about  _setctorState ... one extra t

 

Hope it will help,.

 

Thanks I'm typing this at a location without arma so it's more conceptual now until I get home.  Unfourtunatly I do not have a SQF compiler that would eliminate these kind of mistakes :(

Share this post


Link to post
Share on other sites

Well work is progressing hit the regular snags about missing ; and unknown variables after first server startups, once I cleaned those up I arrived at the more serious stuff.

 

So my approach is to put empty markers on the map and turn them in sectors.  This by changing the type from empty to some kind of icon and coloring it red at server init.  I had hoped to then put variables on the markers to keep state of that marker.  Well markers aren't really objects so scratch that idea.  Then I wanted to turn those markers in Locations, but that didn't seem to practical either.  So on to the next best thing for a pragmatic programmer and create a regular object and make it invisible and put all variables on that.  Not that clean but hey it works.

 

I made the object with createVehicle, I wanted to try the new createObject but I don't know it seems that is still in it's infancy and you need to know the path to the full 3D object to spawn it, instead of the object tag.  For now I went with createVehicle.

 

Any suggestions or remarks with the approach I'm taking ?  I'll be happy to listen

Share this post


Link to post
Share on other sites

I finished up the code for activating and deactivating a sector.  It works , no more compile error.  However I only tested with one sector.  Later today I'll have to test with multiple sectors at the same time and some other edgecases.  It's starting to get some more form hopefully by the end of next week I have a working prototype template to share.

Share this post


Link to post
Share on other sites

Had quite some work done yesterday, I have a CTI mechanic going and it's kinda playable should you try it now.  Well until my next commit that is.  So this is what I have sofar

 

- It only works on a dedicated server, letting it work on a local server is a to big a can of worms to do right from the get go

- The mission designer has to place empty markers with fe following name : sec_town_my_town, when the mission starts a CTI sector will spawn there in status neutral

- When you come within 500m of the sector it will activate and a yellow circle appears showing the range of the sector

- When you come within the range of the sector the sector will go contested if there is an OPFOR there, or change colour to BLUFOR if no OPFOR are present (anymore)

 

- When the sector is contested and you leave the zone it will turn active again

- When the sector is active and you go past 500m it will get the status deactivation, after a minute the sector will revert back to neutral

 

This is the basic idea of a CTI currently working.  I didn't finish saving and loading yet because I'm probably gonna rethink that code to something more fitting.  This little project is coming along faster then expected although the hard work probably still has to come when I start integrating the modular system I have in mind.

Share this post


Link to post
Share on other sites

Hey Celludriel lovely idea!!!

Our clan plays often cti missions and this kind of modular CTI is a godsend for mission makers like me.

I hope that you will continue the development of this project , meanwhile I follow this thread and github branch!

  • Like 1

Share this post


Link to post
Share on other sites

Hey Celludriel lovely idea!!!

Our clan plays often cti missions and this kind of modular CTI is a godsend for mission makers like me.

I hope that you will continue the development of this project , meanwhile I follow this thread and github branch!

 

Thanks I'll be working on it for a while longer, I'll make some modules myself but don't expect me to write an Alive or god knows what module , I just don't have the time for that.

 

I got saving and loading working now but the mission ending is bugged for some reason ???

18:50:49 Error in expression <il {isnull _display};
ppeffectdestroy [
RscMissionEnd_colorCorrection,
RscMissio>
18:50:49   Error position: <RscMissionEnd_colorCorrection,
RscMissio>
18:50:49   Error Undefined variable in expression: rscmissionend_colorcorrection
18:50:49 File A3\ui_f\scripts\GUI\RscDisplayDebriefing.sqf, line 540
18:51:02 A nil object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'

While I'm just calling: ["end1", true, true] call BIS_fnc_endMission; it's one of BIS's functions.  Maybe I need to define "end1" somewhere to be investigated

 

For those curious this is how I approached the design of the mission

 

CTI_template_mission_design.PNG

Share this post


Link to post
Share on other sites

- Added a client side debug tool for spotting all units on the map

- Added a way to override core settings

- Added a way to decide yourself when a sector goes from contested to be taken over by the winning side

- Created the desired folder structure for the future

 

I would dare to say that I believe the template at it's core is feature complete there are a few more things I think I'll do like different types of sectors based on the name, that code should be relativly easy to do.  Next up is to get it tested by some other people then me and create a real mission from it.  I'm thinking something simple first.

 

- Militarize system

- Revive system

- MHQ system

 

just the basics to have a playable mission.  Remember this template is not really meant to be played , it's something CTI mission builders have to build onto !

Share this post


Link to post
Share on other sites

Made some more progress on the template:

 

  • Different types of sectors currently (base, town, fuel and towr)
  • Code for a mission designer to add his own custom sector types (not tested yet)
  • Introduced a way for mission designers to decide themselves when the mission ends (not tested yet)
  • Refactored some code and filenames fe: seperated constants in server, client and shared constants
  • Added a way to run custom pre server init scripts and post server init scripts

One of my next tasks will be running a stress test, I currently test with four sectors and it works, but I need to know how the system handles when I add 50 sectors or maybe 100.  There will be a hard limit I suppose considering the gameManager runs each second, there is only so much the system in one second can accomplish.  Now a sector instantly changes sides if all OPFOR are killed, with more sectors this time could extend.  I could write some performance tweaks like trying not to count nearestEntities to much by caching them.  But one programming rule sticks don't write performance tweaks in advance do them when you need them.

Share this post


Link to post
Share on other sites

Not to much coding done yesterday most of the work went in writing a first draft manual on how the mission works.  It needs a full chapter now on how to create a custom module.  But since I haven't developed one myself yet I'm not sure yet how to approach it cleanly.  Let me know what you guys think of the manual it's commited into the develop branch.

 

documentation: https://github.com/Celludriel/CTI_template_mission/tree/develop/documentation

Share this post


Link to post
Share on other sites

Well the stress test worked but didn't perform at all.  I added around 50 sectors and timed how long it took for the GameManager to do one loop over all sectors.  Considering a sector doesn't have a listener that can detect if entities are present, like in Zbug's mission I loop over all sectors and do quite a few checks to consider what state they should be in.  It took 14 seconds for one loop.  Naturally this is unacceptable a lot can happen in 14 seconds.  I'm really disappointed in how the SQF engine underperforms.  It could be my coding of course but all in all I'm not doing complex operations or loops in loops in loops.  In fact the gamemanager runs itself on one for each, other then that I call some arma functions that I believe have their own loops.

 

Regardless what may be I needed to find a solution.  Normally I would start looking at multi threading and divide the sector checks over ten threads or so.  However considering how the engine performs on a single thread I'm not sure how it would perform if I start spawning more with execVM.  There is another more pragmatic approach, not each sector needs to be checked, you could just check sectors that have actual entities present that could interact with their state.  I chose the latter for now, I calculated that one sector takes about 0,2 seconds.  Which is still a very long time, but I could put in a system where only X sectors at any given time can be active.  Zbug did this and probably for around the same reason.

 

For now it works and once I got a real mission going I could visit these performance tests again.  I need to change a bit of my documentation now and warn people if they write extention scripts to be very weary about performance and make sure one sector run stays below one second processing time, anything above just ruins the system.

Share this post


Link to post
Share on other sites

I progressed a lot for those still following, I'm working on modules as well now and a real mission that I hope to release soonish

Share this post


Link to post
Share on other sites

Will there be a "save game" feature implemented into your mission??? As me and a few friends are constantly loving a good cti/warfare mission but we hate it that we can never save our progress.

Share this post


Link to post
Share on other sites

Will there be a "save game" feature implemented into your mission??? As me and a few friends are constantly loving a good cti/warfare mission but we hate it that we can never save our progress.

 

Yes there will be , but the core implementation is limited.  It just saves the state of the sectors.  However it's all written in a way you can expand it yourself, with a new module :)

Share this post


Link to post
Share on other sites

Yes there will be , but the core implementation is limited.  It just saves the state of the sectors.  However it's all written in a way you can expand it yourself, with a new module :)

 

Cool, can you tell me what if any modded forces will be made available to select from???

Share this post


Link to post
Share on other sites

Cool, can you tell me what if any modded forces will be made available to select from???

 

None it's all vanilla, but again suppose you want other forces, create a new module for said forces and add them.  It should all be pretty straightforward.  If you like I can give you a preview of the mission.  HOWEVER , I'm still developing at any time I'm capable of breaking it completely :)

 

https://github.com/Celludriel/Simple_CTI/tree/develop

 

The setup is quite easy, just download all the files and put them in a folder Simple_CTI.Stratis in your mpmissions folder and fire it up on a DEDICATED server.  It will not work on a regular server since I did not develop it to run on one.  If you want to make changes to the mission never touch the core folder ... really ... just don't ... cause if I make updates that is where I will do my work.  Anything in the modules folder can be updated added changed etc...  I provided a lot of modules already a lot of them based on other peoples work, that I haven't credited yet so ... yeah not a release version, I'll add the proper credits when I actually release !

Share this post


Link to post
Share on other sites

None it's all vanilla, but again suppose you want other forces, create a new module for said forces and add them.  It should all be pretty straightforward.  If you like I can give you a preview of the mission.  HOWEVER , I'm still developing at any time I'm capable of breaking it completely :)

 

https://github.com/Celludriel/Simple_CTI/tree/develop

 

The setup is quite easy, just download all the files and put them in a folder Simple_CTI.Stratis in your mpmissions folder and fire it up on a DEDICATED server.  It will not work on a regular server since I did not develop it to run on one.  If you want to make changes to the mission never touch the core folder ... really ... just don't ... cause if I make updates that is where I will do my work.  Anything in the modules folder can be updated added changed etc...  I provided a lot of modules already a lot of them based on other peoples work, that I haven't credited yet so ... yeah not a release version, I'll add the proper credits when I actually release !

 

If i created a module with custom forces and put it in would they still be able to use the movements and actions of the original vanilla forces or would i have to create that all over also???

Share this post


Link to post
Share on other sites

In all honesty I have no idea.  I never dabbled in extra forces etc... Maybe someone can explain this to you that has some experience with it.  Technically it should be possible if you hold to my designed infrastructure.  How exactly I can't tell.  Now keep in mind I'm calling the mission Simple CTI, the goal is to have something basic that can be ported quickly to other maps if so desired.  For me it's just blue vs red, and I don't care in particular what I'm shooting.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×