Sign in to follow this  
  • entries
    6
  • comments
    15
  • views
    357

About this blog

In short I am making a modern Battle City as I don't know how much work will impact my time.

Day1.2Update.png

Entries in this blog

Scouting Ninja

So just got online when I noticed a few emails asking me how I got so many physic objects working in Unity.

The answer to that is nothing special. On average there should only be a 1000 physics objects on screen. The physics is also a lot more strict on making objects sleep.

The way this is done is the same most AAA games work with art. In a AAA game it isn't rare to have a static duplicate of a skinned mesh. As a example take the players gun, often the gun will be a skinned mesh, playing it's firing animation while the player presses fire.

However skinned meshes have an extra cost just to be in a game, so because exporting the static model only takes a click of a button and the code for swapping them is very fast you can just change your animated model into a static model. Some engines even turns a animated into a static when it's done with the animation.

 

So in Project Castle I did what most games would do with a destructible wall. First I made a object using physic blocks, then I took there meshes and generated a new mesh. The blocks are disabled and the new mesh is displayed. When any object that can hit it is near the static mesh is swapped for the rigid bodies.

 

Now at this point of the blog I thought I would share the code, although @Avalander says my new build still doesn't working so I realized I could just upload the Unity pack. Everything, except Unity, was made by me for this game so you can use it as is.

Import the Unity pack as a custom pack. The layer for shooting is "Water" because the Unity pack doesn't export layers. Space key will swap physics for static meshes, causes a kind of freeze time effect.

 

I would like criticism on my code if anyone has time for it.

 

ProjectCastleFiles.unitypackage

Scouting Ninja

The deadline is here and I have only managed to spend less than 30 hours on the game.

Last.jpg.8b7bbf2ef6773dbc9632ca24b2d7ac8e.jpg

In the end I just entered the sandbox, there was no time to add my menu.

At least the time I did spend working on the game was fun and I did learn a few things:

First @ryan20fun asked what tech I was using and the answer to that is Unity. The whole idea behind this for me was to start from scratch, using no tools or extras, just Unity.

There was a problem with the batch limit, this is as large as a building can be. Adding one more floor causes the mesh merging from Unity to fail.

Shadows is the largest performance killer and I found no way around it that I could achieve in a reasonable time frame.

 

Second thing I learned is that once you understand how Unity planned on using there Quaternions it's easy to pass math between them and Vectors.

The most of how smooth this game feels is thanks to lerping the vectors and quaternions. The tank as is only took 4 hours to implement and one of those hours was me wrongly using the Quaternions.

The Camera was very fast and because it didn't have any extra behaviors added to it, I got the Battle City feel easy without having to counter code that exists.

 

I wanted to measure how switching from primitives to complex art is and never found the time for it. However switching from a cube to the building place holders was fast. There was no performance loss at all even if in theory it was 16* the amount of vertices.

 

 

I do believe I will not even stand a chance this year, not with the other brilliant entries I had seen. However I did enjoy it and seeing the skills of others as they make browser games, multiplayer games and implement there own engines was amazing.

 

Postmortem: Game died of neglect.

 

Edit: Fixed the zip.

 

ProjectCastle.zip

The zip is 18mb and the game should work on most computers even old ones.

Scouting Ninja

So first day of the weekend and I  spend my time focusing on making the game playable.

5_4608blocks.jpg.60a3bca63214d80f74eb1316c06f5012.jpg

In the above image we see the game running at 50FPS on a mid range PC. With 4608 blocks, representing the buildings in the game.

The idea is that once a bullet is fired into a building it explodes a small part of it, causing the building to fall over. The buildings will be used to crush the enemies by checking for a collision with a X amount of force.

I realized that these blocks where to small and to build cities the size I need for the game +/- 5000 objects would not be enough. So destroyed parts will keep cleaning them self up and only the lower floors need small blocks, I think as the buildings increase in size they will reduce in complexity.

 5_SkyScraper.jpg.748dde4f08ceee455a7b46dc5300040a.jpg

