Log in to reply
 

[WIP] Locational/Global Vehicle Spawning



  • AHK1221 is working on a modification right now that allows the player to designate any number of vehicles to a group, followed by one or more locations, along with a spawn probability for each vehicle.

    When you have multiple vehicles in 1 group all with a 100% Probability of spawning. What happens is that the number of vehicles that have the same probability is added, giving a total of the amount of vehicles there are with a chance of 100%. Let's say that 6 vehicles in a group have the same chance of spawning. How will the game decide which vehicle to spawn? Well, it will generate a random number from 1 to 6, and whatever number it lands on is the vehicle it will spawn, depending on where that vehicle is located at in the INI file. If it lands on the number 5, it will spawn the 5th vehicle. There is currently also a feature that supports more than one vehicle to spawn at a time. This feature is called Simultaneous Spawning.

    The current features that need to be worked on so far are as follows:
    Only one location can be added, even though the mod supports multiple locations, there isn't yet functionality to add in the second locations, but as of right now June 5th 6PM, there is. :)

    You can actually add the vehicles to one location, at one particular set of coordinates, and then jump in to a different vehicle and drive 10 feet away, and add that vehicle to the same group, both vehicles will now spawn at either coordinates within that location.

    Feature being worked on right now, :
    Only the first vehicle shows up on the radar and only the first coordinates are displayed, any additional coordinates aren't shown in the INI, this not a bug, but due to the code not being complete.

    You can currently see a prototype INI file, in which 3 Vehicles are assigned to a group. Either vehicle may spawn at either coordinate.

    This modification is a work in progress and is in it's very early ALPHA stages. There is A LOT to be done still. AHK1221 has worked VERY HARD on this modification.

    Finally, this is not a portrayal of the final product, but a concept. However, since this Modification was inspired by me and is being brought to life courtesy of AHK1221, and those who have provided support to him. I figured as an alpha-stage tester of this mod, I would give you a sneak peak of our progress so far. I'm thinking that we need to come up with Categories and then put the groups inside of the categories as well, based off the way the script currently works. However, it may be a lot of work. We'll see what AHK1221 has to say about it when he wakes up. Please feel free to provide any suggestions or feedback as to how the mod should work, how it currently works, and what you think so far, what changes may need to be made. If you're willing to support AHK1221 by becoming his patreon, he will very gladly appreciate it. https://www.patreon.com/user?u=5743056


    AVS 0.2.2 Version INI Format


    Name=Shipyard M
    Simultaneous_Spawning=True
    
    ;Spawn Coordinates
    [L1Location]
    Actual_Name=L1Location
    Display_Name=L1
    Position=X:1135.962 Y:-3227.891 Z:5.509732
    Rotation=X:0.1123545 Y:-0.03912427 Z:-0.5506954
    Enable_Blip=True
    Blip_Color=Yellow
    [L2Location]
    Actual_Name=L2Location
    Display_Name=L2
    Position=X:1131.691 Y:-3227.744 Z:5.510054
    Rotation=X:0.145867 Y:-0.02439503 Z:-0.7233396
    Enable_Blip=False
    Blip_Color=Yellow
    [L3Location]
    Actual_Name=L3Location
    Display_Name=L3
    Position=X:1127.744 Y:-3228.092 Z:5.504296
    Rotation=X:-0.3936107 Y:-0.01072656 Z:-0.6011391
    Enable_Blip=False
    Blip_Color=Yellow
    [L4Location]
    Actual_Name=L4Location
    Display_Name=L4
    Position=X:1123.748 Y:-3227.768 Z:5.482669
    Rotation=X:0.5260214 Y:-0.03617152 Z:0.7445337
    Enable_Blip=True
    Blip_Color=Yellow
    
    ;Vehicles
    [Ferrari FXX-K Hybrid Hypercar]
    Engine_Running=False
    Hazard_Lights=False
    Lights_On=False
    Vehicle_Name=Ferrari FXX-K Hybrid Hypercar
    Model_Hash=234062309
    Locked=True
    Alarms=True
    L1Probability=0
    L1SpawnRate=0
    L2Probability=100
    L2SpawnRate=100
    L3Probability=0
    L3SpawnRate=0
    L4Probability=0
    L4SpawnRate=0
    [2015 Porsche 918 Spyder]
    Engine_Running=False
    Hazard_Lights=False
    Lights_On=False
    Vehicle_Name=2015 Porsche 918 Spyder
    Model_Hash=1588380823
    Locked=True
    Alarms=True
    L1Probability=100
    L1SpawnRate=100
    L2Probability=0
    L2SpawnRate=0
    L3Probability=0
    L3SpawnRate=0
    L4Probability=0
    L4SpawnRate=0
    [2007 Lamborghini Reventon]
    Engine_Running=False
    Hazard_Lights=False
    Lights_On=False
    Vehicle_Name=2007 Lamborghini Reventon
    Model_Hash=418536135
    Locked=True
    Alarms=True
    L1Probability=0
    L1SpawnRate=0
    L2Probability=0
    L2SpawnRate=0
    L3Probability=100
    L3SpawnRate=100
    L4Probability=0
    L4SpawnRate=0
    [2014 McLaren P1]
    Engine_Running=False
    Hazard_Lights=False
    Lights_On=False
    Vehicle_Name=2014 McLaren P1
    Model_Hash=-129939002
    Locked=True
    Alarms=True
    L1Probability=0
    L1SpawnRate=0
    L2Probability=0
    L2SpawnRate=0
    L3Probability=0
    L3SpawnRate=0
    L4Probability=100
    L4SpawnRate=100
    

    Outdated INI Concept during planning stages:

    0.0.0 Alpha Stage Concept

    Outdated INI file Concept
    [GROUP]
    Name=Military HMMWV
    [Military Base]
    Location_Name=Military Base
    Display_Name=Military Base
    [Spawn Coordinates]
    Position=X:274.0487 Y:1076.341 Z:224.4177 // Near South Hangar A1 (Unspecified Exact Location)
    Rotation=X:-0.9772298 Y:-5.530599 Z:126.6914 // Near South Hangar A1 (Unspecified Exact Location)
    Position=X:226.0487 Y:1376.341 Z:224.4177 // Building B3 (West Side)
    Rotation=X:-0.9772298 Y:-5.530599 Z:126.6914 // Building B3 (West Side)
    Position=X:254.0487 Y:1626.341 Z:224.4177 // Building B2 (South Side)
    Rotation=X:-0.9772298 Y:-5.530599 Z:126.6914 // Building B2 (South Side)
    [-1041692462]
    Vehicle_Name=M1025 4x4 High Mobility Multipurpose Wheeled Vehicle (HMMWV) UA Basic
    Display_Name=M1025 (HMMWV) Humvee
    Model_Name=-1041692462
    Probability=90
    [418536135]
    Vehicle_Name=M1043 4x4 High Mobility Multipurpose Wheeled Vehicle (HMMWV) UA Special Forces
    Display_Name=M1025 (HMMWV) Humvee
    Model_Name=418536135
    Probability=75
    [998262399]
    Vehicle_Name=M1114 4x4 High Mobility Multipurpose Wheeled Vehicle (HMMWV) UPA Tactical
    Model_Name=998262399
    Probability=95



  • New Information for future improvements, and information for other modders working with similar scripts algorithms.

    Depending on a random number is a decent method of dealing with identical probabilities, but for a truly effective and unbiased probability you'll want to ensure the results are maximally apart.

    What is meant by this, is basically stating that a random number is not truly 'random'. If you have ever studied the output of most standard random functions in a programming language you may notice the processor starts to display certain 'patterns'. Some processors may generate a specific number more times than another.

    What you end up with is only a small amount of cars out of a list actually spawning because of how not-random the results may be.

    https://en.m.wikipedia.org/wiki/Random_number_generation#.22True.22_vs._pseudo-random_numbers

    This information is archived her for anyone who wishes to join the development team to make improvements alongside AHK1221's work. I have a reliable source of expert advice, and that's where this information comes from.

    We're going to stick with the current random algorithm, there's no need for the number to truly be random, we just needed a way to make sure it spawns either vehicle when their probabilities are the same. It's just a method for selecting those vehicles from that internal probability group. Unless it causes problems. Further testing will begin on the first release. Version 0.90 *



  • This looks interesting. Is there any chance you will be able to fix the 747 spawns at the airport? Only the one that is landing spawns. Very rarely will the ones parked around the airport spawn, or the 747 on the other runway that takes off. They used to spawn on last gen. I think the spawns that barely work on CG and PC don't work because the 747's in the sky took up space in memory. Its like there is a limit on how many 747's can spawn. When I placed a few with Menyoo a while back, the planes in the sky stopped appearing. If we could allow the game to have more 747's, the airport will look much better and active like on old gen.



  • @nkjellman Yup, that will be possible ;)



  • @AHK1221 Glad to hear it. When you do so, the planes in the sky will spawn too? Also, this includes the plane taking off?



  • @nkjellman No, thats not part of the mod. It will enable others to create vehicle spawns, not "interactive" spawns because that will be way too complex and is not the aim of the mod.



  • Right, this is only for stationary vehicles. We're going to stick with the current random algorithm, there's no need for the number to truly be random, we just needed a way to make sure it spawns either vehicle when their probabilities are the same. It's just a method for selecting those vehicles from that internal probability group.


    The latest test resulted in 1 vehicle spawning in the all 3 locations it was saved at. I only had 1 vehicle in the group, and 3 locations. That results in a very successful test. Note: the Green lines were added by me and don't show up in the mod.

    Version 0.85

    I then threw grenades on each vehicle drove a distance of 400 away from them, and when returning to each location, the vehicles were back in their original form, with different colors.



  • We're getting ready for a official release of Version 0.20


    Concept Stages & Future Development Plans


    New Features: Ability to assign vehicles to to their own Categories, and insert locations with multiple spawn coordinates.

    Better menu organization, and more flexibility in general.

    Due to the complexity of the coding, this may be a long time away.

    Features seen here may be available in the official release of 1.00 or subsequent releases afterward,
    but are at best in a concept stage right now and are being discussed.

    [CATEGORY_GROUP]
      [CG_MILITARY]
          Name=Military Vehicles
      [CG_EMERGENCY]
          Name=Emergency Vehicles
      [CG_EXOTIC]
          Name=Exotic Vehicles
    
    [VEHICLE_GROUPS]
      [VG_HIGHMOBILITY]
          Name=High Mobility Multipurpose
          Simultaneous_Spawning=Enabled
          Group=MILITARY
      [VG_TACTICAL]
          Name=Tactical
          Simultaneous_Spawning=Enabled
          Group=MILITARY
      [VG_UTILITY]
          Name=Utility
          Simultaneous_Spawning=Enabled
          Group=MILITARY
    
    [VEHICLES]
      [V_HUMMER]
          Vehicle_Name=Hummer
          Model_Hash=408192225
          Probability=100
          Groups=HIGHMOBILITY
    	  Locations=M1;L1;L2
      [V_HUMMER2]
          Vehicle_Name=Hummer Armorered
          Model_Hash=408192226
          Probability=100
          Vehicle_Groups=HIGHMOBILITY;TACTICAL;UTILITY
          Location_Groups=M1;L1
      [V_HUMMER3]
          Vehicle_Name=Hummer Anti-Air
          Model_Hash=408192227
          Probability=100
          Vehicle_Groups=HIGHMOBILITY;TACTICAL;UTILITY
          Location_Groups=M1
      [V_LAMBORGHINI]
          Vehicle_Name=Lamborghini Reventon
          Model_Hash=408192227
          Probability=100
          Vehicle_Groups=EXOTIC
          Location_Groups=L3
    
    [LOCATIONS]
      [L_1]
          Display_Name=Ammu Nation Blaine County
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
          Display_Name=Ammu-Nation Los Santos
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
      [L_2]
          Display_Name=FIB Building
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
      [L_3]
          Display_Name=Parking Spot 1
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
          Display_Name=Parking Spot 2
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
          Display_Name=Parking Spot 3
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
      [L_M1]
          Display_Name=Military Location 1
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
          Display_Name=Military Location 2
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
      [L_EXOTIC]
          Display_Name=LS Customs Los Santos
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148
          Display_Name=Bennys Garage 
          Position=X:200.1446 Y:1224.982 Z:224.9926 
          Rotation=X:0.05052233 Y:0.02660011 Z:-77.22148


  • 0.10 BETA Released.

    AVS 0.10



  • If anyone wants the version that was used for DEBUGGING / TESTING:

    It can be found here:
    http://www.mediafire.com/?kpo8nrj82e03h

    Since this file is not posted to the original website. The moderators would likely encourage you to scan the file with an antivirus system such www.virustotal.com before unpacking the archive. I can personally assure you it is free of any malicious code. I'm only required to state that you are downloading this file at your own risk separate from the GTA -5Mods.com Administrator/Moderation team's approval.

    Remember that this is the version that was used for testing and debugging, and I felt I would provide it here for those who would like some re-assurance as to how it works. It was also requested. This version will show the cumulative number generator based on the total probabilities of all vehicles, and will show blips of the spawned vehicles when you're within 400 units of distance. The project is closed source right now, however AHK1221 will consider open sourcing it.



  • 𝐏𝐥𝐚𝐧𝐧𝐢𝐧𝐠 𝐒𝐭𝐚𝐠𝐞 𝟎.𝟏𝟓

    • Ability to Enable or Disable Vehicles Showing up on Map as Blips Per Vehicle Group.

    In the next update 0.20-0.30 Beta @AHK1221

    0.20 Beta

    Who can imagine a series of missions being developed where you need to steal rare cars after being given various locations for them? Not that this is going to be a part of that mod, but you get the idea!

    Update 0.25 Alpha (Unreleased/Testing Phase) -> You can now specify frequencies per location, and you may also in the same context specify the frequency PER VEHICLE. Frequencies can also be adjusted on a global scale to all locations in the group per vehicle. Vehicular Frequencies are not yet implemented, as in there's no method of causing locations to not spawn vehicles all the time, but there is a method to cause some locations to be used more or less than others. The way it works right now, means that there will be a vehicle in either location that is designated at all times, depending on the vehicle The current script that is being worked on allows locations to be specialized so that one location may spawn one vehicle more than another, however there will always be vehicles in said locations regardless.

    For example

    [GTS8]
    Vehicle_Name=GTS8
    Model_Hash=-1454500801
    1st-LocationFrequency=1
    2nd-LocationFrequency=1
    3rd-LocationFrequency=1
    VehicleSpawningFrequency=40%
    

    If this is confusing right now, it won't be upon release. There is a small problem that needs to be solved right now. One is the confusion, and the other won't be mentioned right now. If you do run in the problem we'll probably be aware of it, but report it anyway. Just want to provide public access to what's being planned and/or discussed currently, to keep people that are interested in the know.



  • Making great progress. Resolved a bug that we were stuck on. Thanks to some help from a friend of mine.



  • AVS 0.20.

    Here's a sneak peak of some new features:

    • Blips can be toggled per location and are location specific.
    • Blips now mark locations and not the vehicles themselves.
    • Locations can have Spawn Rates assigned to them.

    Example:
    Press the 'O' key to open the in-game AVS Menu and press 'Enter' on the Spawn Groups menu item. Select the 'Add New Group' menu item.

    Enter a Name for the newly created group. We are going to name this group. "Group 1"

    Assuming that you are in the location that you would like to use, the script will now ask you to specify a location name, we are going to call our first location "L1", and our second location "L2".


    The script will now ask for a vehicle name.

    Choose any name you would like.

    • For this demonstration we are going to enter the name "2015 Lamborghini Huracan" and press Enter. After pressing Enter you will be taken back to the Main Menu.

     
    Select your newly created group (Group 1) and press Enter.

    You are now in the group menu for
    'Group 1'


    You now have the following options to choose from:


    Name
    Simultaneous Spawning
    Remove
    Locations
    Vehicles


    Select Vehicles -> 2015 Lamborghini Huracan


     
    You are now in the Vehicle menu for
    '2015 Lamborghini Huracan'


    You now have the following options to choose from:


    Engine
    Lights
    Hazard Lights
    Name
    Model Hash
    Spawn Configuration
    Security System


    Let's adjust our Spawn Configuration so that the vehicle will spawn at the locations we created earlier:
     

    Spawn Configuration:

    • L1
       Probability=100 (default)
       Spawn Rate=100 (default)

    • L2
       Probability=100 (default)
       Spawn Rate=50 (default)
       

    We have adjusted the Spawn Rate for our 2015 Lamborghini Huracan.

    For the first location. (L1), we have chosen it to be 100.
    For the second location . (L2), we have chosen it to be 50.
     
    The 2015 Lamborghini Huracan will now spawn at both locations at different rates.

    At (L1) it will always be there, and at (L2) it will have a 1/2 chance of appearing there.


    As if you decided to flip a coin, and it landed on either heads or tails, this determined whether the vehicle spawned at that location or not. (L2)

    If wanted added a third location, and we want it to have a 1/3 chance of appear there. We would adjust the spawn rate for the third location (L3) to be 33 because 100 divided by 3 is èqual to 33.

    Specifying all locations (in this instance there are three) to have the same rate of spawn this could be done by simply selecting the Change All menu option in the Vehicles -> Locations menu.


    So what is the probability item I see in the locations menu used for?

    By default, probabilities are used for deciding which vehicle to select in the occasion that there are more than 1 vehicle in a group.

    In this explanation both vehicles have the same rate of spawn. [Spawn Rate =100]

    If the first vehicle [infernus] has a probability of 100, and the second vehicle [banshee] has a probability of 10. The first vehicle has a 10 out of 11 chance of being chosen, and the second vehicle has a 1 out of 11 chance of being chosen, which would cause the second vehicle to be a lot rarer to see spawned. The same thing would occur if the first vehicle had a probability of 90, while the second vehicle had a probability of 10. That creates a 9/10 and a 1/10 probability for selecting either vehicle, though both vehicles spawn at a spawn rate of 100%. Lowering the spawn rate, will cause the vehicles to spawn a lot slower, but with the same probabilities. I hope that makes sense.

    This confuses me, could you explain this any better?
    For probabilities the script generates a random number from 0 to the total sum of all probabilities for all locations in the group. Since we have two locations with probabilities of 100 and 10, the sum is 110.

    What happens is that`the script continuously generates random numbers based on the spawn rate, and if the random number is greater than 10 here, the other vehicle ends up being chosen. The spawn rate basically controls the speed of the script.

    The Spawn Rate controls how often the vehicles spawn.
    The Probability controls which vehicles are chosen to spawn.


    For the most part, you don't need to worry about probabilities. This is a very advanced feature that can be used along-side spawn rates, which work very differently.

     
    Extensive Testing has revealed the script to be for the most part very very stable. We have not encountered many bugs or issues that require fixing. We're still doing testing to ensure that this statement is factually true.


    FAQ

    My vehicles aren't spawning!
    Make sure your vehicles have a spawn rate greater than 0, for testing purposes set it to 100 to ensure that the vehicles spawn very rapidly, all probabilities should be 100 by default, and is a more advanced feature for adjusting vehicle selections.
     
     
     



  • Thread Updated.

    0.20 Release today.



  • 0_1498194813456_upload-61739b0d-0b01-4786-b8fb-6718edf4c7c4

    Here's version 0.2.2 in action. I just started setting up some shipyard car spawns.

    I have the locations named left to right like so. L1, L2, L3, L4

    @AHK1221

    :D


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.