Spore and Unity

So I have been using unity for about 6 months now and rather like it. I still program games in java every now and then.

The latest game I made is Spore. (I know the name is bad)

Little guide on it:

The goal is to survive for 8 minutes. It is a click like crazy defense game with some static towers that help. There are now 29 achievement that boost towers, clicks, spawns, etc.

The game starts off fast so be prepared. Don’t just use the auto click. Get the green power ups as quickly as you can as they spawn seeds which can give you towers. Click like crazy right around the larger rocks as right as the die they spawn more rocks and if you are fast enough you can kill them before the move away.

Enemies:

Rock small –  easy to kill

Rock Large – little harder spawns 3 rocks after death

Boss 1 – hard and spawns 3 large rocks after death

Boss 2- very hard and spawns 5 large rocks after death

Boss 3 – extremely hard and spawns 3 boss1 after death

Spore Towers:

Single Green Spore – will bloom and orbit the colony damaging any rocks in its way

Multiple Green Spore – same as above but spawns more

Yellow Spore – shoots spores at rocks, spores will retarget if an enemy dies, does little damage.

Blue Spore – same as Yellow but doesn’t start off with retargeting does little damage but shoots fast.

Red Spore – can’t retarget from the start, shoots slow but does heavy damage.

Blue Spikey Tower – Shoots the slowest, does the most damage and spawns spores that will float around and damage rocks that hit.

Power Ups:

Blue Dust – increase click/auto click damage by 10%

Green Dust – spawns 3-8 spores

Red Dust – increase auto click rate by 10%

Abilities:

Rock Duster – damages rocks in the area and will remove debris so you can see better

Spawn Seed – spawns 5 seeds at the given location

 

Easy to win guide:

First click on the two icons to the left. They each will give 5 bonus seeds at the start. Keep the rocks off you while building up towers early on. Don’t worry if a few slip by you can survive 10 hits. Remember where the towers are so you can let them deal with rocks while you defend the barren areas of the colony. Large rock spawns are easy if right as they die, you click quickly in little towards the colony. Most spawned rocks will die instantly as the move that way. Don’t click right on rocks but a little in front of them. The bosses come from the left, right, and bottom in that order. Because projectiles can slow rocks down, you can get enough towers that most bosses can’t even move towards the colony.

Random info on Developing Spore:

The performance is not so good some say. I can get 20-30 fps on a nexus 7 which is bad but not as bad as some report. I blame my inability to use unity and their horrid documentation on what slows things down. The biggest slow down is physics/garbage. Not the physics system but that if you do not do things in a certain way in scripts it comes to a crawl. And it is hard as hell to find what causes it to crawl. I do not know why but with java I have NEVER had to worry about garbage. Even on the mobile games I have programed. With unity it seems a must use object pooling on anything that you Instantiate more then once. I did not know this at the start of Spore and it is one of the major reasons it is slow.

Particles Tutorial: Motion

Because I have learned quite a bit since I started this tutorial series, I have found that I really should have explained some theory about creating effects because we ever started writing code as we may have made some different design choices. This next part will focus on some heavy particle effect theory on how to get convincing effects using what I call senses of motion.

I also, would like to give a brief rundown of what is to come. Part 4 will be revamping what was done in parts 1 and 2. Part 4 and 5 will focus on management of particle systems/emitters. Then 6 will show how to port what we have done to run with opengl. Finally, anything else will be showing how to use the system to do different effects such as trails.

Requirements:

  • Finished parts 1-2.

What you get:

  • A solid foundation on how particles create an effect.
  • A better understanding on how you would go about coding a particle library.

I absolutely love games with awesome effects. However, even with AAA titles I still find effects that look like crap. Ones that I know I could make look better without any additional art resources or increasing budgets. Indie games also have huge problems with effects looking very bad. Spawning 500, 1000, or more particles with a smoke texture does not make billowing smoke. Using any particle system to create believable effects is an art form. An art that is actually easy to pick up.

