Kategorije | News

Making Things Smallerer

Datum objave: 04 November 2009, Autor: John

levhat Making Things Smallerer

This is a sort of script-heavy post, I apologize in advance. But like I have mentioned in a previous post, I have been working on a level editor for I Hate Traffic.  One of the concerns of the game is somehow storing these levels as something small and compact enough to fit easily into copy and paste bits of code.  We all love those massive million character codes, but since we are planning on making this a game with levels built into a level select system, we decided to make things smaller…er.  Prepare for some geekiness….

I first took the raw code for the level above…

s1 Making Things Smallerer

So 2,187 characters… is about ~2.2 kb.  Not much right?  Sort of.  It’s just a tiny bit on this scale, but once you start putting it on a larger level (thousands and thousands of plays) that data transfer can add up.  Every three digit number (displayed back to back) represents a single tile in the system, in case you were wondering.

So in an attempt to shrink down that number a bit I formatted the tiles to write themselves down sort of like a gif file.  Gif files reference a table of data, then run a set of algorithms to eliminate the need to map every pixel independently.  So instead of 109109109109109109 to represent 6 tiles we can put in 109×6 instead, which is much less beafy.  So, after this algorithm runs….

s2 Making Things Smallerer

We’re down to 1,802 characters, or 15% streamlining.  Not bad.  And given the circumstances and complexity this precentage can rise up into the high 50-99% compact rate, but since this is a rather complex level it’s not streamlined that heavily.  So let’s go one more.

With the help of Joey we have discovered that dumping the code into a ByteArray makes it even smaller.  ByteArray are containers of bits, as way of accessing and working with binary data.  In this way we can move things around in smaller chunks of data.   Transferring the data into byteArray data and compressing… well…

s3 Making Things Smallerer

We’re down to 676 characters, tapping out at only 30% of the original code.

2,187 -> 1,802 -> 676, not bad.  That’s for a level with 625 tiles on it, pulling from a library of about 100+ different tile types.

So in this way we can store much smaller chunks of data.  I’m guessing there’s even smaller ways to store the data beyond these methods but we’re extremely happy with what we have come up with so far.

Programming aside, the game is going well and the tools in the editor should be plenty fun to play with.  Should be done soon!

 Making Things Smallerer

 Making Things Smallerer

Pročitajte još i ovo:





Comments are closed.



!!!Naslovna 64(Pre)dugo očekivani Starcraft II: Wings of Liberty smo ispratili na jedini mogući način – megatestom i megaposterom!

screenfun63tNezasiti Ezija? Nove avanture poznatog junaka iz Firence stižu u igri Assassin’s Creed: Brotherhood koju predstavljamo u novom broju ScreenFunu.

screenfun62tNiko Belić na Divljem zapadu? Rockstar je lansirao hit koji ne sme da se propusti a zove se Red Dead Redemption! Zbog toga i krasi naslovnu novog ScreenFuna.

screenfun61tAko je suditi po novom Ghost Reconu, bliska budućnost je, u stvari, daleka sadašnjost! Zbog toga smo u novom broju rešili da ga seciramo!

screenfun60tGlobalni fenomen zvani Final Fantasy pao je pod lupu ScreenFuna pa smo majskom broju donosimo detaljan test igre i odgovaramo na pitanje da li 13 nesrećan broj za hit serijal.

screenfun59tS bušilicom do pobede! Povratak u Rapture, ovaj put u čizmama Bid Daddyja, predstavlja praznik za sve ljubitelje Bioshock igara.

ScreenFun




Twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.


ANKETA

  • Kako biste ocenili igru Mafia 2?

    View Results

    Loading ... Loading ...