Opened 11 years ago

Last modified 3 years ago

#1857 assigned defect

Restrict unit spawning for some structures

Reported by: historic_bruno Owned by: Anil Eapen
Priority: If Time Permits Milestone: Backlog
Component: Core engine Keywords: simple
Cc: Patch:

Description (last modified by Anil Eapen)

Currently when a unit is trained or ungarrisoned, the game's unit spawning logic checks for available spawning points all around the structure. But wall towers have a defined "inside" and "outside", and it's annoying if your units unintentionally spawn outside the city wall.

We should be able to restrict this to a more limited angle/area with some data in the entity template, and/or control it with rally points (have the spawning point begin on the side closest the rally point).

Change History (13)

comment:1 by Beau, 11 years ago

Owner: set to Beau

comment:2 by scythetwirler, 11 years ago

This also helps when the spawning point happens to be on the one side surrounded by trees, which traps larger units.

comment:3 by mimo, 10 years ago

The present behaviour makes sense to me: there is a preferred direction for spawning which is the one the building is facing to, which should be the one of the door. That looks more logical than the one closest to the rally point. It's up to the player to rotate the building in its desired direction when building it. Wall towers are nonetheless a bit special as they do not have doors to show this preferred direction. A solution would be to add doors to them. But another possibility could be to add an arrow or some other visual effect which would indicates the preferred spawning direction when placing the foundation.

The possibility to restrict the possible angles around this preferred direction could still be useful.

comment:4 by scythetwirler, 10 years ago

I do agree with the doors now, but large units still get trapped when batch trained. Perhaps if a spawning point (besides the door) will trap a unit, the engine should find another spot? If there are no spots that wouldn't trap the unit, the engine could display the "Can't find free space to spawn trained units message".

comment:5 by sanderd17, 10 years ago

There's a patch somewhere by me that adds the possibility to spawn to a certain location, relative from the entity (a certain distance from it, on a certain side). mimo, if you want to work on it, that patch isn't quite fixed, but it could give you some starting points. Btw, Greek walls do have doors, but the doors are facing the wrong side.

@scythetwirler, what do you mean with "getting stuck"? That's most likely a different issue.

Last edited 10 years ago by sanderd17 (previous) (diff)

comment:6 by mimo, 10 years ago

But my comment was rather: do we really want it ? I'm not sure we want to be able to spawn everywhere. The present behaviour to spawn near the building entrance looks better to me. So the point is rather to have, while positioning the foundation, a way to visually indicate where units will be spawned so that the user can rotate it if necessary.

Then, if for some buildings, doors are facing the wrong direction, better to fix it. Or we can add a new element in CCmpFootprint which would give a delta angle between the spawning point and the building direction (at present, the initial spawning direction is taken as the building rotation).

comment:7 by scythetwirler, 10 years ago

@sanderd17 Sorry, I wasn't clear. I was referring to fortresses that can produce large footprint units (such as rams) that could get trapped by trees where infantry and cavalry can pass through gaps.

comment:8 by sanderd17, 10 years ago

@mimo, we probably want a way to set a spawn point, but only when enabled in the templates (like for the siege tower, the ability to ungarrison over walls). The angle could also be nice, but sometimes not good enough. If you build a wall in a 90° angle using the in-game placement, you'll always end up with half of the units garrisoning outside the wall.

In any way, it requires some thinking, and most likely some demo implementations.

comment:9 by historic_bruno, 10 years ago

Owner: Beau removed

comment:10 by Anil Eapen, 6 years ago

Description: modified (diff)
Owner: set to Anil Eapen

comment:11 by Anil Eapen, 6 years ago

Status: newassigned

comment:12 by Silier, 3 years ago

Keywords: simple removed
severity: simple

comment:13 by Silier, 3 years ago

Keywords: simple added
Note: See TracTickets for help on using tickets.