You are not logged in.
Lost Password?


Register To Post



 Bottom   Previous Topic   Next Topic

#11
Re: Showing OBJs?
Posted on: 2008/6/11 1:25
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
DogP: This is more just for the sake of learning how to use them. However, I was thinking of making a game that involves bullets for my contest entry, and I think that bullets are a good use for OBJs...

One more question I had about OBJs is... how DO you set the SPT# pointers? Is it as easy as SPT3 = 200? (That seems way too easy.)

Actually, I have a couple more questions, although they don't necessarily pertain to objects. First: I've read a lot about changing palettes while the VB is drawing the screen. I was wondering, how can you tell when and where the VB is in the drawing process? Is there a register you can check? Secondly, since you've pointed out that BGMaps are a better idea for large sprites, would you accomplish animation by making a BGMap with all of the frames of your animation in it, and then just changing the MX/MY of the world to "play" the animation?

Bruno: I'm just a n00b, so I don't know if I'm right about this, but from what I understand, the answer to both of your questions would be no. First of all, (correct me if I'm wrong) a world can only be an object world or an HBias world, not both. Secondly, because it's HBias (not VBias) the shifting only works horizontally. There might be a way to implement software VBias, but it would likely be pretty complicated.
Top

#12
Re: Showing OBJs?
Posted on: 2008/6/11 7:13
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
Bruno: Fwirt is right; neither H-Bias nor Affine transforms can be used on OBJs. But, the equivalent of "V-Bias" is exactly what Affine transforms are for. One way to accomplish rotation, for example, is to simply shear (think of turning a rectangle into a parallelogram) in first the X direction, and then the Y. When I understand Affine better, I'll update the Wiki, unless someone smarter beats me to it

Fwirt: Yes, you just have to set SPT3 to the first OBJ you want to show (i.e. the one with the highest number; usually 1023) and then set SPT2 to the one after the last one you want.

Then, you just have to fill in the OBJ data in the right sections of OAM and set a World to display OBJs. I've been updating the Wiki again; see if it makes more sense now.
Top

#13
Re: Showing OBJs?
Posted on: 2008/6/12 13:02
VB Gamer
Joined 2007/12/26
41 Posts
Long Time User (11 Years)
Affine is nice and all, but hbias and vbias should be much faster to make some simple 3d worlds (look at DonkeyKong Country backrounds, imagin that in both directions). I actually found a demo for something like that, but it didnt have source code, and it was for some browser java stuff.
Top

#14
Re: Showing OBJs?
Posted on: 2008/6/12 22:06
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Bruno: Wait... I don't think that you're talking about HBias and VBias at all... I think that you just mean scrolling backgrounds? In order to do that, you just have to update the GX and GY values of whatever world you want to scroll (for example, decrease the GX value each step to make the background move left.) HBias is used to make the background look "wavy" by shifting each line left or right, not the whole background.
Top

#15
Re: Showing OBJs?
Posted on: 2008/6/13 13:17
VB Gamer
Joined 2007/12/26
41 Posts
Long Time User (11 Years)
No, that would be just simple paralax scroll. Im talking about that special scroll that you can also do with HiBias (the water surfaces,etc... in the DKC backrounds)
Top

#16
Re: Showing OBJs?
Posted on: 2008/6/13 22:21
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Ahh.... I know what you mean now. Those DKC backgrounds do look rather cool. But RunnerPack is right, you'd have to use affine mode for that. Aside from affine mode, the only other way I can think of to get that effect would be to have a whole bunch of worlds layered on top of each other, and do a lot of parallax scrolling to achieve depth. That would use a whole bunch of worlds though, whereas affine only uses one.

Actually, to be honest, I did always wonder how they pulled that trick off in those DKC games.
Top

#17
Re: Showing OBJs?
Posted on: 2008/6/14 0:18
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
Quote:

Fwirt wrote:
Actually, to be honest, I did always wonder how they pulled that trick off in those DKC games.


