A big mistakes in #gamedev is spawning entirely new objects rather than using object pooling.
Spawning, or instantiation is making a new copy of an object into memory.

Let's take the example of bullet casings.

If every time you shoot, you create a new object, you can rapidly end up with thousands of the buggers on screen, in memory and chugging can occur.
With object pooling, however, you say... okay there are only ever N casings in memory. They are invisible, turned off but exist when you start the level. Let's say there are ten for this example.
When a gun first fires, it doesn't create a new bullet casing, it grabs the first casing from the pool, moves this to the guns position, makes it visible and throws it out into the world.
It then records the next free casing is number 2.

Another gun fires and casing 2 teleports to the gun, has its physics reset, becomes visible and flies off into the world to plink satisfyingly against the floor.

Next free casing is 3.
This continues until the pool runs out. When casing 10 is used, the pool returns to 1, (or 0) and the original casing is made invisible, teleports to the gun, is reset and made visible.

This means there is only ever 10 casings in the game. Ever.

Ever.
You can set up object pooling for pretty much everything in your game, including enemies, hit effects, spell effects, blood splats, sound effects... you name it.

Object pools give you clean control over memory allocation, frame rate and hiccups when you instantiate.
Object pools can be passed enemy types, different artwork, different stats and abilities, but enemy01 is always enemy01 regardless of if it is playing a goblin, a zombie or a chainsaw knight riding on a chicken.

If you have a pool of 8 enemies, you won't ever get more...
Than 8 enemies on screen. Until you kill some of them, or they unload and clean the pool.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Delaney King

Delaney King Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @delaneykingrox

Nov 21
Typical exploits I use on student projects to highlight issues are:

□ On infinitely thin modular walls, go into a corner and press directly against it and ease the direction stick back and forth to get a character to pop through and out of bounds.

□ Find where two physics...
...objects interact and get the player inside that fun crush.

□ abuse the capsule collider to levitate the character just outside of a platform and creep around puzzles.

□ spam damage on a wall to see if I can spawn infinite damage decals.

□ draw dicks with trails.
□ see if crouching in a corner puts me outside of enemy hitbox attacks.
Read 6 tweets
Nov 20
You can avoid tessellation popping on terrain by subdividing the mesh without smoothing then interpolating the curve based on camera distance. This essentially warps objects smooth, but movement often covers this in the players mind.
ImageImageImage
Sudden changes attract the eye, but warping slowly does not. We have to concentrate to notice this.

This trick can be used to make LOD meshes transition too, using a vertex displacement or blend shape. Worth it for very large objects.
Read 4 tweets
Nov 20
This is a common mistake people make. Four vertex color channels means for materials blended, right?
A red, green, blue and alpha channel.

Well actually... no
Vertex colors are purely number data. Specifically, they are four floats from 0.0 to 1.0.
A vector4 (R,G,B,A)

Layered textures however aren't mutually exclusive, nor do they need that much precision.
Assume your terrain has these materials:

Stone
Rocks
Soil
Grass

Now grass doesn't grow on stone or rocks, it grows on soil. So we can stack these materials vertically.
Read 9 tweets
Nov 20
If you are learning game development you absolutely have to watch speed runner and glitch hunting videos. Let's Game It Out is also a must watch- not just because he is hilarious, but because he is a razor sharp QA brain. He breaks games as easily as others breath.
*breathe.

Watching people exploit games puts you face to face with the flaws in thinking you will make as you solve problems.

Simple things like... okay I will store the x,y,z position of the player on save, then check to see which zone that is in when I load.
Classic examples of how that can be broken are falling damage cancellation quitouts in Darksouls, or sitting on a chair pressed up against the bars of crypt in Valheim.
Read 7 tweets
Nov 19
That soft mooshy feel between textures in pokemon S&V is a linear interpolation (LERP) using vertex colors to blend between grass and soil.
At one stage of games, this was pretty much how we had to do transitions between maps.

Now you can apply a height mask to the vertex mask and create edges that are much more visually appealing.
Here is a tutorial by prismaticadev showing the technique.

Read 106 tweets
Nov 19
Is the rapidly scaling flash effect polygon have collision turned on- that would launch the player into space?
I can't go frame by frame here but it looks like being rapidly pushed into an unloaded area.
Actually you can see the yellow trim vanish and then the floor.
I suspect the actual character is technically falling out of bounds despite the mesh being fixed for the camera shot, and the position is causing the scene to LOD and unload.
Read 4 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(