Wednesday, November 23, 2022
HomeIndie GameAvaruustaistelupeli (ATP) - an area fight recreation

Avaruustaistelupeli (ATP) – an area fight recreation


mobilelast


Despite the sluggish begin, this week ended up fairly productive. I began designing and implementing a brand new audio background which has no direct impact on the gameplay, however which undoubtedly provides temper.

Below is an audio clip from the ship choice, participant introduction, countdown and battle. I’ve discovered it helpful to generally solely hearken to the sport with none visible distractions. Audience atmosphere wants extra variation and a few parts are clearly out of steadiness, however I’d name this a superb begin. Audio already reacts to the sport occasions: gamers and destroyed ships are cheered, boring gameplay will get booed, mishaps trigger laughter and many others.

https://soundcloud.com/ludovic_petunia/atp-audioclip-2872022

Most of the ambiences and results are taken (and often additional modified) from two asset packs: Ultimate Sound FX Bundle and Universal Sound FX. As selection is the important thing for a vivid audio background and most sounds should have a number of variations to randomly select from, these two match to my wants.

Some sounds I recorded myself. Announcements are impressed by the practice station scene of “Les Vacances de Monsieur Hulot”, and, in fact, you possibly can’t have a correct area recreation with out organ music. I haven’t actually been taking part in for ages, so it was enjoyable to improvise.

Beside this audio factor, I’ve made a lot of miscellaneous fixes, enhancements and balancing in addition to taken a while to experiment with Unity’s baked lighting and multi-scene workflow. Both are fairly unknown stuff to me, however they need to be one of the best ways to make enviornment stands fancier. So tons extra about that later.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


Allright, time for half two of my lighting adventures. As my so-called workflow consists primarily of trials and errors, explaining it’s fairly onerous. But I’ll attempt to give a shallow rationalization.

As I implied in a earlier publish, I discovered stadiums to be a superb candidate for baked lighting since they’re just about the one static components within the recreation. Stadiums are available in three sizes, and every one among them should have two variations: one with lights on (used throughout ship choice and outcomes screens) and one solely lit by the solar (used in the course of the battle). Below are some photographs of the present fashions, lights on and off.

Before the precise lighting, I used to be pressured to do some critical refactoring. My lights and light-weight settings had been in every single place, and a few directional lights had been already on baked mode; I don’t know how they had been even working. So for starters, I corrected the sunshine sorts, removed some out of date gentle sources and renamed all objects appropriately so as to make the most of Unity’s gentle explorer.

The stadium fashions took some refining additionally. I attempt to keep on with the WW1-style, and 1910s stadiums had been tough locations. But nonetheless, to satisfy even probably the most rudimentary security requirements, I used to be pressured so as to add handrails in addition to inexperienced lights to point out the exit. And in fact I had so as to add the lights themselves to the ceiling and contained in the bins.

As far as I do know (and proper me if I’m unsuitable), Unity can solely bake one set of sunshine maps per scene. This pressured me to desert the sooner stadium prefabs and begin utilizing a multi-scene workflow. It’s a superb time for working towards: if there have been others working with the challenge, the multi-scene method could be virtually obligatory. I created six new scenes: gentle and darkish variations for every three arenas. These can now be loaded additively when the background enviornment is required in different scenes.

Adjusting shadow map resolutions was fairly time consuming at begin, however I managed to determine an easy workflow. I begin by ramping up the lightmap decision in lighting settings till probably the most seen and necessary geometry is correct sufficient. Then I cut back the “scale in lightmap” -values (discovered within the MeshRenderer part) of the opposite fashions as little as attainable throughout the required accuracy. With filtering on, the resolutions could be stored surprisingly low, which reduces the baking time. Below is the picture of the sunshine maps I’m presently utilizing.

Another tough activity was to arrange the sunshine probes for the dynamic objects (there will likely be spectators sooner or later, in any case). Unity’s personal instruments are fairly dangerous particularly for putting the probes in round kinds. I ended up making a helper editor script and putting probes procedurally. End consequence works surprisingly nicely. Image beneath exhibits the probe positions.

And right here’s how they lit the placeholder spectators in gentle and darkish arenas.

