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

Making units spawn at the closest possible location to the rally point #16484

Open
Punsho opened this issue May 2, 2019 · 9 comments

Comments

Projects
None yet
5 participants
@Punsho
Copy link
Contributor

commented May 2, 2019

This would make units get faster to the wanted location. Also with it ships wouldn't get stuck behind nYards or sPens because of random chance (happens if they are built next to land).

I want to just get feedback for this as I'm planning to do it my self and don't want to waste my time doing something that isn't going to be merged.

Proposed algorithm:
• When a new rally point is set a boolean is set to false
• When a unit is ready:
1. If boolean is false it would sort all spawn locations by the distance to the rally point and set boolean to true
2. go through the spawn location list checking if they are available, spawn the unit when the nearest possible location is found
3. if no such places are would it would pass it to other production facilities and if none are available it would pause production (not sure how ofter it should recheck)

@matjaeck

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

Doesn't this conflict with the concept of primary production buildings? What's wrong with letting the player set this explicitly?

@Punsho

This comment has been minimized.

Copy link
Contributor Author

commented May 2, 2019

Why would it conflict? It's first calculated for the primary and if all ports are blocked it will check for others

@matjaeck

This comment has been minimized.

Copy link
Contributor

commented May 2, 2019

Ah, ok (sorry, I can't really follow - my bad)

@abcdefg30 abcdefg30 added the Feature label May 2, 2019

@dragunoff

This comment has been minimized.

Copy link
Contributor

commented May 3, 2019

If I understand correctly "spawn points" are the building exit cells. Then it is necessary to calculate the nearest exit only once - the moment the rally point is set by the player.

This seems like a reasonable feature.

@Punsho

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2019

not when it is set but when a unit is built, when a new rally point is set it will only set one boolean to false, some people tend to spam click them so this is done for optimisation

@pchote

This comment has been minimized.

Copy link
Member

commented May 3, 2019

Production can be updated to order exits based on proximity to the rally point. This isn't as easy as you might first assume, as exits may be blocked by other units and the various subclasses also do their own thing.

@Punsho

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2019

I though I addressed this issue, it will sort them. Then go through the list finding the closest non-blocked exit.

@Punsho

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2019

I also don't want to change how it is decided which production facility is going to be producing

Thought it might be an idea worth exploring

@Punsho

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2019

I'm almost done making it. I just need to know where should I place the previously mentioned boolean and the sorted IEnumerable of exits. (I don't want each instance of exit to have them) Then I'll file the pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.