Path: chuka.playstation.co.uk!news From: "James Rutherford" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Saving wasted memory Date: Fri, 5 Jan 2001 18:54:36 -0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 37 Message-ID: <9354us$il41@www.netyaroze-europe.com> References: <933bra$7c1@www.netyaroze-europe.com> NNTP-Posting-Host: host213-1-205-210.btinternet.com X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 "Shaun Gibson" wrote in message news:933bra$7c1@www.netyaroze-europe.com... > Hi, I was just wondering if there's a way to change the size of some of the > data arrays (eg, instead of having a u_short array for a GsMAP's cell data > have an u_char array). This would save a lot of memory if you have many > large BGs with a small selection of tiles, you could fit 4 times as many > maps in the same amount of memory - I am currently making an rpg, and I need > many screens to make it big (obviously), so on a memory-limited machine (no > loading in the screens half-way through, must all be at the begining, grrr) > reducing the amount of memory required for each screen would help greatly. > I have tried changing struct GsMAP to point to a u_char instead of u_short, > but it didn't work. You shouldn't try messing around with the Sony structures - they're hardcoded into the libraries, so bad stuff lies that way. You need to encode your data in a different form (as u_chars / 4-bit data / with compression) and expand / decompress what you need as you need it. This might be into a screen sized array of u_shorts if you're doing a flick-screen game or into a slightly larger than screen array if you're doing a scrolling game. Compressing u_shorts (2 bytes) into u_chars (1 byte) will allow you 2x as much space, if you want 4x you'll have to encode as 4-bit (although you'll only get a range of 0-15). Good Luck! James (~mrfrosty).