Original Post

First off, I realize this is a newbie question.
But, I looked through the wiki and a few of the sites about development and it made no sense at all. 

A little background. I recently started getting into coding, my first language is Apple’s Swift and I’m working on a SpriteKit game. I really love Swift and Xcode and I’m excited to pursue that as a career. I learned mainly through sites like TeamTreehouse.  I’m more of a coder and stuff like how the hardware part of a computer works is still a bit baffling.

I also love video games and I actually have a Virtual Boy just sitting on my dresser. I turned it on and remembered how much I loved the thing.

I was wondering what steps I’d need to take in terms of study to go from a language like Swift to eventually creating a game for the Virtual Boy.

I’d actually like to create something on iOS that I port to Oculus Rift and VB. Not sure how feasible that is. 

Keep in mind this is a longer term goal , so if things could get easier in a year or due to more development resources or upgrades on the VBDE that would be cool.

So in summary.

Swift -> VB Programming … What do I need to study?

With the new release of the VBDE is assembly language knowledge still required, or is it now possible to get away with creating something with a high level programming language?

Using Mac OS X would it be possible to create something without installing a Virtual Windows system (without making it harder on myself)? 

Any help or books to read or tutorials would be awesome to help me on my path.

11 Replies

Nitrosoxide wrote:
Swift -> VB Programming … What do I need to study?

With the new release of the VBDE is assembly language knowledge still required, or is it now possible to get away with creating something with a high level programming language?

Learn C. Your Swift knowledge is mostly useless for homebrew purposes. NEC v810 assembly knowledge is a big plus, but even so, many homebrew games are written in pure C. You should at least have an idea of what your C code is compiled to, as when writing in C for any platform.

Using Mac OS X would it be possible to create something without installing a Virtual Windows system (without making it harder on myself)?

Yay, another Mac user! Mac binaries of what little exists of the VB dev toolchain are few and far between– I might be the only one producing them. However, user ElmerPCFX is hard at work taking what are buggy patches intended for gcc 2.95 and revitalizing them for gcc 4. http://www.planetvb.com/modules/newbb/viewtopic.php?topic_id=6456&forum=2 I can send you my binaries but I must warn you, they are buggy.

Any help or books to read or tutorials would be awesome to help me on my path.

Have you checked out the Sacred Tech Scroll? http://www.planetvb.com/content/downloads/documents/stsvb.html Outside of Nintendo’s official documentation it’s probably the most thorough doc detailing the hardware.

Nitrosoxide wrote:
I’d actually like to create something on iOS that I port to Oculus Rift and VB. Not sure how feasible that is. 

Keep in mind this is a longer term goal , so if things could get easier in a year or due to more development resources or upgrades on the VBDE that would be cool.

While this is a noble goal, you will find it very difficult. The VB is an *extremely* limited platform compared to a smartphone or Oculus-powered PC. For starters, you have the NEC v810 CPU clocked at 20Mhz with only 64KB of pseudo-static RAM and typically up to 2MB of ROM space when using a FlashBoy Plus. Yes you can eke some performance out of the system if you know a few tricks, but that comes with experience and even so, there are hard limits as to what the circa-1995 machine can do. It’s a much easier path to design and write something for the VB first, then port later to more recent powerful platforms.

So how does this work?

You write a game in C and compile it using a compiler that “ports it” to something the virtual boy can understand?

How do you factor in what exactly the virtual boy can do?

I’m confused.
Can you break down the basic steps to create in a very simplified quick summary?

e.g. With a Sprite kit game

1. Write code in Xcode using Swift with Sprite Kit as my framework which includes a physics engine and a graphical scene builder. I often use tutorials to guide me.

2. Compile using Xcode

I’m used to just writing things in Xcode and compiling there.

How is it done in this case?

Are there any good basic tutorials that show how to create a fairly basic VB game using just C?
That would help I think.

Keep in mind I’m not doing this for a while and can wait for ElmerPCFX to update his stuff.
I’m looking at the distant future.

Obviously you can’t just build any old game with C and expect it to run on the Virutal Boy.
I’m not gonna lie… That documentation you pointed to reads like gibberish to me.
There’s a big knowledge gap in a lot of the terms / jargon used there.

Thanks for the help and patience.