I’m already fairly happy with the small enviornment, which was the primary one I did; I nonetheless have to do the identical issues for medium and huge stadiums. Luckily, most components of the bigger stadiums are simply scaled (or pulled/pushed in Blender) variations of the small one, so that they share the identical textures and UV-mappings. This signifies that all arenas use the identical supplies, and there shouldn’t be a lot work left after the small stadium is perfected.

The actual problem is to animate the group. Regular skinned animation is approach too sluggish for 1000’s of meshes, so all types of GPU trickery will likely be wanted. More about it later.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


The stadium is sort of prepared for the viewers, however sadly massive crowds have a unfavorable impact on efficiency. This is especially on account of two causes: having a skeleton hierarchy for every spectator leads to an enormous variety of dynamic recreation objects, and Unity’s batching doesn’t help skinned meshes. These trigger an enormous CPU load to cope with.

Solution is to animate meshes on GPU (in shaders), and use the batchable MeshRenderer as a substitute of its skinned variation. Unity doesn’t have a built-in device for this, so I made one myself. I wrote a tough editor script that reads vertex positions of skinned mesh on every body and shops them right into a texture. A customized shader then repositions vertices in run-time by studying the positions from that texture.

As I used a shader graph and my baker utility class could be very specialised for my wants, it’s onerous to share any helpful code simply but. But for those who’re , I discovered this article and this repository helpful.

As a place to begin, operate AnimationClip.PatternAnimation units the mesh into a correct pose at a given time, and SkinnedMeshRenderer.BakeMesh can be utilized to extract the mesh knowledge at that second. In the shader, the vertex index is saved within the built-in variable vertexID. An attention-grabbing discovering is that for those who retailer every keyframe on a separate texture row, bilinear filtering will robotically deal with the animation mixing (see the article linked above).

Resizing the feel to power-of-two (not essentially required in desktop growth) was a surprisingly complicated job that required an exterior render texture (or I’ve simply missed some too apparent utility operate). Here’s what I’m doing for texture scaling (observe the feel format that’s wanted for storing unfavorable values with first rate precision):

public static void ResizeTexture(Texture2D pTexture, int pWidth, int pHeight) {
    var rt = RenderTexture.GetTemporary(pWidth, pHeight, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Default);
    RenderTexture.energetic = rt;
    Graphics.Blit(pTexture, rt);
    pTexture.Reinitialize(pWidth, pHeight, TextureFormat.RGBAHalf, false);
    pTexture.filterMode = FilterMode.Bilinear;
    pTexture.ReadPixels(new Rect(0f, 0f, pWidth, pHeight), 0, 0);
    pTexture.Apply();
    RenderTexture.ReleaseTemporary(rt);
}

In the tip, animation baking wasn’t almost as complicated as I feared, however resulted in some hilarious glitches. During the primary makes an attempt, fashions distorted closely and made the viewers seem like a horde of lovecraftian monsters; sadly I did not file a video of it. Of course there’s nonetheless tons to do. Instead of repeating an identical gestures, every spectator wants particular person variation, so mixing of various animations at totally different speeds per particular person is required; this may in all probability introduce some batching points. I additionally have to bake normals and tangents and resolve smaller points with digital camera frustum culling (in all probability associated to AABB calculation). But at the very least I now have a strong base to construct on, already capable of run 1000’s of animated spectators with out a noticeable FPS drop.

I might make a prolonged weblog publish in regards to the topic. Perhaps I’ll sooner or later. Writing in regards to the course of appears to be slower than the precise implementation, so hopefully somebody finds these useful.

Besides the GPU magic I’ve additionally improved the background of the shipyard, experimented with GUI design and ACES tone mapping (I’ve to spice up up all these baked lights…) and many others. I’ll come again to these within the upcoming posts.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


I had a little bit flu, so final week wasn’t superb for something that requires pondering.

So, I did a couple of boring jobs that simply needed to be completed: created bigger enviornment fashions by scaling the smallest one, and utterly re-organized the binaries, prefabs and supplies in my challenge hierarchy; hopefully it will likely be simpler to truly discover one thing sooner or later. It was additionally a superb time to refactor cameras and idiot round with post-processing.

