8/15/2010 - 04:36 AM
A new project site will be created for AW 2010 and a link to it will be posted here and in the support forums. It is in final prep and will be posted in the next couple hours.

8/14/2010
AW2010 new project from scratch. It's almost ready to push out to the public for mass hammering, testing and feedback.

8/11/2010

The new from-scratch AW2010 is night and day regarding stability and playability compared to the previous project. As soon as the next SHDN release goes public with the latest batch of changes, AW2010 will be posted so the general public can start help hammering it for problems and playability.

8/9/2010

Ambient Wars is being rewritten from scratch using what I've learned and it will be much more modular, stable, easier to maintain and easier to extend. v22 will be the last version using the old project. v2.0.1.0 will see the begining of the new project with cores rewritten from the ground up.

Latest public release of ScriptHookDotNet is out. Ambient Wars [ requires ] Version 1.7.1.5 BETA for more stable operation. Known issues with AW can now be, and are being, addressed that were not previously possible. The next release of AW slated v2.0.0.22 will make full use of the critical fix in SHDN.
*******************

----------------------------------------------------------------------------------------------------------------------------------------
Q: Common Problem: You can't open the ScriptHookDotNet command console while in the game world and Ambient Wars doesn't appear to work:

A: That is not Ambient Wars failing. See the following.

If you can't open the SHDN command console while in the game world, then Ambient Wars likely isn't working either.
That's not Ambient Wars failing. That is ScriptHook/SHDN related:

If you've installed everything as specified in my ReadMe and pressing the Tilde Key in game (in the game world loaded, not the main menu) doesn't open the ScriptHookDotNet command console, that is ScriptHookDotNet failing to load, and it's probably because the core ScriptHook (C++) file needs one of the following redist updates.

Q: Common Problem: You have a functioning ScriptHook and when you turn on Ambient Wars you see an error related to access denied of files.

A: That is not Ambient Wars failing. You are probably under UAC control and Windows is preventing access to required files. Run As Administrator = Problem Gone.
----------------------------------------------------------------------------------------------------------------------------------------

Progress will slow down again have a very busy set of weeks ahead with current project. But now I can continue to work on Ambient Wars in the evening over time since there's a more stable underpinning with SHDN. There are still unexplained issues I see here which are simply going to take time to fully and 100% isolate as to the cause. But it's worth continuing to try and figure them out. Would LOVE to get AW at a truly stable state with the core features in place because then it could actually grow over time. It's just not there yet.

v2.0.0.22

[ EXTREME Garbage Collection Testing ]

The CarCrews has been delayed to v23 because it is essential to hammer the shit out of the latest meta controller garbage collection system right now.

Mayhem and and StreetThugs are now fully under the control of the meta controller garbage collection.

Recommended testing techniques to help confirm stability and correct collection:

1 - Start AW
2 - Let Mayhem and StreetThugs kick off.
3 - Get in a car
4 - Press CONTROL+A to kick in Turbo Boost and fly / tumble / rip across the city out of the area. Whereever the hood of the car is pointed is the direction you'll get boosted.
5 - Let the car slam back down to earth.
6 - Confirm the previous Mayhem and Thug objects disposed out of the world and new ones start being created. Remember Thugs will not appear if there are no suitable Civs around within its range. Same for Mayhem but it uses both Civs and also Cars.
7 - Repeat step 4 to 6.

Based on my current round of testing the collection system is both stable and working.

If you encounter problems enable file logging:
Player.UseFileLog=True
Thug.UseFileLog=True
and redo your testing until the / a problem happens then post the log contents. The log thunk for Thug will be limited to 100 lines for this release.

[ Known Bugs ]

NOTE: For any of the following bugs, or any not listed, that occur and you see a SHDN sript thread abort message you need to restart the game because AW is no longer in control and there are orphaned objects.

If you are not running at-leat v1.7.1.5 BETA or later of ScriptHookDotNet you WILL experience crashes. Ambient Wars [ depends ] on this versions ability to bubble null object exceptions UP the chain instead of dumping / aborting the script thread.
If you increase StreetThugs to 32 the stability can become seriously degraded. Recommended setting is 16 or less.
If you take a Mayhem car it may not detect it properly yet so when AW is shut off your car will just disappear (disposed in garbage collection).
If you go into the water and exit vehicle and then bring up the car selector and spawn a new vehicle it may cause an exception and dump the scriptthread leaving AW in a stranded state.
The high speed health / armor / ammo refresh is unstable and needs looked into. It should not be used until fixed. The normal (at PlayerLogic Tick) refresh/repair appears stable and fine for use and is enabled by default.

Expand the Revision History Spoiler Tag to see critical history and changes.

