Welcome! Log In Create A New Profile

Advanced

Wii Memory

Posted by Chicken_Bones 
Wii Memory
December 19, 2010 02:20PM
have a game that I plan to make. I just need to know can the Wii handle the memory requirements. Probably can but what is the max wii memory?If not suggestions on how I could reduce the memory needed would be appreciated.

MyClass
{
 u8 id;
 bool side[6];
 u4 light;
 u8 data;
};//total = 26bits

MyClass classarray[4][256][256][128];

this should be 4*256*256*128*26bits = 872415232bits = 109051904bytes =~104MB

I'm pretty sure u4 doesn't even exist. Help on how to make a 4bit value would also be appreciated.



Edited 1 time(s). Last edit at 12/19/2010 02:22PM by Chicken_Bones.
Re: Wii Memory
December 20, 2010 09:13AM
You may try to type following:

typedef struct _mystruc
{
    int  var1 :4;
    int  var2 :4;
} mystruc;

I never declared this way by myself. Just saw such declaration in some headers representing structures of bit fields.
Not sure how it will be handled by gcc used in devkitPro. Probably you need to set packed attribute to this structure.
But you must to know, that structure boundary will be rounded to at least byte boundary.
Variables in structure without ":" suffix will be rounded to at byte boundary at least. So single 4 bit variable won't save any memory, but 2 consecutive 4 bit variables in one structure will be packed into 1 byte, so will save you at least 1 byte.
Re: Wii Memory
December 20, 2010 01:37PM
Thanks

MyClass
{
 u8 id;
 bool side[6];
 int light :4;
 u8 moredata :6;
 u8 data;
};//total = 32bits = 4bytes

MyClass classarray[4][256][256][128];

4*256*256*128*32bits = 1073741824bits = 134217728bytes = 128MB

Ok that means I have an extra 6 bits to fill (no problem there) but I have heard that the wii only has 88MB of RAM so would it be able to hold this much (128MB plus more variables) data?
Re: Wii Memory
December 20, 2010 01:50PM
Bear in mind that the bool type actually takes up a whole byte so you will want to use bitfields again here. But yes you are going to run out of memory. You'll have to come up with a different approach.
Re: Wii Memory
December 20, 2010 08:15PM
Uhm, why do you need your 4 dimensional super array? It won't fit in the wii's memory. You might need to rethink your architecture for this one.
Re: Wii Memory
December 21, 2010 01:00AM
MyClass
{
 u8 id;
 int light :4;
 int side :6;
 int data :14;
};//total = 32bits = 4bytes

MyClass classarray[4][256][256][128];

Quote
chris
Bear in mind that the bool type actually takes up a whole byte so you will want to use bitfields again here. But yes you are going to run out of memory. You'll have to come up with a different approach.
That should be better.

Quote
Daid
Uhm, why do you need your 4 dimensional super array? It won't fit in the wii's memory. You might need to rethink your architecture for this one.
The 4 dimensional super array would be more like an array of 4 player classes containing the 3dimensional [256][256][128] of my class.

So the wii does only have 88MB of RAM (makes me wonder how super mario galaxy can cope). Can anyone confirm? I want to be sure I'm not designing a game that just won't work.

Thanks for the help so far.

Sorry about the triple post it was an accident. Please delete the 2 before this one.


Two previous posts deleted. --bg4545



Edited 3 time(s). Last edit at 12/21/2010 07:30AM by bg4545.
Re: Wii Memory
December 21, 2010 11:22AM
Quote
Chicken_Bones
Quote
Daid
Uhm, why do you need your 4 dimensional super array? It won't fit in the wii's memory. You might need to rethink your architecture for this one.
The 4 dimensional super array would be more like an array of 4 player classes containing the 3dimensional [256][256][128] of my class.
So, why do you need the 3 dimensional super array? My first guess would have been something like minecraft, but the 4 was odd in that.
Re: Wii Memory
December 21, 2010 01:30PM
Quote
Daid
So, why do you need the 3 dimensional super array? My first guess would have been something like minecraft, but the 4 was odd in that.

Got me :) it's inspired by minecraft but 4 player and in a different direction. still can the wii handle it?
Re: Wii Memory
December 21, 2010 02:14PM
Yes and no. As pointed out, you have 88MB memory to work with, but 12 to 16MB of this is already reserved by the IOS. So you are left with 72MB. In this memory you need to fit everything, from textures, game code, buffers, stack to game data. In reality, you better assume you have about 64MB memory for your data.

Now, instead of using a huge array containing the full status of the blocks, you could reduce it you an array containing only a 8 bit type. And make your types a bit more advanced, like "type 0 is open", "type 1 is grass on top" "type 2 is dirt" "type 3 is dirt with grass on top"
Then you need to save less data per block, and use 8.3MB per player, but it will leave you with room to work with.

Another way would be to have a list with only the 'visible' blocks in it, and generate the info about the other blocks when you dig something open. But this is pretty complex, I've done this once. But it's hard to keep track of everything. It does also solve the rendering in the same run, which is a plus.

As last thing, I think you need to malloc these blocks, the memory map of the Wii isn't linear and contains a gap. So I don't think you can allocate a block this large in the "data" area of your program.
Re: Wii Memory
December 21, 2010 04:00PM
yes I was going with the chunk idea with 5x5x5 chunks around the player with linear arrays of 32x32x32blocks = 16 MB per player. Other stuff shouldn't even take a MB so it should be good.
Sorry, only registered users may post in this forum.

Click here to login