I’ve all the time thought that the looks of the sport wants deeper contrasts, and the emissive lights must be introduced up extra with out interfering with the previous, industrial look. I made a decision to change the impartial tone mapping to ACES, because it ought to give higher distinction and extra room for changes. It tends to make the general picture darker, so I brightened up the lights and re-baked static shadows. I additionally added a secondary directional gentle to the battle scene so as to convey out the meteors and different areas shadowed by the solar (correct ambient lighting may do the identical trick, however I wasn’t capable of make it look nearly as good). ACES boosts saturation, so I introduced it down a little bit in a shade grading. It is difficult to see objectively if the adjustments are for the higher or worse; I’ve to arrange a recreation testing workshop to see if the brightness is OK and colours could be clearly seen.

The solely downside I got here throughout was that Unity’s publish processing all the time units alpha values to 1. This prevents transparency, which in flip causes issues when rendering ships to GUI widgets by utilizing render textures. A customized shader might be wanted.

This will naturally lead me into the subsequent activity: bettering UI graphics. Admittedly, I solely have a imprecise concept of what I’m after, however let’s see the place it goes.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


The recreation (and particularly the screenshots) appear too darkish. So though it’s onerous to get the brightness proper objectively, I modified the ambient shade to gentle grey and elevated gentle intensities. I intentionally set the scene to be overly lit, as it’s simpler to scale back the brightness in publish processing than enhance it.

As lighting impacts how the totally different materials layers work, I needed to regulate them a little bit. I spent a superb whereas re-organizing supplies so as to simply export textures from Substance and take a look at them in Unity. And after a couple of curse phrases, I managed to bake brighter variations of all arenas.

I additionally improved and changed most of the particle results. New explosions and smoke are already trying fairly neat. As I’ve by no means preferred Unity’s particle system editor, I’ll in all probability be utilizing solely VFX graphs sooner or later.

Unfortunately my formidable GUI experiments weren’t as profitable. I’ve to take one other method and see the place it goes.

But subsequent I must repair some issues with the sport controller dealing with so as to prepare testing workshops. More about these within the subsequent publish. Test periods often reveal a ton of gameplay-related bugs, so I can then put graphics apart for some time.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


Controller points are way more complicated than I anticipated, I appear to search out two new issues for each fastened one. Frustratingly, it appears that evidently every time I replace Unity’s enter system to a more recent model, one thing will get damaged. Here’s a fast abstract of issues I’ve handled in the course of the previous two weeks.

Composite keyboard controls (WASD) stopped working once I up to date Unity and its enter system after the earlier launch (to Unity 2021.3.4f1 and enter system 1.3.0, if I interpret the model historical past accurately). In case somebody experiences the identical, I needed to set the management to “pass through” so as to make it work.

Similarly, the controller’s shoulder (or bumper, whichever you favor) buttons didn’t work anymore in battles. In GUI they do work. Pass by -trick didn’t work right here, so lastly I simply downgraded the enter system to 1.1.0, which fastened the difficulty.

Gamepad scrolling within the shipyard didn’t work after the newest ATP launch both. Even downgrading the enter system doesn’t repair this, which has left me clueless. It appears that my digital mouse implementation (the code I posted nearly a 12 months in the past) causes conflicts between the precise system mouse and occasions I ship. This aborts dragging prematurely. I truly bought the dragging work by making a digital mouse system as a substitute of calling system mouse straight, however now I’m unable to make use of gamepad and mouse concurrently, which makes this resolution ineffective for me (Unity’s reference implementation has the identical limitation). Enabling/disabling the digital mouse relying on the final used system may work. I’ll strive that sooner or later.

As this wasn’t sufficient, there have been issues with the {hardware} as nicely. Crosshair jumped surprisingly when managed by the gamepad’s joystick, and I spent a number of hours adjusting useless zones, filtering noise and many others. with out impact. After some time, I began getting suspicious and tried one other controller. Everything labored advantageous. https://gamepad-tester.com/ proves that the difficulty actually is within the controller:

I don’t really feel like combating with controls proper now, so I’ll in all probability simply implement the frequent controller navigation to the menus (which was on my TODO checklist anyway), and use digital mouse solely within the shipyard (if I get it to work). Mouse is virtually obligatory within the shipyard, so I gained’t be prioritizing this very excessive.

But it’s not all work with out enjoyable. Our first spectator invited his brothers to cheer me up (or mock me, resolve your self). More in regards to the crowd sooner or later posts.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