Description:
Ambient Wars is an extensive set of code designed to provide a backdrop of chaos and crime into GTA4. It is a fairly highly configurable environment.

I got tired of the boring world where noone is causing havok except me. I also didn't find any war mods that I thought were really effective in the way I wanted the world to feel. So this is my answer. It has a LOT of code all geared toward bringing the world to life with havok of all kinds, but in an ambient way so the world feels like it's on its own and couldn't give 2 shits about me being in it. The result (to me anyway) is a much more interesting single player experience. It is meant for single player. It will not allow itself to be activated in MP games. It would never work in MP anyway for many reasons, including no sync between what's happening between machines and the HUGE amount of extra AI overhead so it would cause so much lag the connections would just crash or turn into a slideshow before going so out of sync everything would freeze and drop.

Requirements:
GAME:
PC GTAIV version 1.0.7.0 or later. Previous versions may work, but they are not tested or supported by me.

You may use any functioning ASI loader you want. I use XLiveLess because it is 1 file (Xlive.dll) and it works. It can prevent saving in the normal way using beds so you may want a different loader. I use CONTROL+S provided by Ambient Wars to save whenever and whereever I want (except while driving...) so I could care less about bed saves not working. Auto saves work as normal regardless.

Installation:
1 - Copy or unpack ScriptHook.dll, ScriptHookDotNet.asi and xlive.dll (or other ASI loader) into the root of GTAIV.
2 - Create a scripts folder off the root of GTAIV
3 - Copy or unpack the contents of AmbientWars into the scripts folder.
4 - Load the game using LaunchGTAIV.exe (if using XLiveLess) or the game directly if using other loaders that support direct EXE launch.
5 - Enter the world and confirm ScriptHook is working by pressing the tilde key. If the command console opens then you have done it correctly and ScriptHook is running so press again to close the console.

5b- Optional: type ReloadScripts into the console and confirm ScriptHook reloads 3 scripts from AmbientWars. This 100% confirms ScriptHook is working in the game and can also be used after changing AmbientWars.ini file settings to have it reload your changes without needing to restart the game. If this is your intent then toggle AW off (F9 is default to toggle on/off), make changes, ReloadScripts, toggle back on, test changes.

6 - Press the Ambient Wars hotkey (F9 is default). If you see your health and armor flash and grow then AW has turned ON. If you see your health go to full and the armor flash between 50 and 100 then AW has toggled OFF.
7 - Let the carnage begin!

Uninstallation:
Close the game and remove the files you added.

Additional Notes:
The Revival version of Ambient Wars has undergone tremendous work for 2010 and provides a level of stability previously impossible due to a number of factors. It is not perfectly 24/7 stable in all situations, but it never will be due to so many variable factors across the board plus the extremely extensive use of so many native game functions being used in huge amounts and speed, all externally through hooks. Considering all of that though, this new version is pretty damn good IMO! Let me know if you disagree and why. Maybe you have some ideas to make it even better. If you do, they might just get coded up and you'll get some credit for them too. In fact I encourage anyone to do this at-will. Anything that will make AW better or more interesting will benefit all of us. So try it out and let the ideas start flying if you have them.

Problems:
If any problems are encountered turn on file logging in the AmbientWars.ini file UseFileLog=True for ThugLogic and PlayerLogic modules and play until he problem happens again. Then post what you were doing and the logs in the support thread.

Note any time the game locks out player control of the character, such as during mission cutscenes, AW now detects this and skips ALL logic flow until control is returned. This has allowed AW to be used as a true background ambient mod while playing the game normally as intended, and solved many previous crashes because the game didn't expect or wasn't in a state compatible with all the things AW was doing and creating in real-time while the game was performing its cutscenes.

Configuration:
Many, many things are configurable including the models used to generate war entities. The configuration file is highly documented so it is more clear what all or most settings do. The model files are also commented at the top. Simply follow the format instructions listed therein to customize which models are used.

Some Info of Interest:
AmbientWars operates with 3 core modules. One of them is a sync module for the other 2 and is simply internal.
The other 2 modules are of interest to you:

1 - PlayerLogic
2 - ThugLogic

Each module can be disabled so only one, both or neither (pointless but..) of them goes active on HotKey press. This could be used to, for example, use PlayerLogic to get the benefits of the settings that help you but not use the ThugLogic so there's no war going on. Or try to survive the world without help from PlayerLogic with ThugLogic going.

For PlayerLogic, examples of things that can be configured are:
Prevent flying out the windscreen of your car regardless of speed or what you smash into, provide an armor and/or health regeneration effect over time, personal vehicle regeneration at configurable damage levels, prevention of wanted levels or clearing of wanted levels, etc.