The equivalent of H and V Bias is done on the SNES by using an interrupt that happens on every scanline. When the interrupt occurs, the scrolling registers (among others, like the palettes, etc.) are changed to make waves, etc.

I'm not an SNES dev'er, but I think this is how "Mode 7" effects work, too. (But I could be mistaken...)
Top

#18
Re: Showing OBJs?
Posted on: 2008/6/14 0:28
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Now it's my turn to ask a question again. Here's my code:

#include "libgccvb.h"
#include "chartest.h"
#include "maptest.h"

//Screen is 384 X 224

int main()
{
    
int objX=0objY=0;
    
vbDisplayOn();
    
copymem((void*)CharSeg0, (void*)CHARTEST256*16);
    
copymem((void*)BGMap(0), (void*)MAPTEST256*16);
    
vbSetWorld(31WRLD_ON10807600016872);
    
SPT3 0x100;
    
SPT2 0x1;
    
vbSetObject(2OBJ_ONobjX0objY9);
    
vbSetWorld(30WRLD_OBJ WRLD_ON00000000);
    
vbSetWorld(29WRLD_END00000000);
    
vbDisplayShow();
    while(
1) {
        if (
vbReadPad() & (K_LR)) objX++;
        if (
vbReadPad() & (K_LL)) objX--;
        if (
vbReadPad() & (K_LU)) objY--;
        if (
vbReadPad() & (K_LD)) objY++;
        
vbSetObject(1OBJ_ONobjX0objY9);
        
vbWaitFrame(40);
    }

But the compiler gives me the error "invalid lvalue in assignment" for both of the lines where i try to set the SPT pointers (lines 15 and 16). I also tried using decimal values, but I still got the error. Help?
Top

#19
Re: Showing OBJs?
Posted on: 2008/6/14 0:38
PVB Elite
Joined 2003/7/26
USA
1465 Posts
PVBCC EntryCoderContributorSpecial AchievementTop10 PosterHOTY09 EntryLong Time User (15 Years) App Coder20+ Game RatingsPVBCC 2013 Entry
Updated code:

#include "libgccvb.h"
#include "chartest.h"
#include "maptest.h"

//Screen is 384 X 224

int main()
{
    
int objX=0objY=0;
    
vbDisplayOn();
    
copymem((void*)CharSeg0, (void*)CHARTEST256*16);
    
copymem((void*)BGMap(0), (void*)MAPTEST256*16);
    
vbSetWorld(31WRLD_ON10807600016872);
    
VIP_REGS[SPT3] = 0x100;
    
VIP_REGS[SPT2] = 0x1;
    
vbSetObject(2OBJ_ONobjX0objY9);
    
vbSetWorld(30WRLD_OBJ WRLD_ON00000000);
    
vbSetWorld(29WRLD_END00000000);
    
vbDisplayShow();
    while(
1) {
        if (
vbReadPad() & (K_LR)) objX++;
        if (
vbReadPad() & (K_LL)) objX--;
        if (
vbReadPad() & (K_LU)) objY--;
        if (
vbReadPad() & (K_LD)) objY++;
        
vbSetObject(1OBJ_ONobjX0objY9);
        
vbWaitFrame(40);
    }


Look in the libgccvb.h file. Those constants near SPTx are used in the VIP_REGS[] array to get the real address.

Sorry for the confusion. (I guess it's time for another round of updates to the wiki... Unless we change that in the new official library.)
Top

#20
Re: Showing OBJs?
Posted on: 2008/6/15 1:46
VUE(xpert)
Joined 2006/9/29
USA
267 Posts
CoderLong Time User (13 Years) PVBCC 2010 3rd
Great! Thanks a lot! I have a good amount of programming experience, but not that much experience with C, let alone low-level C, so a lot of this is a whole new world to me. Luckily, it's all been making sense so far.

RunnerPack, you deserve commendation for your work on the wiki. I was beginning to wonder if it would ever develop past an empty shell with quotes from David Tucker's manual stuffed in it. Thanks to a lot of recent work, that's changing!
Top

 Top   Previous Topic   Next Topic


Register To Post