Creating believable effects is all about using motion. Pick your favorite game or games. Look at some of the coolest effects in the game. Seriously pause reading this and go look at them. How were they? Cool, right. Now think of how they were done. Why they looked real or cool. I bet no effect was a single just sitting there in the scene. The key to good effects is using motion. There are many forms of motion. I am going to mention a several common ones.

Movement:

This is the most common. A static image just is not convincing. Moving adds to the illusion of an effect.

Rotation:

Rotation helps create the illusion. Make sure to have particles not all rotate clockwise or counter-clockwise but both.

Scaling:

Scaling is another common sense of motion. Yet this is not simply growing or shrinking there are many forms. You can grow/shrink each x,y, or z axis independently.

Color:

Changing the color over the life of a particle is a nice effect and one that is very important to have.

Transparency: 

Fading particles in, out, and back again. This is one some would bundle into color but it is a completely different sense of motion and one that I think is very important.

Emittion Shape:

The shape or way the particle are emitted into the scene. Circle, box, cone, angle, and any other from that changes how the particles enter the world.

Compositing Particles:

One particle moving across another or on top of another is integral to creating an illusion that all the particles or one entity. This sense of motion is key to keeping the viewer from noticing that most particles are a single image.

Multiple Images

Instead of using one smoke image, use 4 or 10. This adds a variety to the effect. Particles will no longer all have the same image making it hard to tell they are not the effect trying to be produced.

Animated Image:

One step above multiple images. This is having an animation playing for each particle independently. This can add a huge sense of realism and motion but cost more memory.

Complex Forces:

This is where we add things like gravity, forces, wind, and other physics type of effects to the particles to enhance their basic movement.

Complex Composition:

Additive blending, Multiplicative blending, and various alpha composition. This is where we using different and advanced forms of image composites when rendering the particles to help produce an effect. Google additive blending.

Multiple System Composition:

Compositing many particle effects together to make an effect. A system to launch dirt into the air, spawn smoke, spawn little bits of debris, spawn spars, delayed black smoke, delayed embers, shock wave, spawn huge billowing fire, spawn shrapnel with trails, and others are just a few systems that would make up a nice explosion.

Shaders:

Can add many effects to the way particles are rendered and a must in any advanced particle system.

These are some of the most common senses of motion. Sure particles can also have some physics for world collision and maybe some other things but these really are core.

With that being said. Go look at that game/s effects again and think of these sense of motion. I bet you dissected the effect for more effectively now that you knew some things to look for. It is like listening to music, the more instruments you know and the longer you have studied them, the easy it is to pick a song apart.

So why look at other games effects? To learn. I strongly recommend pausing gameplay and just looking around and see if you can figure out how they developers did things or even look at the actual textures used.

Lets look at a few examples of bad or lacking effects.

Mass Effect 3 was a great game for me. The effects looked great when you did not look at them. If you look at most effects such as smoke or explotions. you quickly see that there are only a few images that creates the effect. Some only have one. One particular one that you see all the time is the Centurion smoke grenade.

Smoke

It looks fancy but when you move around you can tell it is a single image billboarded (google this term) to face the camera. There is a shader effect on it to make it “wobble”. This is not a bad effect but one that could use work.

I recently started tinkering with unity and was browsing their asset store and came across “Ultra Realistic Fire and Some” or something. Look at the demo here The effects just look quite bad. The fire seems kinda “real” as it is using some realistic textures but they do not move enough at all. The smoke is horrible. It is like 1000 particles. The 1000 isn’t the problem but that you can tell it is 1000.

We could go on and on looking at games or apps but now we will go over effectively using some of these senses of motion.

Here are a few particle editors out for you to play with.

Unity3D: Their editor is easy to get into and has a very nice UI. Play with it.

Libgdx: Their particle editor is similar to Unity’s as they both like curves instead of numbers.

SystemX: This is my custom editor. It is a little wonky and is missing some features but I think it is the easiest for loading images/sprite sheets/animations for particles. It also has some textures for you to use.