For ThugLogic, examples of configurable options include:
Model file used to control what models are created, ped density, armor, health, ammo and money of generated Thugs, blip creation, police and player attack flags, max number in the world over time, polling radius, garbage collection distance, chance of war logic per tickrate, chances of vehicle and Thug logic triggers, chances of sub types (driver heart attacks, explosions etc), extra mayhem logic, Thug weapon arming selection chances, etc.

As noted previously you can make changes to AW while the game is running by turning AW off, tabbing out, changing the AmbientWars.ini settings, tabbing back, open console using tilde, type ReloadScripts, confirm it reloaded 3 scripts from AmbientWars, toggle AW back on. Go.

With the new meta controller + StreetThug and Mayhem implementation the defaults are disabled and extreme numbers are in place to stress the system VERY heavily.

[ Street Thugs Expand ]
The default allowed random distance ranges for Street Thugs has been increased, spreading the war out even more.

[ Mayhem goes Ballistc ]
The Mayhem blip code is now plugged up to the new meta controller and statues caused by Mayhem previously are now fixed as well.

MaxChanceExtraMayhem will be back at default 2 for more randomness in occurence after extreme testing

2 new Mayhem properties for even more, or less, total Mayhem in the world at any given moment.

Defaults for these will be hammered out over time for an average interesting amount of chaos through testing.
They are higher than expected initially to stress test.

// Max times per WarTick that MaxChanceExtraMayhem is checked and if the chance hits then Mayhem will trigger. Can be used to increase or decrease the amount of random innocent Ped and Ped Cars are involved in random failures or "bad things happening to them".
Thug.MaxMayhemPerTick=5

// Max (can vary slightly depending on other internal chances such as double mayhem events) total Mayhem related objects allowed to exist in the world at any moment. Can be used increase or decrease to total Mayhem related chaos. A high number will result in a huge amount of chaos at all times so be cautious with this unless that is what you want. Mayhem cars with stuck gas pedals and burning tanks going out of control toward you or anything else at up to 80mph is a SERIOUS explosion.
Thug.MaxMayhemTotalActiveAllowed=8

The Min and Max Mayhem distance randomizers are back in place so it should once again be spread out over a larger area again. It was reduced during debug for analysis in recent versions.

v2.0.0.20 - Statue Problem Fixed

[ Street Thugs ]
Street Thug statues problem appears to be fixed now.
Only StreetThugs is currently enabled by default so this can be 100% confirmed without interference from other code branches like Mayhem and Car Crews.
The other code can be enabled using INI options however they have not been confirmed or looked at yet regarding statues and they WILL cause them I already know this.
Mayhem is next on the plate to get statues fixed and then Car Crews.

[ Street Thug Disposal ]
A new sync disposal system is in place for thugs on the street and is extremely effecient, resulting in much better, faster thug life status as well as world wide thug population during WarTick.
This will be extended to Mayhem and Car Crews once those code branches have the statue problems knocked out.

[ Ped Density Boost ]
This is back in action now that statues for Street Thugs has been repaired.

v2.0.0.19 - Debugging Statues

[ Debug Ongoing ]
// DEBUGGING: Settings are not at default while in debug release mode.
// StreetThugs can start to materialize statue (invulnerable) over long periods of AW being active. This is currently being debugged. Default settings in INI file have only StreetThugs enabled for this round of testing.
// NOTE: Thug.MaxStreetThugCanExist=32 for this test. If this is to much for your rig and the game crashes then reduce it to 16, then 8 and so forth until it is stable.

v2.0.0.18 - Stability Testing

[ Timed Background Cleanup ]
A new background timer will force non immediate mode garbage collection at 5 to 10 minute intervals to see if it has any positive impact at preventing statues over long periods of war.

[ War Starting / Over Messages ]
When toggling the state of the system a message is now also displayed for 2 seconds. A property will be created to control the display of this in later versions. Background cleanup will not display messages, however there will be messages sent to the console itself.

[ Is Player In Control ]
Instead of forcing an immediate mode garbage collection when loss of player control is detected, it will use a new background method.

v2.0.0.17 - Stability Testing

This version is specifically for long run stability testing with the ini file at default values.

[ Debug Complete ]
Issue with crews and Motorsport71 resolved. Settings will now go back to previous or near previous settings and the file cleaned up a bit.

[ Blips Default ]
Creation of Blips will now default to True. It can be turned off using CreateBlip=False
The color of civs and their cars involved in Mayhem code will now be White (innocent) instead of Turq.

[ Car Crew Member Weapons ]
New property MaxChanceCrewMemberHasDriveByWeapon will control the rate but the weapon arming code needs a total evaluation it has not been touched since 2009 and needs rewritten to actually use the weapon chance properties, which it currently does not use at all.