More and extra spectators are coming in. And though there’s nonetheless room for optimizations, I haven’t seen a exceptional efficiency drop even with full stands. It is difficult to explain the technical course of with out being boring, however I’ll strive. I might also share the baking utility and shader sooner or later, if I discover time to scrub it up and change the ugly hard-coded components.

I began by modeling an especially low-poly spectator in Blender, then creating a number of totally different go well with textures for it in Substance; colours precisely match the lads’s style in the course of the 1910s. Women’s clothes from that period is way tougher to mannequin, so sadly girls are solely allowed in trousers and pretend mustaches for now.

Next I imported the mannequin into Mixamo, rigged it, and exported all types of animation clips that spectators may do.

In Unity I wrote a utility script that bakes clips into one sequence, and writes vertex positions and normals into textures. Extra variance is achieved by altering clip order. These textures are then given to the particular shader that performs the mesh deforming in GPU.

Spectators might not look significantly good-looking by themselves, however their power is in numbers. Animation sequences and clothes textures could be joined freely so as to get an exponential variety of combos. It could be tedious to do that by hand, so I wrote one other script that creates materials for every cloth-animation-combination with various tint and animation pace. Script additionally helps totally different fashions, permitting girls, kids, monsters or no matter I’d mannequin sooner or later. But that’s not my important precedence proper now. Here’s the present scenario:

Besides this, I hosted take a look at periods over the last week. Those would be the topic of the subsequent publish. So one thing in regards to the gameplay itself, for a change.


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


A delayed abstract of our testing session on 28.10. There had been surprisingly few points, and AI-opponents had been way more stable-minded and fewer suicidal than earlier than. I collected a number of the cooperative battles in a video.

Of course, there’s all the time room for enchancment.

  • Missile flame particles had distracting gaps, which could be consistently seen in movies. I managed to repair this by feeding the missile’s world coordinates to each “Spawn Over Distance” and “Initialize Particle Strip” parts within the VFX graph. Not certain if it is a correct approach, although.
  • Mine explosions brought about an enormous shock wave that threw ships across the enviornment and doubtless broke the collision detection (time 2:48 in video above). This was in all probability due to a typo: the explosion power was ten instances too sturdy. But some sort of gravitation weapon could be a pleasant function…
  • Stalemate buoy look brought about a complicated leap in digital camera focusing. Now the viewport must be tweened correctly.

We additionally fought a grand, eight-ship match with two people and two AI pilots. Here’s an uncut video of the match to show the sport stream and totally different ship designs. You can skip the ship choice components from bookmarks.

https://www.youtube.com/watch?v=Okay-MeGf84ruI


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here

mobilelast


Some of the pc opponent’s stupidities have been bothering me for a very long time. Although AI performs reasonably nicely in micro-level (goals fairly precisely and even has some creativity with particular modules), it utterly lacks strategic pondering by taking silly dangers and losing ammunition in innocent conditions. The actual problem is, that AI must be much less aggressive and suicidal, however not too cautious. Otherwise battles have a tendency to finish up in a scenario the place AI refuses to do something.

I made some enhancements to make issues higher:

  • AI is now higher at calculating its close-combat power relative to opponents, and benefiting from it. It is aware of to maintain the space to stronger ships and rush in direction of weaker ones.
  • Bonus objects aren’t prioritized as excessive as earlier than. AI is much less keen to succeed in them when the win is already readily available.
  • AI has had an inclination to shoot bonus objects with cannons for no cause. I believed I had fastened this a number of instances, however it all the time stored coming again. The remaining (hopefully) repair required a much bigger refactoring to the AI structure.

My AI code is split into three components that may be executed concurrently: motion, cannons and particular features. The division is obvious and works nicely, however higher cooperation between the parts is required. For occasion, the bonus object concern was as a result of the AI first aimed cannons, however then tried to draw the bonus with a tractor beam. The latter habits re-positioned the crosshair, which made cannons shoot within the unsuitable place. Luckily, capturing solely takes one body, so it was sufficient to inform secondary modules to carry on till the cannons are completed. Once once more, I take into account this fastened. Expect to listen to extra about comparable points sooner or later.

I discovered it onerous to visualise this topic, so right here’s an unrelated image of a drunken spectator about to fall down the steps:


Logged

Avaruustaistelupeli (ATP) – an area fight recreation
– Free obtain from itch.io or IndieDB
– Dev diary right here
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments