Unity and computer hardware are massively more powerful than they were even a decade or two ago so Emulation allows older hardware to be simulated in modern software.
I am a novice Emulation programmer but have managed to make a simple and buggy chip-8 emulator.
The current build almost plays chip-8 space invaders.
So is there an underground Unity emulation scene, and if not why not?
What would be cooler than a 3D/VR game with retro game consoles/computers that actually work in it?
What I found amazing is that a chip 8 game of space invaders can fit into a couple of kilobytes and most 80’s hardware based games work with a few megabytes of data.
To emulate you need a very low level framework, comparable to libSDL and ability to directly issue rendering commands. Unity provides scenegraph instead.
Basically, while you COULD make a zx spectrum emulator run from within unity (I mean, all you’ll need is grab framebuffer, blit it onto texture and route sounds from emulator to unity), you gain no benefits from using unity here - only disadvantages (slowdown due to overhead).
Also game sizes are nothing surprising . ZX spectrum, for example, had 64 kilobytes memory total, and half of it was reserved (16k for the rom, and another 16k for the screen). Meaning most of the games would be under 32 kilobytes in size, and even smaller when compressed.
YOur numbers about 1980s games must be off, by the way. Those games should be using kilobytes of data top, of not just hundreds of bytes. Megabyte was a massive amount of RAM back then.
So you’re saying Unity is very slow at drawing/blitting to bitmaps below 800x600 resolution?
No the 80’s also includes the Amiga and Atari ST computers that used floppy drives and some games worked on multiple disks (880 kb a disk) so megabyte sized games were around in the 80’s.
UAE for example, amiga emulator, can use opengl acceleration to do graphics… there’s nothing you can’t really do through unity, it’s just a matter of drawing stuff to a display using whatever means necessary, plus a whole bunch of programming to do the emulation. But some of the more complex systems like Amiga etc have quite a lot of hardware parts that need emulating, not so easy compared to a very old system.
I’m saying that unity provides almost no useful functionality for making an emulator.
For making an emulator you’ll usually need a software renderer and at the very least you need a FAST way to pull data from software buffer to a hardware buffer. Unity does not have such functions and C# is not good when you want RAW memory access. You’ll want C, C++ or Assembler with something like libsdl or allegro. Not unity.
In addition to that C# is fairly close to the worst possible language for making an emulator due to being garbage-collected.
You could probably write those emulators in anything and have them be relatively performant because the whole thing could be brute forced by the ridiculous amount of power that computers have now.
Good point some chips inner workings and ‘features’ were only found through experimentation as they were undocumented and when you have a system with multiple chips interacting across one or more data buses there can be a lot of complexity there.
Also even old hardware like DSP (digital signal processor) or Coprocessor chips can often do complex tasks quicker than software even modern software e.g.
There was a challenge for people to write on a modern computer (this was a while ago early pentium era) software that would work faster than the Bletchley park Turing Bombe at solving the Enigma code. And they did it but it was a struggle as that machine was dedicated and made to do a specific task.
Definitely enough power available on modern hardware. I didn’t save the link, but recently I ran across a C64 emulator that was written entirely in JavaScript and ran in a browser. You could even load games from a simulated floppy drive.
But there’s nothing to be gained by adding Unity to the mix.
Which is pretty much the worst possible way to go about it.
You can write an emulator for unity if you contain it in a native plugin. The data from emulator can be then fed into the engine.
However you will not benefit from using unity in any way by doing that.
That depends on what you’re emulating and how, though. PS2 emulators has been kicking ass of powerful computers for a LOOONG time till it became playable. Same applies to dosbox. Making something like daggerfall playable is very difficult. Keep in mind that dosbox is a true emulator, meaning it emulates CPU, instead of running the code via virtualization techniques.
Yeah, I was more referring to the two emulators that Arowx linked. The NES and the Spectrum are relatively simple devices and their emulation techniques have been documented to high heaven at this point.
I think the only reason for trying to put emulator into unity is attempting to create a minigame.
However, an actual emulator would be probably an overkill for this, plus there are a lot of legal issues involved. Emulated system would usually require a ROM, and a game, and those are still protected by copyrights.
given emulators can be written in java or even flash I imagine they can be done in Unity just fine. Emulators of this sort are only curios and toys anyway, so why not.
Ease of porting is my first thought but there’s also not having to learn another language or framework.
I’d have loved to see the Pipboy in Fallout 4 emulate an actual 8-bit machine complete with BASIC ROMs to allow you to write and store your own programs on holotapes. Would have been even better if the default functionality was implemented as programs that could be modified or replaced.
And tons of emulators already exist. I could see if one was a serious engineer type, and doing it to challenge themselves, but beyond that there not much point for a game developer.
One of our “games” (nsfw) is a “Glimmer Deck” emulator. The “Glimmer Deck” is actually a machine from the future which doesn’t exist yet in our time. We’ve done our best to make our emulation as close to the real thing as possible. Yeah, that’s how I roll.
As far as the scene graph & component architecture being unsuitable - it is! - but i looked at bypassing this by using low level GL commands to render 2d sprites to a render texture and draw that on a quad. This allows old school pixel perfect gpu accelerated sprite drawing
But this is not emulation just retro style graphics blitting
Given that old computers had something like 64k memory, it could be done, however it would explosively increase your save file size and you better not have more than one pip-boy in the world.
Besides, there’s a matter of having to maintain and debug ROM for that virtual computer. I heard that Armstrad allowed use of original sinclair zx-spectrum rom by public, but have not verified it.