Author Topic: Cars spawn in walls (Montgomery and LS Hospital)  (Read 533 times)

0 Members and 1 Guest are viewing this topic.

Offline Hank_Montgomery

  • Original Gangster
  • *
  • Posts: 593
  • Country: ua
  • Respect: +51/-28
  • Bring 2000 vehicle armor health points back again!
    • View Profile
  • MCNR name: Hank_Montgomery
Cars spawn in walls (Montgomery and LS Hospital)
« on: March 31, 2023, 08:01:50 am »
1:41 in Montgomery
1:49 near County General Hospital (LS)


Offline Goldenman

  • Banned
  • *
  • Posts: 713
  • Country: ir
  • Respect: +13/-32
  • Gender: Male
    • View Profile
  • MCNR name: Goldenman
  • Discord name: goldenboyi
Re: Cars spawn in walls (Montgomery and LS Hospital)
« Reply #1 on: March 31, 2023, 08:05:12 am »
have you reproduced this issue multiple times?

Offline Hank_Montgomery

  • Original Gangster
  • *
  • Posts: 593
  • Country: ua
  • Respect: +51/-28
  • Bring 2000 vehicle armor health points back again!
    • View Profile
  • MCNR name: Hank_Montgomery
Re: Cars spawn in walls (Montgomery and LS Hospital)
« Reply #2 on: March 31, 2023, 11:48:03 am »
have you reproduced this issue multiple times?
Tried to, but they keep spawning on the roads

Offline ARSHIA

  • *
  • Posts: 312
  • Country: ir
  • Respect: +14/-21
  • Gender: Male
  • I was there when Jesus came down from the cross...
    • View Profile
  • MCNR name: ARSHIA
  • Discord name: ARSHIA0133
  • Crew: Ex KoS Gangster
Re: Cars spawn in walls (Montgomery and LS Hospital)
« Reply #3 on: April 01, 2023, 01:14:57 am »
In some places like the gas station near Angel Pine and Bayside as well, In shack columns for example.
« Last Edit: April 01, 2023, 01:27:31 am by ARSHIA »

Offline Mike

  • Server Owner
  • *
  • Posts: 3677
  • Country: gb
  • Respect: +413/-71
  • Gender: Male
    • View Profile
  • MCNR name: Mike
  • Discord name: mp2
Re: Cars spawn in walls (Montgomery and LS Hospital)
« Reply #4 on: April 04, 2023, 04:16:12 pm »
I've improved this in 1.15. It's already pretty good at preventing vehicles spawning inside buildings adjacent to the spawn nodes, however I have now also added line-of-sight collision checks to prevent them spawning inside smaller walls/objects like this.

It will never be perfect but you should see the failure rate massively drop now.

The obstruction testing code has gotten more complex than I thought it ever would lol, here's an inside look at some of the logic (if you can understand wtf is going on congrats):


The logic for the entire vehicle spawning system is something along the lines of:
- Get the node nearest the player.
- If it's too far away (200m, increased to 250m in 1.15), abort.
- If it's near enough, find a node a bit of a distance away (so vehicles don't spawn at players' feet). This is in a random direction but always the same distance (about 300m I think).
- If that's too far away or the height difference is too much, revert back to the node closest to the player.
  - This is to prevent vehicles spawning in underground parking lots, up on bridges etc.).
- If the selected node is an intersection, select an adjacent node (we don't want to spawn vehicles in the middle of an intersection, plus it makes the next step easier).
- From the now selected node, select an adjacent node and work out the road direction based on those two nodes (so vehicles spawn parallel to the road).
- Test the right hand side for obstruction (height difference, collision, other vehicle exists there).
- If that fails, test the left side the same way.
- If that also fails, use the middle of the road, but we also test if a vehicle exists there and if so we abort.

There's probably some other checks that I forget about, but yeah, it's a relatively complex set of checks and rules to try and spawn vehicles in a suitable place and a suitable distance away... it's not just 'pick a random place and hope for the best'.

It's also code I wrote many years ago and keep bolting things onto, so it's kinda like a house of cards held up by hope and wishes right now. I shoud probably rewrite it...
« Last Edit: April 04, 2023, 04:26:28 pm by Mike »
View trailers here.