Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer not to spawn within 20 meters of enemy #512

Merged
merged 9 commits into from Sep 2, 2023
Merged

Conversation

fvnkhead
Copy link
Contributor

@fvnkhead fvnkhead commented Oct 5, 2022

I noticed the IsSpawnpointValid function checks for nearby projectiles, but not enemy players. Spawning next to enemies is common enough with a high player count, so this should alleviate the issue. I ran this for about 2 weeks before taking a break from hosting, and during that time, nearby enemy spawns would only occur when running out of valid spawns (eg. on Colony with a high player count, or on LF maps).

Also parameterized the minimum distance into minEnemyDist, which is used for checking both projectile and enemy distances, and this has been increased from 600 to 1000 (which is about 20 meters by my calculations?)

Formatting is screwed, I don't know what settings to use for squirrel with vim and they vary across files.

@Erlite
Copy link
Contributor

Erlite commented Oct 5, 2022

Pretty sure the projectile check isn't very robust either. I can't tell how many times I've spawned inside a cluster missile or killed people that way.

Awesome PR though!

Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com>
@ASpoonPlaysGames
Copy link
Contributor

Btw some of the spawn issues that happen are due to that spectator mod, there is a bug with it that spawns you at an enemy team's spawn. Unsure who made the mod though

@fvnkhead
Copy link
Contributor Author

fvnkhead commented Oct 5, 2022

Btw some of the spawn issues that happen are due to that spectator mod, there is a bug with it that spawns you at an enemy team's spawn. Unsure who made the mod though

I didn't have that issue but I had spectate-after-killcam disabled, whereas V3X had it enabled, and the bad spawns occured there a lot more often.
It's faky's mod I think

@ASpoonPlaysGames
Copy link
Contributor

Btw some of the spawn issues that happen are due to that spectator mod, there is a bug with it that spawns you at an enemy team's spawn. Unsure who made the mod though

I didn't have that issue but I had spectate-after-killcam disabled, whereas V3X had it enabled, and the bad spawns occured there a lot more often. It's faky's mod I think

On the V3X server I can consistently spawn in the enemy spawn, the bug is 100% reproduceable, I'll talk to faky

@Erlite
Copy link
Contributor

Erlite commented Oct 5, 2022

Eh, even on Vanilla servers. An example would by Drydock, the little bridge part where the evac ship can spawn sometimes. I've had people spawn behind me a split second after spawning.

There really shouldn't be a specific spawn location for teams, it should just rate them all and find the safest one. Maybe go for spawns near teammates that aren't too close to enemies primarily.

@fvnkhead
Copy link
Contributor Author

fvnkhead commented Oct 5, 2022

Maybe go for spawns near teammates

I did something like that on my pvp server, if I get back to hosting I can experiment more.

Co-authored-by: uniboi <64006268+uniboi@users.noreply.github.com>
Copy link
Contributor

@uniboi uniboi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Contributor

@uniboi uniboi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mfw I clicked the wrong box

Copy link
Contributor

@uniboi uniboi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should also fix spawning near projectiles but I can't test

@fvnkhead
Copy link
Contributor Author

Btw what are the two TEAM_ANY -parameters? I'm wondering if one could just return enemy ents directly and checking for len(), instead of doing a loop.

@uniboi
Copy link
Contributor

uniboi commented Nov 16, 2022

I don't think there's a way to do that? Correct me if I'm wrong but I think this can get merged either way

@x3Karma
Copy link
Contributor

x3Karma commented Feb 27, 2023

Btw what are the two TEAM_ANY -parameters? I'm wondering if one could just return enemy ents directly and checking for len(), instead of doing a loop.

checking some other code, as far as i can tell, the second TEAM_ANY can be replaced with the player's team so it would automatically sort by enemies like this:

 int team = player.GetTeam()
 array<entity> nearbyEnemies = GetPlayerArrayEx( "any", TEAM_ANY, team, origin, radius )

My guess is that the first TEAM_ANY would include a list of all entities from this team, which is any team, and the second team would be the exception, which means the array will exclude entities from team.

However, this assumption doesn't seem quite right if you use
array<entity> nearbyEnemies = GetPlayerArrayEx( "any", TEAM_ANY, TEAM_ANY, origin, radius )
as it should exclude every single entity from every single team?

Copy link
Member

@F1F7Y F1F7Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Didnt test in-game

@flifloa
Copy link

flifloa commented Apr 4, 2023

Some kid on the northstar chat screamed for this months ago and started an argument over the spawn mechanic.

@F1F7Y F1F7Y added the almost ready to merge Apart from any small remaining other issues addressed by other labels, this would be ready to merge label Apr 20, 2023
Copy link
Contributor

@ASpoonPlaysGames ASpoonPlaysGames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good, can't hurt

@ASpoonPlaysGames ASpoonPlaysGames added READY TO MERGE This mergeable right now and removed almost ready to merge Apart from any small remaining other issues addressed by other labels, this would be ready to merge labels Sep 2, 2023
@F1F7Y F1F7Y merged commit c7e50b2 into R2Northstar:main Sep 2, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
READY TO MERGE This mergeable right now
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

7 participants