Mutant Amoeba Development a peek behind the scenes at the MAD lair

20Jul/120

Tiles as offset lookups into an arbitrary texture

Posted by pentaphobe

 

This one's been on my mind for a while now, but after seeing its effective use in Dynamite Jack and Prison Architect it's a go-ahead.

note the ground tiles and how they're not constrained to wall size. This could be achieved with multiple wall-sized tiles, but why bother?

The gist is that instead of using a specific image for each grid point in a map, you instead do a wrapped lookup into that texture so that it can be larger (or smaller) than the grid size itself.  Fairly basic stuff.  Just imagine a texture repeated across the screen and then masked so it only shows on tiles that match. (that's not how you'd implement it, but seems like a clearer image)

However there's an implementation detail which I find interesting: originally I was just going to allow images whose dimensions were a multiple of the tile size, this is easy to code and makes wrapping trivial when using a sprite sheet.  We can also render the tile map by having a fixed grid of points already attached in the graphics card and then simply going through and dynamically changing the UVs for each point whenever the map moves by a whole tile or more.

Dynamite Jack

Again note the ground tiles aren't constrained to wall size. Also note that I'm quietly ignoring how similar our games look. Maybe I shouldn't add that flashlight after all? :)

An nice alternative which would definitely help "break up the grid" is allowing completely arbitrary texture sizes, which would be just as easy to implement if we used a separate texture for every tile, but texture changes are horrendously (and notoriously) slow so that's not an option.  However, using sprite sheets means we can't rely on the hardware to automatically wrap tile images (as it'd simply show adjacent images from within the sheet rather than wrapping at the tile boundary).

The only solution which leaps out at me is to implement the whole tile rendering side of things in a GLSL shader so that we can manually wrap texture coordinates at the appropriate tile boundaries.

Seems simple enough, and it'll mean I finally need to learn how to send arrays to a shader from Java..  Something about IntBuffer objects which seem simple enough but are a little odd.  Not sure why it can't just be a reference to a flat array like in C..

Ho hum!

Hands On: Prison Architect | Rock, Paper, Shotgun.

30May/120

You down wit OPT (Other People’s Technology)

Posted by pentaphobe

I'm trying to avoid overwhelming this blog with non-project related stuff, so I'm going to just link a few in one post occasionally.

CryEngine 3 - Soft Body Physics - YouTube.  This one's lovely - I'm surprised it's taken us this long to get here.  A friend of mine and I started a business together back in 2001 which was going to focus its energies on advancing the procedural capabilities of software tools, this particular video shows one of the things we felt needed addressing. Alas we both got contract work and the business closed with nothing more than a lot of interesting speculative design.  (it's worth noting that we weren't aiming at the realtime market, this sort of tech should have been much better in 2001 than it was)

29May/122

A few spritey inspirations, references and a tip from me

Posted by pentaphobe

A quick method for antialiasing your sprites (timelapse)

More after the fold..