Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(3 edits) (+2)

yet more optimisations..
- optimised  character shadows (and now they also can be turned off)
- optimised normals (monsters now use precached normals for lighting when they can)

also a major optimisation for collisons:
now my scheme for spatial subdivision  is a bit primitive ..
I use a giant 2D grid and each grid cells store a list of pointers to triangles
(they were originally a big std::vector of pointers but that turned out to be too slow
so now just a regular vector of pointers .. but I digress)
now turns out when testing for collisions what you want is a function
that stops testing as early as possible
what I mean is something that identify empty areas really well and doesn't do much testing
thing is the actual function that checks if a line hits a triangle is used very rarely
and most of the time you go through lists of triangles .. and going through this list is slow by itself
and with many moving characters all around the level  it just adds up

now early on I made a mistake and I only checked if a triangle is within a cell by a simple test
based  on it's minimum and maximum coordinates (aka the box the triangle fits in)


this  worked fine for small test levels  but as the levels grow it became a serious problem
even though the levels are still relatively  low poly (about ~50k tris per level)
anyway as you can see on this image this was a very wasteful approach
especially for large triangles (which are also used quite often due to the low poly
nature of the game)



and here we have the fixed version - adding this optimization nearly doubled the speed of the game
turns out it affects nearly everything: collisions, decals, dynamic lights etc.
all needed checks that used the grid

the fix is simple - there was already closest point to triangle test used by actors to move around
so this function was repurposed and
we check the cells center to the closest point in the triangle
and then we see if this closest point to that overlaps the cell
(in this case the cell is just a  axis aligned rectangle)


I'm in a bit of a rut level design wise .. I want to have a level before the second boss
but despite having many ideas for it everytime I start on it .. well it goes nowhere
and I keep restarting

(the restaurant level will come after the second boss - that part is covered)

anyway for now here is a video about the new tripmine weapon:

until next time!

(+1)

Ah collisions . . . I feel your pain. But glad to hear you got it figured out and improved your performance in the process, that's cool!

I like the animations in your video, especially the one where he spins the laser tripmine like a basketball on his finger.

The chair on top of the crates was amusingly unexpected.

Any particular reason why you have multiple verbs for a "Take" action? I saw "Nip", "Steal", "Filch", "Repossess" and "Grab" for what appeared to be the same action.

(+2)

Thank you!
I thought it would be funny to have more than one verb but I think I'm trying to hard
oh and 'repossess' is when you take back one that you placed so there is some logic in there
or at least when I added I think I knew what I was doing (like with the chair: if you bump into
it also starts rolling away and might set off the mines but I forgot to demonstrate that)