[ Debugging ]
The following releases are for debugging with Motorsport71

[ Car Selector ]
The dialog now remembers what you selected last and has that item, including the scrollbar, at the last selected entry making it much nicer and fast to use IMO.
The list code and file now has a custom organizer mechanism and I wrote code to blast out the default template you see. It can be changed however. Just remember if you do change it to back it up because new releases of AW will always have a default file list.
The color selection buttons are now aligned at the top and also no longer expand past the form edge.

[ Crew Disposal ]
Crews that are entirely dead are once again released to the game for disposal and not deleted in immediate-mode. This was a temp change for recent debug and will now prevent them from automagically disappearing from in front of you just because they died.

[ Distance Checks ]
A few more distance checks have been re-implemented after recent debug sessions complete.

v2.0.0.15

[ Debugging ]
The following releases are for debugging with Motorsport71
Changed the car crew thugs from direct car insertion to staging areas instead to see if it makes a change.

[ Crew Radius ]
Re-implemented minimum polling radius and distance from Player to cut the pop-up/out affect again after new crew code was put in place and tested.

[ Custom ]
Documented the following new features in the ini file better.

CONTROL+S = Save Anywhere (except sitting in vehicle): Can be used to bring up the save dialog anywhere except sitting in a vehicle.
CONTROL+A = Accelerate: Can be used to add a +200mph turbo boost to your current vehicle. This is whatever your current speed is +200mph added. Whatever direction your car is facing is the direction it will get boosted. You can wind up jetting across the sky, out of the ocean, up ramps. You name it. Just a stupid fun thing to do that occured to me while was refining the car selector.
ALT+C = Vehicle Selector List: Can be used to instantly spawn whatever car you want including changing base and feature colors before spawning it.

v2.0.0.6

[ More Car Checks ]
Added more validation checks in crew creation to see if it resolves an issue that Motorsport71 is seeing.

[ Spawnable Cars ]
A new feature to spawn cars has been added (thanks Motorsport71 for the idea).
Pressing ALT+C in the game will bring up a window with a list of car models to spawn.
The models are from a file called AmbientWarsSpawnableCarsListFile.txt and it has some samples. You can add whatever models you want and if they are valid then they will be spawned.
It doesn't have to be a car it can be anything the game considers a valid vehicle model name.

[ Weapon Drops Refined ]
Recent changes made it so thugs were dropping their weapons even when AW was switched Off, which is an imediate mode state that clears thugs across the world instantly. It was not intended for them to drop weapons when cleared / garbage collected in this manner and has been fixed. They should now only drop their weapons when they are killed and not as part of cleanup. This affects car crews and street thugs. This also applies to distance-based garbage collection for all types.

[ High Speed Regeneration ]
A new high speed version of armor, health and ammo is available in addition to the previous version. This can operate at a speed as fast as 50ms and configurably affects 1 or more related properties.

[ Property Updates ]
A number of property names have been changed to be more consistent with each other, and with the intent of the property itself.
Some new properties exist including related to regeneration and high speed.

v2.0.0.5 - Significant improvements this round.

[ Weapons will drop again ]
Fixed a bug where a native call wasn't made to reset the status if DropsWeaponsOnDeath=True after it had been False. This affected all peds everywhere in the world. Oops!
Peds / Everything will drop weapons again if this flag is True.

[ Max Ammo ]
The Max Ammo of the game is now automatically disabled at start up. This will probably turn into a property.
Updated:
This doesn't appear to actually work even though it's provided by ScriptHook. I'll leave it in for now.
Research shows this is locked by the game until you complete it 100% and that annoyed me, so now I'm going to create a player weapon ammo refresh property instead and it'll just be all you are carrying.

[ Player and Ammo Regeneration ]

- Health, Armor and now Ammo Regeneration:
Default Player.SlowlyAddArmor increased from 5 to 15
Default Player.SlowlyAddHealth increased from 10 to 20
Default Player.AutoRepairThreshold increased from 30 to 500 (half car health) to go along with new regeneration rates and chances of thugs being hostile to Player.

3 new properties related to Ammo Regeneration

Player.AutoRefreshAmmo=True // If True, non melee weapons you are carriny will have ammo amounts applied at TickRate
Player.AutoRefreshAmmoAmount=10 // If AutoRefreshAmmo is True, the value here will be added to the total ammo for all non melee weapons you are carrying at TickRate
Player.AutoRefreshAmmoInClipAmount=0 // If AutoRefreshAmmo is True, the value here will be added to the loaded clip in all non melee weapons you are carrying at TickRate

- TickRate:
Default TickRate reduced from 6sec to 5sec.

