Post Reply 
1 Utility for Games
01-27-2014, 07:50 AM (This post was last modified: 01-27-2014 07:52 AM by patrice.)
Post: #3
RE: 1 Utility for Games
Bonjour Cyrille,

I think it do not apply, unless it is permitted to have source code in ASCII which I doubt.

In fact, the idea is to save space in source code and in compiled code.

The problem with games using levels, it is that there is a map per level, Ariel is planning 100 levels for Sokoban
One level in actual source code looks like
Code:
matriz := [ [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,4,0,1,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,0,2,2,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,2,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,1,3,3,3,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] ];
a simple conversion to a string looks like
Code:
"...................$...................$...................$........wwww.......$​​......wwws.ww......$......w.cc..w......$......w..c..w......$......w.....w......​$​......www..ww......$........w...w......$........wdddw......$........wwwww.....​.$​...................$...................$...................$"
a clever use of background lead to
Code:
"$$$........wwww$......wwws.ww$......w.cc..w$......w..c..w$......w.....w$......ww​​w..ww$........w...w$........wdddw$........wwwww$$$$"
and an RLE coding gives
Code:
"$$$9b4w$7b3wsb2w$7bwb2c2bw$7bw2bc2bw$7bw5bw$7b3w2b2w$9bw3bw$9bw3dw$9b5w$$$!"

The hard part is to replace the matrices in source code by the strings and decode them on fly as needed.

Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
1 Utility for Games - patrice - 01-25-2014, 06:46 PM
RE: 1 Utility for Games - patrice - 01-27-2014 07:50 AM
RE: 1 Utility for Games - Han - 03-11-2014, 03:18 PM
RE: 1 Utility for Games - patrice - 03-11-2014, 06:42 PM
RE: 1 Utility for Games - Han - 03-11-2014, 07:43 PM
RE: 1 Utility for Games - ArielPalazzesi - 01-27-2014, 11:25 PM
RE: 1 Utility for Games - patrice - 03-11-2014, 01:04 PM
RE: 1 Utility for Games - patrice - 03-11-2014, 08:42 PM



User(s) browsing this thread: 1 Guest(s)