Home   Help Search Login Register  

Author Topic: GNV Civilians (ACCEPTED)  (Read 9587 times)

0 Members and 1 Guest are viewing this topic.

Offline Gone Native

  • Members
  • *
GNV Civilians (ACCEPTED)
« on: 09 Oct 2008, 20:09:04 »
Gone Native's Civilians:

A populated Sahrani or United Sahrani with four working bus lines and as many moving civilian cars as you want, created using just scripts/functions.

For several kind of missions, like insurgency, counter-insurgency, spy or evade-and-escape missions, it would be nice if Sahrani would be populated with civilians, instead of being a beautiful but empty island.

ColonelSandersLite made an excellent suite of scripts, called "CSL populate island" which allows one to populate any island with civilians without much lag. Unfortunately the included demo mission only populated a part of the south of Sahrani.
The demo mission placed a lot of triggers on the mission editing map, used only as location indicators.
As an improvement I decided to write an additional set of scripts, -actually .sqf's nowadays-, that allows one to populate north- and/or south-Sahrani without the need to place any triggers or any other location indicators on the map in the mission editor.
Besides moving cars, empty cars, boats etc.. just for fun I also created four bus lines who will service all the bus stops on the map.

The download "GNV_Civilians_V1-0.zip" contains a basic demo mission in which you find the .sqf files.
The mission can run as single or multiplayer, and just allows you to have a look on Sahrani filled with GNV Civilian's with just default settings.
The documentation found in the .zip file is in .pdf:

There is a two pages Quick Start, which allows one to populate Sahrani, also in an existing mission, with a few steps: copy the folders into the mission folder. Adjust a few lines in the init.sqs of the mission and a populated Sahrani is up and running with default settings.

To adjust any of the separate script and functions to your needs, there is a six pages Reference Sheet. You can by example skip the boats, but keep the bus lines, and have only a few civilians running around. Or you can test the performance of ArmA on your computer to the limits by populating Sahrani with hundreds of civilians and many moving cars.

For more information, please read the Quick Start and/or the Reference Sheet

Changelog from beta to version 1.0:

Scripting:
  • Introduced more iterative loops, which made some .sqf's much smaller
  • Use 'isServer' instead of '(local server)', no need to place a gameLogic vehicle any longer
  • Use 'createCenter' instead of placing a dummy civilian on map in mission editor
  • Added comment lines telling which town or village is populated by a statement to the .sqf's that populate the island. This allows for easy removal of unnecessary population centers by mission makers, or easy enlargement of population centers that need extra civilians

Vehicles:
  • Solved some issues in the area of Arcadia, Cayo, Tiberia were cars came stuck
  • Now and then a few vehicles were driving very slow. Actually this is a 'return to formation' problem that can be solved by separating driver and passengers in distinct groups
  • Zodiac playing on the water near Iguana, came stuck in the mud near a bridge. Removed some waypoints that were guiding the Zodiac into too shallow waters
  • Two empty Zodiac's at a jetty in Arcadia and on the tiny island of San Tomas are better positioned, so that they actually can be used

Demo-mission:
  • The radio menu allowed the repeated creation of extra moving vehicles in either the north or the south. Unfortunately these were from the fixed type, I changed these to creation of vehicles of a random type
  • Removed the two civilians (playable) who where no longer of use, due to above mentioned 'createCenter'

Documentation:
  • Added explanation of the isServer and createCenter features to documentation
  • Changed code example from "while" to "for" loop
  • And some small issues...


OFPEC Download
« Last Edit: 06 Feb 2009, 17:43:23 by hoz »

Offline Trexian

  • Members
  • *
Re: GNV Civilians
« Reply #1 on: 09 Oct 2008, 20:24:47 »
:D

Must be something in the stars!  :cool2:

Will check it out!

Edit;
Ok, keep in mind I am still very much a novice at this.  So, probably better to wait for some advice from others. :)

But, I took a look at the bus script, since I was honestly thinking of this EXACT same thing. :D

In looking at your GNV_N_Busses_Create.sqf it looks like there are alot of actions that could be combined more efficiently into iterative loops using arrays.