This image shows the newer and improved collisions boxes with more realistic physics. Each one of these now take the place of 4 old blocks. One interesting thing I found here was that the building parts would fall over and block paths.

 

In my testing now I tried adding in the aliens, it was a bad idea. The updates on the nav mesh needed for them to adapt to thousands of blocks falling is too much. At the same time I don't want them to immediately adapt because they move away from the falling blocks.

So my plan is to remove that tag from the blocks and use the shadow casting block to also predict the path. Then after a block enters rest I will remove it and replace it with a fully static block with the nav mesh tag.

 

My aim to get done by the contest end:

1) Tank track shader working. With at least the tank on it's second graphics pass.

2) Particles to make things look better.

3) Aliens in and working and health system

4) Aliens and blocks explode into pieces that can cause chain reactions.

It isn't much but with the little time I have left this is the most important part to focus.

Scouting Ninja

So I didn't find the time to update before work yesterday so I am doing this now, just before I start on what is day 5.

What I have been doing:

Decided to not use 3D tank tracks. Going to use a image with a UV animating shader. The reason is that even using the instance material the tracks are causing a slow down.

Found out that I can't replace a prefab in Unity with a other, instead I have to delete one and create one. There goes my object pool.

Shadows where a pain, there is a lot of buildings(cubes) in the game, so I had to create a invisible mesh that cast shadow for all of them instead of letting each cast there own shadow.

 

Working on the firing as I am typing this. 3 hours before I need to get ready for work, so I should get the basics down.

What I did yesterday when I couldn't update:

Castle.thumb.png.299efe94cca0c46f1dea5a611b30bb6a.png

The CASTLE first pass.

Waiting for the weekend!

Scouting Ninja

So day two has passed, without me doing much.

Knowing that even today I will have little time am doing the best I can, holding out for the weekend where I have arranged for three full days to work on the game.

 

I made my main menu as it's the only thing that I could think of doing in only one and a half hour:

WoA2.2Update.thumb.jpg.450ea9488d4f0291c0ca138ae816f843.jpg

Yea I know it's a ugly.

Mostly it allowed me to get an idea of the atmosphere of the game an to start arranging my work folders. One thing I plan to avoid is using any Unity packs, the whole idea for me is to see what I can get done with Unity as is.

For the font I found Unity had only the shadow and outline effects. I needed to make a shader to get the gradient. The shader alone took over an hour, costing me some of my sleeping time, not really an effective way of doing this.

 

One thing in Unity's favour at the moment is the UI scaling was easy to do and with mips the screen here looks the same as it did in 1600*900 it is 1280*768; still 16*9 however the other sizes work just as well.

Scouting Ninja

So day one went by without me making much progress, as I was stuck at work having a bad day. I did get a lot of time to think about the game.

Project Castle is a game where aliens invade earth in a distant future. Realizing that humanity is doomed, they gather everyone important and stuffed them into bunkers. The Player takes control of a prince of that age and attempts to retake earth from the aliens.

"Scholars debate the scope of the word castle, but usually consider it to be the private fortified residence of a lord or noble." Wikipedia

The prince lives inside his own private thank named "The Castle" an fights against the aliens.

 

The aliens will all be close range fighters, with the player having the advantage of range. Instead of directly killing the aliens the player will need to use the destructive environment. I am hoping to use the environment as a way of causing chain reactions.

This morning I got up extra early in hopes of getting at least something done before work:

Day1.2Update.thumb.png.900a35b00549598d5a2d672652bd267e.png

Here we can see one of the aliens, 1st pass still a lot of work to be done on it. The yellow is the only weakness the alien has, killing it with a falling building will be easier than shooting it.

 

I will be using Unity and as such I already started adding curves into the engine. I will need it for the tank tracks and the other art.

Sign in to follow this