The Virtual Boy is based on the NEC V810 32-bit microprocessor. To write software for the VB you typically use GCC, which is a free, open-source compiler suite. GCC takes your C code and generates V810 assembly instructions which are then assembled to native V810 machine code intended to run directly on the Virtual Boy’s CPU. From there the machine code is fed to a couple more auxiliary tools which package the code into a ROM file readable by an emulator such as Mednafen (or burnable to a FlashBoy). The Tech Scroll I linked details the memory map and hardware registers of the Virtual Boy itself, which when read/written according to the spec will make the Virtual Boy do the special functions it’s known for.

The Virtual Boy doesn’t have an API or anything analogous to SpriteKit or other high-level frameworks. Anything that isn’t handled by the hardware itself has to be written, from scratch, by the programmer in software. There’s no C standard library, no STL, nothing.*

(*Well, there are some community-contributed utility and convenience functions in libgccvb, but I typically just hit the memory and registers directly for better efficiency.)

The closest thing available to a Virtual Boy development “tutorial” is the Development Wiki found here: http://www.planetvb.com/modules/dokuwiki/doku.php But ultimately this will point you to sample code which when reading is the best teaching tool available.

If you’re expecting some kind of guide that holds your hand every step of the way– sort of a step-by-step Virtual Boy “Hello World” from start to finish– I don’t think that exists. Homebrew in general, not just for the Virtual Boy, presumes you have a solid coding background and also makes the assumption that you’re willing to get your hands dirty in reverse-engineering and bootstrap your own development environment. In my case, I build GCC from source code, install Eclipse, set up a Makefile-based project, write Makefiles that point to my GCC toolchain, then from Eclipse I can edit my code and Makefiles, build my project, and launch my ROM from Mednafen to debug (in assembly, no less). But that’s certainly not the only setup, and likely not a very common one since I do my development on a Mac and most VB developers use Windows.

The Virtual Boy is not a good platform to learn to code on, but if you insist, I would recommend finding a Windows machine or VM, going to the Development Wiki I linked above, setting up a development environment using gccVB 2.95 (for now), and trying to build the samples linked under the “Getting Started” section. You’re going to find the most support from this forum when using the Windows-based tools.

Thanks so much for the answers man. I know it’s probably frustrating trying to explain this and dumb it down. But that explanation really helped.

By “solid coding background” what exactly, what would you say helped you the most before you tried tackling VB or while adjacently tackling it? Is all I really need just a good C foundation?
Or are there specific areas to focus on in C?

I’m not looking to try this for a long time. Obviously I’ve gotten pretty far with Swift and will continue there… but I’m just looking for other things to study.

I’m also hoping it may get easier to create a VB Game as well.
It’d be nice if someone could write something to take Swift Code and create something (crosses fingers). Or is that a pipe dream that’s very unfeasible.

————–
A little rant..about why I’d want to do this…(feel free to skip as I’m definitely ranting on a tangent here)
————————————————————
I don’t think I’d want to waste my time with Homebrew for another console. The benefit : reward ratio isn’t there… sure I’d love to make a new Sega Genesis game or N64 Game for the retro factor… but you can create a game that looks similar enough with Sprite Kit or Unity. You could argue about the authentic feel and all that.. but honestly for me (and others) the effort of trying to reverse engineer systems, from more than 20 years ago, isn’t worth it. Programming was just on a whole different playing field.

I get the feeling that coding for most early console machines could often be a grueling experience due to the fact that people were basically given a brand new piece of hardware every so often and forced to figure out how to squeeze the best performance out of it.
I get the feeling it required an entire team back then , just due to what you had to do to accomplish things. My favourite SNES game Earthbound has 10 programmers (based on credit info from uber fansite Starmen.net)
http://starmen.net/credits/snes.php

Heck it’s partially why my dream game of Earthbound 64 never happened. A team who worked great on the Super Nintendo just couldn’t get a good 3D game together iirc from interviews.
Modern developers don’t code for old gen console because in the end they just want to
deliver a satisfying 2D game or 3D game and they can do that on all modern platforms.

The Virtual boy is different.
Homebrew for the VB is appealing cause the VB isn’t just another console… it’s really unlike anything else created. It’s 3D capabilities are unique.
Unlike a simple 2D or 3D polygon game. The Virtual Boy’s 3D effect can really be used in your game mechanics.

I love everything about it. It’s not just the 3D… the art style you’re forced to conform to is also really cool. That limited red palette won’t be used again. Emulating a Virtual Boy isn’t even close to experiencing the thing. That can’t be said for other consoles. I’ve beaten plenty of n64 games purely emulated.

I play Virtual Boy and it still amazes me at how cool the damn thing is. This thing deserved more software. That should be corrected.

I would love to help be part of that.

