4.3.2015

LASERS, SHIELDS, PLANETS – POLISHING YOUR SCI-FI ARSENAL

By Vasiliy Tedeev

Snowforged Entertainment was founded in a small mountain cave on the outskirts of Siberia. Run by a tight crew of brown bears and one human, the team is currently working on Starfall Tactics – a real-time wargame that allows you to assemble your own spaceship flotilla, customize each individual ship and test your designs against skilled opponents. 

Being PC Gaming enthusiasts, our team has been harboring a dream of creating hardcore and unconventional games for some time. We were not letting technological limitations get in the way. Unreal Engine 4 has made things much easier by allowing us to get the project going almost immediately. 

In this article, we’ll discuss how to ensure that some of the basic tools in your sci-fi arsenal feel just right. Please note that the stuff outlined below is how our team went about solving these tasks. If you have an alternative solution, reply in the comments below, we’d love to hear from you!

"Always look on the bright side…unless you’re holding a laser pointing device."  Unknown

Lasers seem to be one of the most effective weapons in Sci-Fi history. It would be hard to imagine an iconic battle scene from any one of your favourite sci-fi movies without the blinding light of laser shots fired in space.

So for Starfall, our team wanted to make sure that laser weapons not only looked powerful and menacing, but also added to the visual flair of space battles. Somehow, this task wasn’t as straight-forward as it sounded initially.

SF_1

Our programmers chose the Beam Particle System as the go-to solution. Each gun in Starfall is an Actor with a Particle System Component. When a laser beam is fired, the system traces the beam to the target, determines the point of impact and passes it as a parameter in the Particle System of the beam’s target. Then the Particle System Component activates and directs the laser beam to its target.

However, we had two glaring problems staring us right in the face:

Instant light-show

When two test ships started exchanging laser shots, the beams appeared instantly and the line of fire was not clear at all. We tried different solutions. We really didn’t want to settle for a cone-shaped beam. 

So our programmers added a finite value of speed to the beam’s propagation (check the Speed parameter in the Beam type data module of the Particle System). But the trick is to leave this value high enough so that, with decent FPS, the distribution of the laser beam fits neatly into a few frames. Thus, we’ve finally achieved the right effect - the beam appears instantly, but you can follow its direction easily.

SF_2

Mega beams

If you make a laser beam wide enough to be visible from a long distance, then don’t be surprised that it looks larger than the Great Wall of China when zoomed in. Imagine a spaceship firing a laser thicker than its hull. Weird, right?

However, making "realistic" lasers results in ships firing tiny, narrow stings of light at each other. That doesn’t look epic by anyone’s standards!

At first, we tried to solve this problem by modifying the LOD (Level of Detail) setting in the Particle System. Unfortunately for us, the transition between the different LOD levels was clearly visible - the beam changed its thickness and size almost instantly. 

After some tinkering (and much swearing), we’ve solved this problem by using the beam's material:

SF_3

The beam’s thickness varies continuously depending on the height of the camera, with respect to the plane. Mission accomplished!

SF_4

“An invisible wall of super condensed jelly would make a great shield to stop bullets and sarcasm.”  Jarod Kintz 

Energy shields in sci-fi are the equivalent of swords and magic in fantasy books. They are everywhere - from games, to books, to movies and TV series. That doesn't mean that shields are uniform across the board, however. Some shields "stick" to the surface of an object, others resemble a protective "egg" that surrounds the host. There are also shields that absorb all incoming projectiles, while other variants simply bounce them back at the attacker. 

In terms of gameplay and mechanics, all of these options have their pros and cons. For Starfall Tactics, we went with the classic invisible "egg" shield wrapped around a spacecraft. The shield absorbs incoming projectiles and flashes at the moment of impact in order to provide feedback to players.

SF_6

Initially, we decided to make a shield mesh that would wrap around the ship. Turns out that dragging an additional mesh after every single ship, with collision enabled, is not a good idea. On the second attempt, our programmers replaced the mesh shield with a Capsule Component. This option achieved the same goal with a substantially lower collision overhead.

To represent the effect of a shield flashing upon impact, an Actor is spawned at the point of collision. The Actor consists of a static mesh in the form of a hemisphere with a material depicting the shield effect. This hemisphere stretches depending on the normal to the surface of the capsule and the ship's size, right at the point of impact:

float Yscale = FMath::Abs(FVector::DotProduct(DamageEvent.HitInfo.Normal.SafeNormal(), this->GetOwner()->GetActorRotation().Vector().SafeNormal()));

Yscale = FMath::Lerp(this->CapsuleRadius * 2, this->CapsuleHalfHeight * 2, 1.0f - Yscale);

ShieldEffect(DamageEvent.HitInfo.Location, DamageEvent.HitInfo.Normal.Rotation(), FVector(this->CapsuleRadius, Yscale, this->CapsuleRadius));

As a result, players are left with a distinct feeling that the shield "clings" to a ship. This worked out pretty well and our team is looking forward to experimenting with the other shield types in the future!

SF_7

“Could it be that planets are castaway heads."  Visar Zhiti 

 

Ah, planets - the jewels of space!

Our 3D artist's goal was to create a planet with aurora borealis (northern lights) over the entire surface. Our own Earth can be seen covered in a beautiful, mystifying green light. The effect is caused by solar winds (containing electrically charged particles) hitting a planet's atmosphere. 

SF_8

We decided to achieve the desired effect via materials. The set-up is relatively simple: a planet with a standard texture and a green(ish) halo. The halo's image is a collection of a large number of lines spaced evenly around the circumference, used in conjunction with a special opacity mask.

Despite our best efforts, the planet looked like a lifeless emerald ball. No static object can express the majestic glow of aurora borealis. The light is always moving, shifting as if it's a large, friendly amoeba. 

The solution was to make the halo slowly rotate and to scale the animation using the cosine function. To add volume - we used not just one, but three planes with light and placed them at slightly different angles. 

Now we were getting somewhere! To prevent the waves of light emanating from the halo from moving in sync (which looked unnatural), we added a new parameter that was determined by a random value from the planet's blueprint.

SF_9

Using the material, we set the planet's constant rotational speed and added more volume via Fresnel. Our 3D artist seems to think that volume is similar to explosions - they make everything better.

SF_10

Time for the finishing touch! The planet was gifted with an atmosphere that lit up the darker areas of its surface beautifully. This was achieved by duplicating the planet's mesh, enlarging it slightly and applying a different material. 

To add more radiance, we used Base color and relied on trusty old Fresnel to make sure that only the edges glowed, without obscuring the view of the planet itself. The final step was adding bumps and dents to the planet's surface via a normal map.

SF_11

And the planet was finally born! 

SF_12

Note: it looks much better in motion :)

“There is no real ending. It's just the place where you stop the story."  Frank Herbert 

I hope this article shed some light on our team's approach to creating and tuning the basic elements of almost any sci-fi game. Starfall Tactics is slowly emerging from the fragments of our vision right into reality. The game is currently in the advanced prototype stage, and we are looking forward to sharing more information with you as the development moves further. 

To stay in touch and follow the game's progress, please visit starfalltactics.com

Over and out! 

Recent Posts

Get Set for the Summer #ue4jam!

Get ready to buckle down and put your development skills to the test! Ne

...

Unreal Developers Shine at Develop:Brighton 2018

Numerous developers displayed their titles in the Unreal Networking Lounge ...

Unreal Powers On-the-Fly Compositing with Handheld Camera

Going beyond green screens: ARwall’s rear-projection system provides in-cam...