Collisions and weapons

posted in Blue stain for project Shoot
Published February 04, 2016
Advertisement

Hi,
After quite some time, here comes a new video showing a very early sample of collisions and weapons. What you can see in the video is the player shooting missiles bursts. An enemy spaceship is destroyed by one and others are colliding with a building.

The collisions: in Blender, I define a bounding sphere using a spherical "empty" that allows to specify the location and size of the volume. If there is none defined, a default one is created in the exported file. The game code is meant to accept a hierarchy of bounding spheres but it is not needed right now so the implementation is not complete. Various collision checks are done:
- players / [enemy shots, objects of the visible sectors, objects generated by the layers (trees and rocks in the video)]
- players' shots / [objects of the visible sectors, objects generated by the layers]
- enemies' shots / [objects of the visible sectors, objects generated by the layers]
Enemies / objects collisions are not tested as they will be constrained by fixed paths. It will be easy to add if needed later.
I separated the shots objects to ease the updates and limit the collisions checks to do.

The weapons: for now, only simple missiles are present. They are created at a specific location of the parent object and in a defined direction. After that, they will travel in the same direction. Weapons are described in a separated file with: type, fire rate, burst rate, number of shots per burst, maximum ammo and object ID (it defines the geometry, the collision damages, speed, ...). I have then the following organization to describe an object "template":
- an object (let's say a spaceship) has one or more weapons groups
- a weapons group has one or more weapon instances
- a weapon instance has the matrix for relative position/orientation of the weapon on the object and is referencing a weapon (the one from the weapons file)
- a weapon has the type, fire rate, burst rate, ... and is referencing an object (what the shots will be like)
In the level I can now have:
- an object instance (the player's spaceship) that is referencing an object (the spaceship) and that has weapons states
- a weapon state has the current ammo count, the fire timer, the burst timer, the group active state and is referencing the weapon instance

With this, it is really easy to share descriptions of weapons between objects, it avoids too much duplication of data and is easy to customize. I can have weapons groups with different weapon types, the same weapon at different locations on the parent object, it is ready for new weapons pickup (that is in fact a simple weapons group activation), ... In the video, I did only one weapon group with four times the same weapon around the player.

Next things to do: disable the shots when they are going out of the world boundaries (or after some time), make the enemies use the weapons, other types of weapons like guided missiles, lasers. Mines are already available: I just have to set the shot object speed to zero and I can define a large "empty" in Blender to get something like proximity mines for free.
Thanks for reading.

Previous Entry Lights and shadows
Next Entry Pick-ups
6 likes 2 comments

Comments

Eck
It sounds like you have a good handle on the weapon solution. The demo is looking pretty good. I love how the ships' shadows flow across the terrain. Nice work.

- Eck
February 04, 2016 03:59 AM
alfith

Thanks. I hope the weapons system is versatile enough for what I planned. The challenge will be the laser type but I have something in mind to get it fitted in the system.

February 05, 2016 07:40 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

Not my game but...

1467 views

Spaceship update

1793 views

Big WIP

2245 views

Late creation

1314 views

Hidden gold

2132 views

Effects

2347 views

Let's rock

3214 views

Pick-ups

2368 views
Advertisement