You don’t seem to understand just quite how primitive these old hardware systems are … modern systems are approximately 1000 times more powerful.

You’ve chosen to learn to program with the crutch of a modern high-level language doing a lot of work behind-the-scenes, and with somebody else having done 60% of the work for you by having a huge pre-built library (SpriteKit, Unity, etc).

That’s just the reality of modern game development, and I can understand why it would seem to be a good place to start.

But these old machines have absolutely none of this … and the VirtualBoy is never going to run Swift unless you personally decide to try to port the Swift compiler over the V810, at which point you’d find that the Swift compiler’s runtime startup code would take up the complete memory of the VB and leave you with no space left for your actual game.

If you want to write something on the VB, then you’ll have to learn the low-level details of how a computer really works, and to do a good job, you’ll have to be reasonably-comfortable with V810 assembly language (because there’s no source-level debugging).

Part of the pleasure of these old machines is precisely that it’s a challenge to work-around the limited hardware to produce something interesting and fun.

If you really do have such a desire and passion for the VB-specifically that you want to continue, then stop what you’re with Swift and SpriteKit, they’ll teach you nothing that’s relevant to an old machines like this.

Instead just download VBDE and VBJaEngine, and find the Nintendo VB SDK docs online, the V810 docs online, and a copy of Kernigan and Ritchie (https://en.wikipedia.org/wiki/The_C_Programming_Language).

Be warned … it’s a challenging path to follow, but at the end-of-the-day, you’ll learn some basic skills that will translate into your future game development.

If that sounds more “grueling” than “fun”, and you’re already considering the “benefit : reward ratio”, then I really, really really suggest that you take your own advice that “you can create a game that looks similar enough with Sprite Kit or Unity” and just buy an Occulus Rift and make a pseudo-3D game in 4-shades of red.

That’ll avoid a lot of frustration on your part, and will be just as “retro” as most of the current fad of 2D games that pretend to be NES-like.

BTW, most commercial SNES and Genesis games that I know of were done by small teams of 2 or 3 guys, with maybe an extra 1 to add the menus at the end of development, and a musician for a small part of the time.

The credits list always looks longer because everyone-and-the-dog-that-walked-into-the-office-one-day gets listed.

I had never used C before I started programming for the VB. It is definitely possible to learn both at the same time, but it takes a while.

It is indeed possible to write a whole game in C. I would still recommend learning assembly once you’re comfortable with C to get a better understanding of the whole system, but it is not strictly necessary. As long as you draw your graphics with the VIP (most games do), the V810 is fast enough for just about anything.

Don’t get discouraged, but also don’t set your hopes too high. It is unlikely that you will be able to port a game from a modern platform to the VB (or maintain two versions in parallel), but the reverse can be done with some discipline.

I have to agree with Horvat. The VB isn’t that hard to handle. There are some things you need to learn first (basically how to handle graphics) but after you can get pretty far without bothering about the VB specifics.

Assembly is a good way to speed things up but if you keep it simple C will fit all your needs. libgccvb (which comes with vbde) isn’t the fastest or most convenient lib to access the VBs features but it will help you allot on your first steps.

I would recommend you to check out how Characters, Background Maps and Worlds and work. That’s the basics to display graphics on the system.

Feel free to ask questions. People are always willing to help out.

Thanks for all the help guys! This gives me a lot to work with.

If Xcode supports writing C code… couldn’t I write my C Programs in Xcode?

I’m kinda relieved to realize that SNES games we’re created with a lot less man power than I thought.

I don’t think learning a high-level language like Swift was learning with the “crutch of a modern high-level language “. Honestly, learning it has made a lot of basic programming concepts accessible to me, like variables, functions , etc. None of this made sense before and I’ve tried to learn to program many times.

A lot of that is thanks to TreeHouse’s great lectures on Swift. They have really good visual animations that make it a lot easier to grasp the basics. I highly recommend their lectures.

It’s the first place that made this stuff make sense and I actually went to a paid school for programming, which was a colossal rip off / waste of time.

If anyone’s interested in Treehouse: Here’s referral link that gets me a discount if anyone’s interested in a free month.
http://goo.gl/s5mNb3

Having a good grip on Swift and glancing at an overview of the C Programming language… well it’s not super different from basic concepts I learned in Swift..
Functions, loops, etc , I know what all these things are.

As Swift can get me employed for iOS development, it’s a skill I want and am happy to have.
Learning C is another great skill to have.

And it mixes with Swift since I can when creating programs, Swift and Objective-C and C code can be used in a single program. I can directly use C from Swift.

Nitrosoxide wrote:
If Xcode supports writing C code… couldn’t I write my C Programs in Xcode?

You can use Xcode as a glorified text editor, but that’s it as far as the VB goes. You will need to then drop to a command line to use a V810-patched version of GCC to compile your C code for the V810, since Xcode is hardwired to use Apple’s tools. If you like using IDEs, then I prefer Eclipse (or TextWrangler/BBEdit in a pinch).

I don’t think learning a high-level language like Swift was learning with the “crutch of a modern high-level language “. Honestly, learning it has made a lot of basic programming concepts accessible to me, like variables, functions , etc. None of this made sense before and I’ve tried to learn to program many times.

A lot of that is thanks to TreeHouse’s great lectures on Swift. They have really good visual animations that make it a lot easier to grasp the basics. I highly recommend their lectures.

It’s the first place that made this stuff make sense and I actually went to a paid school for programming, which was a colossal rip off / waste of time.

If anyone’s interested in Treehouse: Here’s referral link that gets me a discount if anyone’s interested in a free month.
http://goo.gl/s5mNb3

Having a good grip on Swift and glancing at an overview of the C Programming language… well it’s not super different from basic concepts I learned in Swift..
Functions, loops, etc , I know what all these things are.

As Swift can get me employed for iOS development, it’s a skill I want and am happy to have.
Learning C is another great skill to have.

And it mixes with Swift since I can when creating programs, Swift and Objective-C and C code can be used in a single program. I can directly use C from Swift.

Learning how to play piano might help me learn music, but it’s not going to develop my trumpet embouchure. Yes Swift and any number of other programming languages can teach basic concepts, but if you think that continuing to focus on mastering Swift will make you a better VB programmer, then you’re wasting your time. Learn C.

By “solid coding background” what exactly, what would you say helped you the most before you tried tackling VB or while adjacently tackling it? Is all I really need just a good C foundation?
Or are there specific areas to focus on in C?

Probably my 20 years of programming experience, but don’t let that discourage you. As HorvatM and thunderstruck pointed out, games can be written entirely in C and libgccvb provides convenience functions that can abstract away some of the nitty-gritty confusing details. Ultimately though, it’s important to understand that consoles built prior to around the 2010s were very specialized machines and as such, coding for them was and is very different from coding for a traditional PC or smartphone architecture with standard video, sound, and audio interfaces. The Virtual Boy (and I believe the N64) shipped *without an operating system*– everything had to be provided by the programmer. Contrast this with a framework like SpriteKit, or an engine like Unity, where as ElmerPCFX so eloquently put it, “60% of the work”– the hard, low-level engine stuff– is already done for you.

A good C foundation will go a long way to helping you write your first Virtual Boy application. C is a pretty simple language– there’s not really “areas to focus on” so much as there are not really areas to focus on in, say, English. Take ElmerPCFX’s advice– grab a copy of K&R C from Amazon, pore through it, and write some simple command-line based PC apps in C first to get a grasp of how to “speak” C. After that, then you can dip your toes in the red and black pool, so to speak. 🙂

blitter wrote:
Learning how to play piano might help me learn music, but it’s not going to develop my trumpet embouchure. Yes Swift and any number of other programming languages can teach basic concepts, but if you think that continuing to focus on mastering Swift will make you a better VB programmer, then you’re wasting your time. Learn C.

Good point! … Though I don’t believe it’ll make me a better VB Programmer. My point was just that I don’t see any other way I could have entered the world of programming because I found learning other languages next to impossible previously.

Why Swift? For one… I like pictures, graphical visualizations & metaphors to help illustrate abstract concepts. The Treehouse Swift tutorials seemed to provide that more. While everything makes sense now… it’s easy to forget how foreign a concept like an array can be to a casual computer user.

While Swift Programming won’t make me a better VB Programmer…. I think learning C and VB Programming would make me a better iOS programmer … since you can use C directly in Swift.

Though I’d continue to focus on Swift just to get a job in iOS development, not to be a better VB programmer.

If I want to develop a VB Game simultaneously with an iOS game, I’d need Swift for certain things.

blitter wrote:
Take ElmerPCFX’s advice– grab a copy of K&R C from Amazon, pore through it, and write some simple command-line based PC apps in C first to get a grasp of how to “speak” C. After that, then you can dip your toes in the red and black pool, so to speak. 🙂

I’m gonna go through the recommended C textbook and start from there. Thanks man.

 

Write a reply

You must be logged in to reply to this topic.