- Police:
New property Player.MaxWantedLevel with default of 6 added. If your wanted level goes over this amount it will be reset to this value at Player.TickRate.

[ ThugLogic ]

Default Thug.AlsoAttacksPlayerMaxChance reduced from 1 in 15 to 1 in 3 chance to go along with new regeneration rates.

[ Mayhem Relived ]
The Mayhem code has been totally rewritten and now provides a huge amount of variance. Each possible piece has significant code associated but the following enum gives an idea of what it might do when it triggers.
Friend Enum MayhemTypes2 As Integer
Ped_Explode = 1
Ped_Torch = 2
Ped_HeartAttack = 3

[ AmbientWars.ini Reorganized ]
The file is now MUCH easier to deal with. It's been cleaned up and new formatting adding so comments can be appended with tabs+// allowing more properties to be visually grouped together for easier editing.

[ Misc ]
Created another batch of helper functions
Refined another batch of existing functions.

v2.0.0.4

[ Readme File ]
Re-wrote the readme file with updated information.

[ AmbientWars.ini ]
Re-wrote the headers and modified or added more comments.

[ Mayhem ]
Default Thug.MaxChanceExtraMayhem is now 2. The Mayhem code will probably get enhanced further to add more variety and ped-hell in the city soon.

[ Misc ]
Made more misc changes and enhancements in code and remove all waits again for analysis.

v2.0.0.3

[ Enhanced Ambient Wars Visual Indicator ]
When AW is started the health and armor will grow from 20 to 100 over 5 showing AW has gone active.
When AW is stopped the health will be set to 100 and the armor will flash between 50 and 100 over 6 and end with 50% armor.
These are useful to know AW has gone on / off in a subtle way without any annoying messages being displayed.

[ Hard Coded F10 Key changed to CONTROL+S ]
Accidently left in my hard coded test key of F10 which forces bringing up the save dialog. After removing it I considered some may find it useful too. So, it's back in but now it is CONTROL+S to free up F10 which is far more likely to be used by other programs or scripts for the game. The only real requirement for it to work is you can't be sitting in a vehicle to bring up the dialog. Other than that you can bring it up and save anywhere you want for the most part. It is WAY to annoying to have to go to a safehouse to save, especially while developing, so that is why it exists.

[ Player Control Test Addition ]
This test is now also in PlayerLogic PlayerTick for consistency. It is working exceedingly well in ThugLogic WarTick to prevent the game from crashing during cutscenes / moments where the game is in automatic mode. The state of the game internals during these moments is unknown. What IS known is it is easily crashed with the scripts actively running creating thugs, crews and mayhem in the background during them. The new control check has eliminated this issue completely by simply skipping the entire set of war code until it detects the player being back in control. So I have also added this to PlayerLogic as well. During these moments, the player code will simply skip all operations until it detects the player is back in control again.

[ Forced Logging ]
The forced logging (ignores Logic.UseFileLog) in the traps are now prefixed. These were to confirm the new control skip were actually operating correctly without having the tremendous data logging of everything else as well. They will now only log, as all other things, if UseFileLog=True.

[ Multiple INI Files Gone ]
There are no longer multiple AmbientWars.ini for me to maintain.

[ Performance Recommendations ]
A new header in the AmbientWars.ini file called Performance Recommendations can be used as a guide or suggestion for you to change certain values to increase performance on slower rigs or increase them for a crazier environment if your rig can handle the chaos.

[ AutoRepairThreshold / Other Properties ]
Added a note in the INI file about this property as some may think it's 100 = prestine but it's not. It's 1000.
Added a number of additional notes to various properties.

[ AmmoMin / AmmoMax Reapplied ]
The arming code is once again using these ranges when giving ammo to Thugs in the weapon arming trees.

[ Thug Accuracy ]
New ranges for AccuracyMin / AccuracyMax applied to give even more varied action and chaos.

[ Extra Mayhem Car Gas Stuck / Thug.MaxGasStuckSpeed Obsolete ]
New Mayhem ramp-up code has been created to simulate a car with a gas pedal getting stuck that ramps it up nicely but in a realistic way so cars don't (can still happen but rare) climb walls or other structures due to speed code. The new code ramps the speed over time now. It's a work in progress but early results are excellent.
Non gas related code has also been significantly enhanced and extra checks have been put in place as well that make sense within its context, like ignoring a car that isn't running or is already destroyed etc.

[ Misc ]
Made a large number of misc changes all over the place as part of refinement and experience enhancement.
Added another batch of property changes to the file.
Added some more properties including for new mayhem gas ramp-up.
Removed all Waits for deeper analysis of raw performance and impact of various code flow that was previously made to wait on Throttle at cycles.

CRITICAL TRAP:
Implemented a critical new trap so missions can hopefully be played as normal without AW thugs and crews code causing all kinds of hell and a crash when they begin. After browsing the ScriptHook component for possible solutions to get around these issues it looks like the simple check if the player can control the character is enough. During my analysis, and before implementing this, EVERY time the 1st date mission started, shortly after during the cutscene the game would hard crash.

This was reproducable 3 times and happened at the same moment during the cut screne. After implementing the new trap in WarTick, things finish smoothly without any problem. So now WarTick (ThugLogic only. PlayerLogic doesn't appear to need it) will check the status if player can control the character. If it can't, all thugs are immediately cleared and the tick will simply be skipped. Once the player can control the character again things will simply go back to normal and the war will resume without doing anything further. My goal here is to make it possible, if at all possible, for Ambient Wars to be able to be active at all times during normal play including missions. There may certainly still be problems, especially if you save while AW is active since the game automaticlly sets created objects to mission req until they are explicitly flagged with NoLongerNeeded. The point there is, saving with AW active means you may be saving 1 or more thugs or cars flagged in this manner. That's bad. You should always turn AW off before saving.

v2.0.0.1
- Disabled StreetThugs again by default. It needds a real overhaul. CarCrews and Ambient Mayhem appears working extremely well and extremely stable.
- Fixed an issue where some dead Leader and Member objects would get a Grey Blip even if CreateBlip was False.

v1.0.0.16
- Partially enabled most PlayerLogic tick code again.
- Made a number of performance improvements.
- Added visual indicators using health when AW goes on / off. On = a regenerating health from 5% to 100% at +20 over 5 passes. Off = a flashing health from 5% to 100% over 5 passes.
- Default SlowlyAddArmor is now increments of 10 over TickRate.
- Default SlowlyAddHealth is now increments of 15 over TickRate.
- Improved stability.

v1.0.0.15 Beta
- PlayerLogic and CarCrews is now disabled by default until issues are isolated. The street thugs and mayhem code appears to be very stable.
- Significantly reorganized the config file making it easier to deal with.
- Increased default max from 8 to 14 for cars in pool of car-born thugs since less crew per car due to last code change.
- Increased default global max thug allowance from 25 to 30.
- Finished changes from Psycho to Thug syntax.
- Created WaitOnPlayer and WaitOnThug checks.
- Created a PlayerLock script sync.
- Created CarCrew management and syncing.

v1.0.0.14 Beta
- Modified CarCrews code to only allow the same car to be used once (no more multi thug occupants). If the other change resolves the issue then multi thugs will be used again.
- Modified CarCrews code to obliterate any passengers in a car chosen prior to adding a new occupant to see if that has impact on an issue. I'm wondering if the GetFreePassengerSeat function is either failing or if it does NOT return the true count if a car is a certain distance off but when the car gets closer it suddenly has more in it. This is just a guess.
- Default chance is back to 50% creation for thugs.
- Psycho Clearing after AW goess offline is back again after finished testing. So when AW is turned off, all tracked Psychos will be cleaned up immediately (poof...)
- Modified the logger slightly.

v1.0.0.13 Beta
- Added ability to selective Enable / Disable Car Crews and Street Thugs branches. This is specifically to allow those experiencing a problem with the CarsAhead related code to see if the rest of the mod works while not crashing due to the CarsAhead being disabled.
- Psycho.UseCarCrews=True / False to use / not use any code related to CarsAhead.
- Psycho.UseStreetThugs=True / False to use / not use any code related to ThugsAhead.

v1.0.0.12 Beta
- Implemented the MaxChanceOccupantsCombust in many more locations to make cooking people more variable. Looks great but was seeing a bit to much of it so now all (or most) of the BBQ code is based on chance now and will be configurable based on that setting.
- Added a few more safety checks.
- Slightly rewrote carsahead again.
- Played for 30 minutes with no crashes. Drove around a lot, jumped out of vehicle a lot, went on foot a lot. No crashes. Exited normally.

v1.0.0.11 Beta
- Implemented code to temporarily make cars involved with carsahead psycho crews invul until the crew code has completed. This may have resolved a problem where the crew code would sometimes fail. I believe this may have been a time-critical situation where the car was valid when the code began but was in an invalid state (but still had a valid pointer) at the time of crew population.
- Modified vehicle leave tasks to simply be Leave and with no door close flag instead of LeaveImmediately. It appears the LeaveImmediately function makes them play their door close (which is odd to me since the name would imply emergency! bail! who the hell would stop to close the door if they're on fire??) at any rate this is to address the 2 silly issues I see. 1, when they leave, even if they're on fire, they shut the door! And 2, since the close door flag can be used with this alternte function it may resolve the issue where the doors can't be ripped off as they're opening them because (making an assumption here) the game is anticipating them to close the door so it's probably making it impossible to be destroyed by using a door-related animation on the vehicle. Just guessing here. we'll see.

v1.0.0.10 Beta
- Added version to the log files so it's clear which assembly is being used.

v1.0.0.9 Beta
- Added more last command captures because it's getting harder (a good thing...) to track down the more rare occurances of crash / bad pointer attempts. Hopefuly the logs will be able to catch more of these before an ultimate crash.
- Added more 20ms waits (seperate from ThrottleCode) to slow down some of the more aggressive code.
- Added a couple more safety checks that I missed last round.
- Fixed the assembly versioning that was 1 behind current due to the speed of recent change (forgot to update)
- Added missing checks in the Player code.
- Modified carahead code to see if can change a strange pointer problem some are seeing. Very odd.

v1.0.0.8 Beta
- Critical bug in the Player module fixed. Oversight on my pat. Duplicated a block related to MP prevention but forgot to update which logger module was used in there, so at the 1st Player tick rate,
-- it would try to reinit using the wrong logger (already init at 4sec war tick) which is invalid. This explains why the AmbientWars.PlayerLogic.Log is missing for some, while others simply see a crash due to it.
-- This may have only affected those that turned on debug / file logging however it should be resolved now.

v1.0.0.7 Beta
- Made controllable via chance (MaxChanceViolentOccupantsTorchDriver) a driver that suddenly finds themselves driving around a crew of violent criminals gets set on fire by 1 of them.
- Refined more of the war code.
- Added a lot more safety checks when accessing game pointers instead of relying on block checks.
- Added checks on Niko's action to retry certain operations if he's in the middle of entering or exiting a vehicle.
- Stability has been improved.

v1.0.0.6 Beta
- Added the ability to alter via chance the new vehicle-ahead war code to randomize the chances of violent occupants.
- Added new min and max chance properties for creation of violent occupants.
- Added the ability to control the variable heading randomization of the lookahead war code for potential violent occupants.
-- Note the current heading of the player is always the base. The variable random heading alteration directly modifies the size of the look-ahead cone of action in degrees from 1 to 359.
- Enhanced internal flow to further reduce lag bursts caused during war ticks.
- Enhanced global Psycho disposal to clean up dead Psychos faster and at a shorter range than those still alive.
- Drivers of cars taken over by violent occupants once again have a chance of being set on fire by their unwanted crew.
- IMPORTANT CHANGE: Due to the occasional DotNetHook crashing when it loads at game start all class initializers are now offloaded into the war toggle section.
-- When the hook loads, it loads classes it detects that inherit scripts. Some times it appears to crash. This is the hook itself and not the AW code because it's not active yet.
-- However, since it creates new instances of the script classes I will see if preventing a blast of class inits on New does anything to negate this behavior.
-- It's at-least possible since it loads more than 1 script at a time and does it extremely fast. We'll see what happens.

v1.0.0.5 Beta
- Adding another block of behavior code for more dynamic environment again.
- Added back some more behaviors and outcomes.
- War tick is now at a reasonable 4000ms after 250ms stress testing.
- MaxCanExist now defaulted back to 20.
- A small number of vehicles ahead will now have violent occupants again.
- The roads ahead are once again more dangerous with riots and chaos.

v1.0.0.4 Beta
- Increased MaxCanExist to 35 for more stress testing.
- Confirmed Psycho ground logic. Psychos are properly grounded now when they are created and no longer in the air at times. May or may not still be situation where they do in air will have to see.
- Changed MaxChanceWillCreate to 1 (100%) default for more stress testing.
- Significant rewrites of war code in effort to produce more stable environment.
- Some dynamic behavior is gone and will be rewritten after the new pieces are confirmed more stable.
- Presently seems very stable compared to previous versions.
- Throttle is back to 50. Default War is now 400ms.

v1.0.0.3 Beta
- Made a number of improvements in general
- Added DropsWeaponsOnDeath flag. Default is False, noone drops weapons on death.
- Implemented new block that favors creation using custom LookAhead and sidewalks / non-street when suitable vehicles are not available before using close peds as final attempt.
- Default MaxCanExist is now 20 to help increase stability on more machines. Medium to High PC can set this much higher and see. A value of 50 works fine here.
- Default ThrottleCode is now 35ms instead of 50ms due to new war tick.
- Default MaxChanceExtraMayhem is now 3 instead of 2 due to new war tick which increases the rate at which Mayhem can occur by design. This may be increased higher to decrease mayhem occurence after more testing.

v1.0.0.2 Beta
- Changed framework from 3.5 to 2.0 to allow more folks to use it that may not have 3.5 since anything greater than 2.0 is not required by the current ScriptHookDotNet assembly.
- Removed all unnecessary system assemblies. Now down to 2 plus ScriptHookDotNet.
- Made extensive changes geared toward trying to isolate stability issues in general.
- Isolated the main script tick to resource gathering only and offloaded war code into a seperate thread.
- Implemented new war code on independent interval.
- Wrapped a huge amount of pointer references into secondary and tirchiary checks to try and catch more nulls in case that's happening more than expected on some machines.
- Implemented new weapon clearing for Psychos that are near death. This will minimize (but not eliminate) many scattered weapons on the ground.
- Psycho Money levels should now be working correctly. Civs will of course still drop cash but Psychos no longer do if MaxMoney=0 and possibly 1.
- Though still an issue some vehicle doors, hoods and trunks should now be able to rip off and fly when smashed into under conditions related to the mod code itself. More to be done to resolve once can focus on it.
- Default MaxCanExist is now 35 instead of 50.
- VSYNC may still be an issue and no VSYNC should be used until that is isolated after it's fully stable without it on.
- Default Psycho cash is now between $5 and $25.
- Coded default to see initializing file processing is now disabled as the parser is good to go. There will no longer be messages at the top of the screen when AW cranks up. If something explodes or bullets start flying you know it's working.

v1.0.0.1 Beta
- Created revision history file.
- Bug: Memory Access Violation: Still Open.
-- Although caught in exception handler and therefore not a critical failure, some times an access violation occurs with the underlying native code.
-- This is most likely due to certain property checks, such as IsOnScreen, for objects that are suddenly on screen while the property is being checked but modified underneath.
-- This would cause a read attempt against a memory value that is being updated and therefore a violation or access error. There is nothing that can
-- be done in those circumstances because I do not control thread syncs on those properties. If someone knows if the hook lib provides a sync object
-- then let me know and I'll use it on the most important property checks to see if this resolves the problem. The exception of this nature will be offloaded
-- into a file log only and no longer (also) show on the screen when it happens.
--- UPDATE: Exceptions are now only logged to disk. Also added another set of LC (last command) now in Tick to help further trace (or confirm) odd throws related to uncontrollable access
--- violations and other factors.

- Possible Bug: Vehicle Doors: Possibly Fixed.
-- Some vehicle doors won't rip off their hinges when smacked as you drive by.
-- This 'may' be a result of vehicle doors being opened by code not sure yet. If that's why there may not be anything that can be done to make them be able to rip off.
-- Code is already in the random open doors code that sets the vehicle CanBeDamaged / CanBeVisiblyDamaged but that didn't resolve it. Still looking for potential fix.
--- UPDATE: Added a 200ms wait in open doors code so the game has time to simulate visually opening doors (including hoods and trunks). Then the code explicitly sets
--- the door in question to IsOpen. This may have resolved the issue for the most part, as I think the game was still in the process of 'opening using animation' the
--- doors when you make contact with them, which prevents them from being able to be ripped off, so this fix (if it fixes it) is a good middle ground. It will still
--- allow the door simulations but also set them directly after to their open state.

- Added mayhem section visual indicators in config file to make it easier to find it. Other sections will get this as well over time to make it easier to find stuff in there.
- Added new Mayhem setting MaxChanceVisualExplosion.
- Added new Mayhem setting MaxChanceCarBadDriver.
- Disbled new features while stability testing.
- Created new code throttling which may dramatically increase stability especially on slower machines. Only testing on such machines (and all machines generally) will show this to be the case.

Ok thanks Xan a new version using new throttling code will be uploaded in a few minutes for further testing. Don't concern yourself with changing / customizing settings yet if you can help me stability test this monster then it would be worth customizing.

Latest versions have entirely removed IsOnScreen checks to eliminate all chances of accessing such a dynamic and important property at such a fast rate where it can change while being evaluated causing violations and possibly corrupted memory = crash.

I must say this is an awesome mod! Just tried it out and it definitely adds the element of surprise to free roam play. I think I'll check into what sort of settings I can modify next time I play.

Good to hear I definitely have fun with this thing. Thought others may like it too which is why I spent the time to make it generic enough for most to easily use it. As far as configurable it provides quite a few options for that. The focus is on stability issues at the moment but it's come a long way since 1.0 in that regard.

v.12 causes same crash and exactly the same logs as in v.11. SO no change.

BTW in v.11 i started the game and after i saw the first image, after the loading, the screen went black and it crashed to desktop, everything in 1 second. Second start it didnt crash but after activating the mod.