For instance, all the locations are static - that is, they won't move at all.  Put all the locations into an array like
Code: [Select]
_busstops01 = [[16469.761719, 9296.402344, 11.970000], [15572.099609, 8824.228516, 29.807102], .....];

Then, something like _i = _i + 1 loop, then set the marker position and waypoint position as (_busstops select _i).  Have a different array for each bus line.

That's just an initial observation. :)

LOVE the idea, though.   :clap:

Edit2:
I noticed you use createAgent?  I didn't realize that was working. :) 
« Last Edit: 09 Oct 2008, 23:18:47 by Trexian »
Sic semper tyrannosauro.

Offline Gone Native

  • Members
  • *
Re: GNV Civilians
« Reply #2 on: 10 Oct 2008, 10:00:18 »
Yes, you are right.
Working in Real Life in IT and knowing quite a few programming languages I see what you mean.

The creation of waypoints and even more the creation of triggers -that show you the actual location of the bus on the map if you stand at a bus stop-, can be done in iterative loops.

An interesting question is whether code execution runs faster with iterative loops, or that it doesn't matter ?
(Is in this case a loop quicker than a sequence ?)  ???

While making these .sqf's it was more convenient to work this way for purpose of keeping track which behavior should be part of which waypoint. I.e. in Bagango it is essential that a bus runs at "limited" speed, whereas on the road to Corazol "full" speed is possible. Some waypoints are the bus stops, other waypoints are just to keep a bus on the right track.

But if the script suite gets a "final" version, iterative loops are certainly a better choice for readability.


createAgent:
The purpose of using the createAgent statement for me was part of an experiment, to see if I could get around the issue that in single player at least one civilian has to be placed on the map IN the mission editor, to get the scripts working (otherwise there are cars and busses, but no civilians in them ). By the way, in multiplayer this is not an issue.
I didn't know the 'createAgent' statement was not working. A pity, because it is a good statement, allowing quick creation of an independent character.

Offline i0n0s

  • Moderator
  • *****
Re: GNV Civilians
« Reply #3 on: 10 Oct 2008, 10:58:40 »
@createAgent:
Use createCenter to create a AI center.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: GNV Civilians
« Reply #4 on: 10 Oct 2008, 11:04:02 »
Should this be considered as a "beta" resource or as a "ready" resource?

Offline Gone Native

  • Members
  • *
Re: GNV Civilians
« Reply #5 on: 10 Oct 2008, 12:28:19 »
A "beta" resource.

Scripting can use some improvement (See above) and the documentation can use some slight improvements.

Furthermore in the vehicle testing I used the basic rule:
If it is the same vehicle having the same collison at the same location, I have to try to solve that issue.
Possible solutions:
- Change in speed
- Change in waypoint
- In rare cases: civilian vehicle slow-down trigger
- In rare cases: place an object, like a wreck or something (sometimes AI seems to prefer a route through a garden, above the road, mostly being stopped by some fence. Place an object proves an effective barrier for that behaviour)

But their might be vehicle-issues that I still haven't solved.

Offline Trexian

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #6 on: 10 Oct 2008, 14:25:35 »
For all I know createAgent may be working now. :)  All I know is that at one time the Biki said it wasn't implemented.  I wonder if some patch along the way may have activated it.   :good:
Sic semper tyrannosauro.

Offline Gone Native

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #7 on: 10 Oct 2008, 15:02:04 »
If have tested createAgent.
It doesn't work, so it seems that BIS didn't solve it in a patch.

If have also tested createCenter as suggested by i0n0s.
That works fine  :)

Means that there is no need to place at least one civilian IN the mission editor on the map, as long as you use createCenter early on, in the init.sqs or first lines of the sqf's.

Offline USM-CPT.Dyson

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #8 on: 15 Oct 2008, 06:10:12 »
Ran the demo, works pretty good. Sometimes though civilians will stop moving yet appear as if they are just stuck. Also, although my computer is really slow, it seems a bit laggy. I generally don't get lag as bad so I don't know what's going on. Ape example, I run all of mando's and spooner's scripts and I don't get as low of an FPS. Ill do a bit more testing but it freezes up and moves slow on load.
CTI SectorLink
Version: Beta 7
http://hosted.filefront.com/Spyder001/

