We're using cookies to ensure you get the best experience on our website. More info
Understood
@fwirtRegistered September 28, 2006Active 11 years, 9 months ago
248 Replies made

DogP wrote:
Heh, I was gonna point that out too, though I didn’t want to drag this too far off topic. But since you brought it up, that should have been:

if (turn & 0x01)

With the logical AND (&&), it would have evaluated true any time turn was non-zero. The bitwise AND (&) masks the last bit, evaluating true only when the corresponding bit of turn is 1.

DogP

Thanks for catching that. I hate it when I mix up bitwise and boolean and/or >:(.

mbuchman wrote:
Okay, seriously, you guys are all making way too big a deal over figuring out if it is the computer or human turn. The quickest and easiest way is to use a mask…

if (turn & 0x01 == 0x01) {
 /* Player A turn */
} else {
 /* Player B turn */
}

You know, now that you bring that up, why do you even need to mask it and check for equality when you could just do:

if (turn && 0x01)

But like DogP said, I don’t think this is really helping Chris understand C any better.

Sorry Chris, but I really highly recommend that you learn arrays. I know it seems hard, but they’ll save you a ton of work compared to what you’re doing right now. For a thorough and specific tutorial on arrays, look here. Arrays are just a list of variables that you can access by number. So instead of having to write code that has a ton of if statements and deals with each variable seperately, you only need 1 line of code, and a number (which can be a variable) that tells you which line to access.
For an example… Instead of this:

if (myVar == 1)
  thing1 = 5;
else if (myVar == 2)
  thing2 = 5;
else if (myVar == 3)
  thing3 = 5;
//etc...

Arrays let you do this:

thing[myVar] = 5;

Well worth the effort of learning them, no?

(If you think the transition from Basic to C is hard, my first language was actually Javascript8-O, which is a pretty horrible language)

I just took a brief look at your code and… Gah! No offense, but it looks like you need to learn arrays, man! All of that variable declaration at the beginning:

int xpos1=0, opos=0, circle1x=0, circle1y=0;
int cross2x=0, cross2y=0, xpos2=0, xpos=0;
int circle2x=0, circle2y=0, opos1=0, opos2=0;
int cross3x=0, cross3y=0;
int circle3x=0, circle3y=0, opos3=0, opos4=0;
int cross4x=0, cross4y=0; int circle4x=0, circle4y=0, opos5=0;
int cross5x=0, cross5y=0; int circle5x=0, circle5y=0;

…could be replaced with

int oPos[5], xPos[5];
int crossX[5], crossY[5];
int circleX[5], circleY[5];

If you’re struggling with C, I suggest the tutorials at cplusplus.com. C++ is basically C with additional features, but the language is mostly the same up to object oriented programming. Hope that helps!

By the way, is C your first language, or are you more familiar with another programming language?

  • This reply was modified 14 years, 7 months ago by Fwirt.

Actually, since the design is completely open sourced, I built the adapter from scratch using through hole parts on stripboard. If you already have the tools, the parts cost is under $10. As far as flashing, if you don’t need anything fancy you can flash AVRs with a parallel port cable (called dapa), which is just a DB25 and some wire connected to the right pins. It’s not the safest thing, but when I first started using AVRs, I used a dapa cable. This is the instructable that got me started. Now I use a USBTinyISP that I bought off eBay for $15. (link) It’s a nice little programmer and works great with avrdude. Hope this helps!

  • This reply was modified 14 years, 7 months ago by Fwirt.
Attachments:

I’m using the Raphnet universal adapter that I built, with the custom firmware that supports VB controllers (I posted about it a couple weeks back right here.) It feels great using a real VB controller.

See, when I started reading this thread, I thought you were saying that Nintendo should’ve made a VB -> SNES cart, not a GB -> VB cart. Honestly, I think GB -> VB would be kind of moot, since VB is techinically part of the Game Boy family (Although I suppose one could argue for backwards compatibility, although lately Nintendo hasn’t seemed to care.)

The thing is, the VB’s screen has about the same brightness display range as a Game Boy (4 shades, correct me if I’m wrong) so it would be just like a Gameboy that…. wasn’t portable? Aside from that, I suppose you could argue that the games could be augmented with “3D” effects, although it would probably end up something like the “color” that the GBC added into old GB games.

Just my 2 cents.

It doesn’t have much to do with the 3D Graphics, but I think that the controller layout is perfect for Bangai-O. Unfortunately, I don’t know what kind of load that many bullets would put on the VB. The Dreamcast and DS can barely handle that game!

Oh, and I second Space Harrier. I was thinking of doing it for the contest, but I know nothing about Affine Mode, so I’m going for something a little simpler instead.

I love it! Although it reminds me of Play-Doh extruders. I hope I get my entry finished quick enough to get one.

Honestly though, I was hoping for something more cryptic in the QR code at the bottom. 😀

For me, in both Reality Boy and Mednafen, your calibration screen is screwed up. The splash screen code I posted in the rules thread earlier had that issue fixed. (And if neither of you are having that issue, then what am I doing wrong?) Also: The ball displays in Reality Boy, but not mednafen… I haven’t looked at your code so I couldn’t tell you what the deal with that is.

But sorry about my criticism, it’s a really great first project! I never even finished my project for the last competition…

Really? I copied the bgmap/charset into one of my own demos, and there were a couple of wonky things. (There was one character filling the black spaces, and one of the eyes was cutoff halfway down the screen.) I re-exported the headers and fixed a bug. This is what I got. If the original doesn’t work try this:

Attachments:

Hmm… I’ll have to try my hardest to restrain myself from turning in something incomplete just to get a poster. 😀

Whoa… The dolphin demo is really impressive. It looks like more than 4 colors to me… or I am just seeing things. Perhaps the VB still has some tricks up its sleeves?

Also, that Starfox demo is really smooth. It just shows how much potential the VB still has. Thanks Grooveraider!

I agree, there aren’t enough good shooters for VB. Maybe you should write one. However, I wouldn’t agree with you that shmups are easy to make. A simple shooter is easy, as there aren’t many physics to deal with and you can randomly map levels, but just think about all the projectile tracking necessary in a bullet curtain type shooter. Also, I don’t think the VB is best suited for shmups. Part of the fun of the VB is being able to explore new game ideas that come across best in real 3d. I think a rail shooter is more suited for VB. (By the way, I call dibs on Space Harrier!)

Personally though, I think that Bangai-O is practically designed for the VB controller.

Wow, what a day to come back on the scene! I mean, a VB emulator that works 100%? What amazed me was that sound even works. This has really renewed my interest in the VB community, especially since both of my units’ displays are on the fritz again… Maybe I’ll actually have a chance at writing some homebrew now.

Hmph… Well, at least this’ll get rid of the “PLZ DUMp THemS.” Although, with the debate going on right now, I’m not sure if that’s a good thing… >:(

That cubefield game would be pretty sweet if ported to VB, but it is a little late to start working on it. The 3D effect would probably have to be done with direct screen draws though, unless you wanted to hand draw all of the cube enlargements (what lots of mode 7 SNES games did.)

World Runner would also make a good VB game, even though I don’t like it very much.

Grids of Chars are exactly what BGMaps are for! It is also perfectly fine to change the Char references in BGMap cells on-the-fly. In fact, the BGMaps for both the grid and the cursor could be easily made by your program in a few for loops, without using anything like VIDE or grit (except for converting the chars themselves).

If it’s really that simple, then maybe I will switch to BGMaps. The objects thing was getting kind of messy anyway… I’ll just have to rework my code a bit to get it to work that way. Shouldn’t take too long. 😀

At least I learned a lot about objects this way…

One quick question: How exactly do you toggle XPEN? I tried masking XPCTRL with 0xFFFD to set XPEN to 0, but it didn’t seem to work (the display buffers didn’t freeze.)

Okay, I’m blowing the dust off of this topic.

While slowly working at getting Yoshi’s Cookie working, I’ve realized that unless I want to do some messy stuff with BGMaps, all the cookies are going to be constructed from objects. Reason: In Yoshi’s Cookie, the board seems to be made of a large grid of 8×8 tiles, with each cookie occupying 4 tiles (16×16). Unless I want to do some messy stuff with BGMaps, the easiest way to implement this seems to be to have a large grid of objects, and just modify their char references when necessary. I’ve already got that system working for the most part….

The problem is that the cursor (upper left corner) is doing some odd things. I have 2 object worlds, one for the cookie grid, and one for the cursor. This looks fine on the display, but when I check OBJ memory in Reality Boy Debug, one corner of the cursor always shows up in 2 banks of OBJ memory. What I mean by this, is that as my program is now, the lower right corner of the cursor is displayed not only in object set 2 (where it should be), but in object set 1 (not displayed) as well. I see this when I check objects in Reality Boy Debug. From what I know, It should be impossible for the same object to in 2 different object ranges (SPT2-SPT1 and SPT1-SPT0), so is this a glitch in my program, or in the emu?

Attachments:

Actually, the way I was thinking of calculating FPS (after reading some more technical docs) was to manually turn writing to the buffers on and off whenever you completed a frame, and use the hardware timer to find the time between buffer writes, and calculate the FPS from that. Of course, I have no idea if this can be done, because I don’t know if the VB timer has a high enough resolution, and I haven’t tried manually controlling buffer writes… (does toggling the XPEN bit effectively freeze the buffer state until you’re ready for another screen redraw?) I was thinking of trying manual buffer writes anyway, because I keep doing weird things to char memory when I try to write too much information to object memory, and end up doing it while the VB is writing to the frame buffers. 😛 Has anyone else tried manually controlling FB writes?