Advertisement

Where to start on concept and design advice.

Started by April 22, 2018 10:07 PM
8 comments, last by Anthony Serrano 6 years, 7 months ago

Hello forum,

I have some decent amount of experience in Unity making games for Software Engineering projects in college, these were very specific projects however and I still am fairly new to building games. I wanted to make a game that uses the shadows of objects for collision detecting (i.e. shooting a gun at a characters shadow causes that character damage. What is the best engine to do this in (game will be 3D), and does anyone have any advice on how to approach this concept? I consider myself fairly experienced in programming, but game dev is just an entirely different beast.

I can't help you with what you're asking for, but I will say what you're wanting to make sounds really cool.

Advertisement
2 hours ago, Awoken said:

I can't help you with what you're asking for, but I will say what you're wanting to make sounds really cool.

Yeah, I really like the idea, but the implementation sounds absolutely terrifying

This will be very difficult to perform well because you not only need to process real-time shadows but also handle shadows as if they have physics attached to them. I cant imagine that something like Unity will handle this in a performing way but I found something that might help you getting started

https://forum.unity.com/threads/procedural-static-point-lights-with-source.349155/

 

How about trying to cast a ray from your light source to the bullet and check if the player is hit right before the bullet and the next hit (this is where the shadow is cast) is close to the bullet (no hit means no shadow or the skybox was hit).

With these measurements you can check if the bullet is close enough to the shadow to register a hit and process it as if the body itself has been hit.

You can even use the hit on the player to know where the bullet hit the shadow since position hit on the shadow should map with the position on the model.

The problem will not be to get some hits in my opinion but how to get an accurate result. Assume you have a dynamic cast shadow, you need to transform the shadow to the ground and however get the data back into your client code from hardware on each frame to map that into an object that could get physics applied to. I could imagine that this would take a huge performance impact if it gets too dynamic or too huge in scale because the shadow mesh has to fit the level geometry unless you want it to look really horrible

Advertisement

Do you even need to handle the shadows in the calculations?

You could as I said simply cast a ray from the light source to the bullet when it hits something and see if the ray hits the player right before the bullet.

Of course this only works with one light source realistically but it should be fairly accurate (accurate enough for a game).

Otherwise you would have to check for every shadow from every light source which include shadows that do not show up because they are illuminated by a different light source.

 

Given his experience level and the concept being a bit shallow, he should concentrate on getting the core idea of the game (shooting shadows to hit entities) in a more easy or at least solid way done.

I still think the idea is awesome and could be a really great game.

Maybe start writing a design document and put down a few more infos for others to contribute before going for the best solution.

It could be that the best solution for hitting a shadow is not the best solution for your game.

 

On a side note: Shooting the shadow can be fun for multiple players but keep in mind that AI does not necessarily see the shadows and won't shoot them. Coding an AI that is aware of all shadows might be the harder part than the shooting of the shadow itself.

This will be very difficult to perform but i wish you good luck )

Probably the best way to do this is, when a projectile collides with an object, cast a ray from the collision point to each light source - if the ray intersects a character, they've been hit.

If you have AI characters, just run this logic in reverse for targeting - cast a ray from a light source through the intended target, and where that ray lands is where they aim.

This topic is closed to new replies.

Advertisement