Offline Gone Native

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #9 on: 15 Oct 2008, 10:05:27 »
I developed this script suite on a computer with an Intel E8400. Which is here in the Netherlands a recent, but middle-of-the-road gaming processor. Than I get an average framerate of 20+ depending on where I am and what I do...

The demo mission populates the north AND the south of Sahrani, with around 20 moving vehicles on each side, and 240+ civilians in the north and 340+ civilians in the south. Most scenario's will only have to populate either the south or the north of Sahrani.

A simple way to improve performance is to populate only the north OR the south:
Open the demo-mission init.sqs within the mission folder for editing.
Put a semi-colon  ;  -i.e. a comment-marker in .sqs- before either the line:
res = [] execVM "GNV_Civilians\GNV_Populate_South.sqf"
or the line
res = [] execVM "GNV_Civilians\GNV_Populate_North.sqf"
and only the north or the south will be populated.

In the Reference Sheet you can read how to lower the fill factor of the civilians. So that not 240+ are walking around in the North, but -for example- 120+

By the way: I am implementing the advise of Trexian for iterative loops: Didn't run faster, but made some of the .sqf's significantly smaller.
And I solved some vehicles getting in a nasty 'cycle' within the beachresort of Arcadia and a traffic problem at a junction in nearby Cayo.

Yeah, it certainly freezes up a few seconds during the start of the mission (when all these vehicles and civilians are placed "on the fly").
The behaviour of the civilians is part of the ColonelSandersLite "Populate Island" script suite.
He puts them in groups of up to five, in the limited speed mode, and with a doMove they randomly will stand still or walk to another waypoint within a certain radius.
Unfortunately ArmA civvies prefer the middle of the road and are not aware of any traffic  :(
Don't expect much interesting behaviour of 'vanilla' civilians within ArmA, it's not the Sims.


Offline i0n0s

  • Moderator
  • *****
Re: GNV Civilians (BETA)
« Reply #10 on: 15 Oct 2008, 11:03:19 »
So the civilians are there, even if no player is around them?
Since movements will cause load, even if the player is not around, I would recommend that you freeze the civilians when no player is around and simulate their movement via script. That should reduce the load and solve some stocked vehicles ;)

Offline Gone Native

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #11 on: 15 Oct 2008, 15:02:35 »
No, that is not an issue.
The script suite of ColonelSandersLite "Populate Island", creates just a civilian bubble of 550 (ArmA) meters around a human player.
And outside that bubble the civilian's position is remembered, but with a "deleteVehicle" they are removed. One could say "stored".
So no,  they are not all 240+ and 340+ jumping around  :)
« Last Edit: 15 Oct 2008, 15:58:30 by Gone Native »

Offline USM-CPT.Dyson

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #12 on: 15 Oct 2008, 20:01:49 »
Keep in mind i received the same results when i tested CSL Populate Sahrani the 1st time. I didn't realize that you made no changes to his script. Not really sure what the issue is though :(
CTI SectorLink
Version: Beta 7
http://hosted.filefront.com/Spyder001/

Offline Commando84

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #13 on: 15 Oct 2008, 22:54:38 »
Hi I know you said that the script was very basic but im wondering that if I want to add auto refueled civilian vehicles to my mission kind of like the RBT warefare has for the supply trucks.
Code: [Select]
#Update
~10

_base = Call Compile Format["%1Base",Str _side]

if (IsNull _vehicle) then {Goto "Quit"};
if (IsNull Driver _vehicle) then {Goto "Quit"};
if (!Alive Driver _vehicle) then {Goto "Quit"};
if (!CanMove _vehicle || GetDammage _vehicle >= 1) then {Goto "Quit"};
if (IsNull _destination) then {Goto "GetDestination"};
;;added by {USI} Studios to refuel supply trucks,thanks to oktane from the BI forums
if (fuel _vehicle < 0.3) then (_vehicle setFuel 1);

Any1 know how would i add this piece o script to this great populate island script?

Offline wolffy.au

  • Members
  • *
Re: GNV Civilians (BETA)
« Reply #14 on: 16 Oct 2008, 08:59:37 »
Oh, this is great news GN - I was writing the same thing but only for Paraiso. I'll look thru the code and let you know of any issues I find or patches. You've just saved me a heap of work so i'll be happy to help out.