Path: chuka.playstation.co.uk!news From: "Greg Cook" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Packet Explanation Date: Sat, 24 Nov 2001 19:17:32 +1300 Organization: PlayStation Net Yaroze (SCEE) Lines: 269 Message-ID: <9tne1e$dq916@www.netyaroze-europe.com> References: <9tkp3s$dq91@www.netyaroze-europe.com> <9tlh4b$dq95@www.netyaroze-europe.com> NNTP-Posting-Host: 210-55-149-54.dialup.xtra.co.nz X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Thanks alot for the explanantion Alex. Heres some code i've written today, as you can see im just starting out... Ive got a few questions scattered in that code as comments, maybe you can answer some like i said this is the first code i wrote and got working today, though i understand a good portion of it, theres alot im not sure of, also just say i press select and start to quit the program.. how would i clear the screen, put the words " thanks for checking me oout" and then quit the program? thanks alot for your help and patience. Greg ****************************************** #include #include "pad.c" /*=========================== Defines ==================================*/ #define SCREEN_WIDTH 320 #define SCREEN_HEIGHT 256 #define SPRITE_COUNT (1+1) #define OT_LENGTH 1 GsOT WorldOT[2]; // the ordering tables units thought i really still dont get what they are. GsOT_TAG WorldTags[2][1< Newsgroups: scee.yaroze.freetalk.english Sent: Saturday, November 24, 2001 2:00 AM Subject: Re: Packet Explanation > Hi Greg, > > The packet area is just a chuck of memory, so as long as it's big enough to > hold all the packets you create then fine. It doesn't really matter how you > define it but declaring an array seems to be the most common way. > > The NO_SPRITES*sizeof(GsSPRITE) method seems logical at first as this would > suggest that the packet area is the correct size to hold the number of > sprite packets as defined by NO_SPRITES. However this is wrong as the size > of the GsSPRITE structure has nothing to do with the size of the packets > created. For this reason I wouldn't advise doing it this way. > > The PACKETMAX*24 method makes a little more sense to me as 24 is an average > size for a GPU packet. Some are bigger, some are smaller but 24 is good as > a rough guide. As for how a value for PACKETMAX is chosen, well that's up > to the programmer to decide. Picking a value of 2048 for example is saying > that you definitely won't be sorting more than 2048 items (roughly) into the > OT. > > Or you could just declare it like this: > > #define PACKETAREA_SIZE 32768 // 32Kbytes > PACKET packetarea[2][PACKETAREA_SIZE]; > > and just specify the number of bytes required. Choosing a big(ish) number > like 32K is a good starting place. This number can then be refined > throughout development as you get a better idea of how much space is > actually required. Calling GsGetWorkBase() after sorting all your objects > (i.e. just before you call GsDrawOt) will return the address of the next > free byte in the packet area (one byte beyond the used area). So, simply > subtracting the start address of the packet area will tell you how much > memory is being used. Sorted! > > Alternatively, instead of declaring an array for the packet workspace, you > could assign memory from the heap at run-time using malloc(). Or if > memory's getting tight, you could set the address of the packet workspaces > to the area of memory where you loaded your TIMs. Once the TIMs have been > loaded into VRAM the chances are that you don't need the copies in main RAM > any more, so overwriting them with GPU packets isn't a problem. At the end > of the day it's up to you to use the method which you feel is the most > appropriate. > > Alex > > > "Greg Cook" wrote in message > news:9tkp3s$dq91@www.netyaroze-europe.com... > > Ok well ive been working through various beginner tutes, and have been > > reading the beginners forum to get some help and explain some things. > > > > But i have a question about Packets. In most tutes there are two distinct > > ways to define the Packet Area and im unsure which is the correct way to > do > > it.. > > > > 1. > > > > #define NO_SPRITES 1 > > > > static PACKET packetarea[2] [NO_SPRITES*sizeof(GSPRITE)]; > > > > 2. > > > > #define PACKETMAX 2048 > > #define PACKETMAX2 (PACKETMAX*24) > > > > static PACKET packetarea[2][PACKETMAX2]; > > > > so which one is correct? and in the second version where does the magic > > number 2048 come from? i assume the 24 is something to do with the size of > > the items in the structure... but is 2048 just a magic number as i have > seen > > it defined as 1024 and various other sizes........... > > > > ok well yet another question from me.. > > > > thanks guys > > > > Greg > > > > > > > > > >