Here, here, and here are some additional free particle animations to try out.

Play with composting particle on one another with motion and rotation. While particles move across one another you get a very nice illusion of an effect. Also, composite multiple emitters/particle systems on each other for a similar effect. Try to use as few particles as possible. With the unity and libgdx editors have the particles fade in and fade out to eliminate popping. Popping is where a particle just “pops” into the world or “pops” out of the world. This never happens in real life. Also, try some animate, multiple textures, and single texture particle effects to see how much better/worse the effect is.

Next time we will refactor old code and write some new stuff to make things better.

Here is a screen using my editor and one of the provided textures.

exasdasd

Blitz School project (Source code included)

So here is another project from the class I am taking. All we had to do was use some “continuous” collision stuff with a few bullets flying around (no textures even) but I did more as always. Everything uses GL11 which is why the lighting is crap.

Controls:
a,s,d,w or arrow keys to move (sorry non-qwerty users)

mouse to aim and fire.

The link with source as always.
http://www.mediafire.com/?45u8jrorzwnry6c

Screens

Image
Image

School Project (With source)

Here it is the finished thing. Added pre-computed culling stuff and a 3D noise UI generator.

Image

Do not select JerryMode. My professor required a God awful control scheme and I wanted to allow it so he wouldn’t drop points.

The controls are as follow: a,s,d,w to move left,down,right,up respectively, the mouse to look around, and arrow keys to move pen, x,y axis and right ctrl/shift to move pen on the z axis. 1,2,3,4,5,6 will change the texture on the pen and 7 will texture the world. Left control + C turns clouds off/on, + G turns grid off/on. Pen create toggles with C and erase toggles with V. When C or V are not set, it is in move mode. 
Here is the link.

School Fun.

So I am taking a class that was titled “Fundamentals of Game Programming.” It is very basic and more focused on graphics and physics. I could probably teach the class. However one of the programming assignments was making a 3D etch a scetch with cubes. So I thought about adding a few things. This is what I have. Image

Nothing fancy here. No chunk system or VBOs. No shaders. Just batching stuff using GL11. FPS is low do do 90k cubes. The world is made from a program that takes an image and uses it as a height map. Skybox was easy. The mist/cloudy things are done in real time with particles. Took a while to get them billboarded. Flying through them is fun. You can move pen around to create and destroy blocks minecraft style. Hitting keys will change the texture on the block. Will post a source and a playable version when I am done. I am also trying to work on part 3 and 4 of the particle system tutorial but school and life is eating so much time.

Will post later.

 

 

 

A mix of old projects. (Source included)

So in the last past year I have started many game and non-game projects. Some have shown fruit while others just died. I feel that I should post them here and give the source code for them in the case that others might learn a thing or two. I will post the source shortly.

NeoBat
NeonBat
This was based on the particles tutorial. Everything is done in java2D without the use of any images. It is a nice time killer but it never really went anywhere. The core mechanics are there and it is a nice thing to study on particle systems.
Original link

Game Menu Demo
Menu
This was to test out if you could create quality effects and style in java2D. One of my first projects ever. After building the UI system from scratch I lost steam. The particle effects are nice and show that java2D can look nice.
Original Link

Edge of the Universe
Edge
This game I worked quite a bit on. Mainly on the Atlas engine powering it. It was dropped when I was working on the physics and completely broke everything. Felt like it would be better to start from scratch. A good example of how many sprites you can render with a simple sprite batcher.
Original link

Real-time Lighting in Java2D
Light
This was not a game but where I wanted to show that you could do fully dynamic lights in java2D with being fast. Can have 500+ lights without a huge performance hit. I may do a tutorial on this in the future.
Original Link

Retro
Retro
Most recent actual game project. I have stalled this for now but really like it. This is based on NeonBat which is based on the particle tutorials. Almost everything is made in code. This uses a older and slower version of my real-time lighting system.
Original Link