-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
Vehicles, turrets #30
Comments
Vehicles can pose a new problem. Right now there are no entities that are bigger than a single tile, although barely (players are 2 pixels narrower/shorter than the tiles, i.e. 1px leeway on all 4 sides). Small vehicles are definitely easy, but vehicles bigger than a single tile will require changes in the collision logic. This is because currently, collisions are checked ( Same goes for rendering too; if things can collide they also need to be drawn in the right Z order. Now we'd need to sort rendering not just based on items in the current tile, but in a perimeter. |
There's a related issue: go to a proper spacial partitioning system (quadtree etc). That's a lot of work and the benefit is unclear. |
Instead of increasing the search perimeter, one alternative is to use "pseudo references" that indicate the presence, but not the location of an entity inside a tile. This idea may make collision detection faster as well. Tiles currently have a collection of references to entities that are in that tile. This is a one-to-one relationship; entities can only exist in one tile at a time. This complicates collision detection a bit though, because entities at tile boundaries can collide with entities in the neighbouring tile, so the collision search is done on all 8 surrounding tiles as well. This works as long as no entities exceed one tile in size. Instead, in addition to the regular references, we store "pseudo references" as well, and as long as an entity overlaps a tile, it also has a pseudo reference in that tile.
There are some caveats though:
|
C-Dogs is an 8-directional shooter, which is about movement as much as shooting. The 8-directions creates significant blind spots, which is compensated by moving around a lot. Turrets (and vehicles to a lesser extent) worsens this limitation, so to compensate we can:
|
Turrets could be implemented like this, for maximal flexibility:
You could maybe even implement a half-life style health dispenser this way, if you set the bullet damage to -1. |
And, if you at the same time allow bullets to be static map objecs, you could implement shooting drones. |
This feature should probably be split as we built it out in parts. Initially we could build it on top of the custom gun system. E.g. MG emplacement
Turret emplacement
Jetpack
Hoverbike
Motorbike
... |
Went with a different design - vehicles are a special type of actor, and added two references to actors: pilot and vehicle Having vehicles act as actors means minimal changes to other parts of the code. |
i.e. something players can get into, which changes their weapon and/or movement style. Also could add autoturrets, which just don't move.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: