PDA

View Full Version : Want to know some info when authors make emulators...



MrTeressaBond
May 30th, 2009, 18:16
Just first off, i would like to know what are the steps if one would want to make an emulator, but disregarding of course one would have to know language programming and etc.

basically for now i want to know stuff like compatibility vs speed? does one make an emulator so good that it runs so slow on a machine that has to be adjusted for it to run well on millions of machines on decent specs?

regarding that, would they make an emulator for other machines and not for there's only? thus this si where admendments come on?

not going to say too much just yet, but this is so far wat i want to know. i hope it is okay to ask this and i hope to hear from you lot as well! :D

JLF65
May 31st, 2009, 04:02
As someone who's worked on emulators for the last 27 years, I can say this in all confidence: If you have to ask, you don't know enough programming. The things you want to disregard (disregarding of course one would have to know language programming and etc) contain all the answers you want. You cannot disregard them. Your question is akin to "I want to know all about brain surgery - disregarding medical school, anatomy, and anything else related to biology."

BlueCrab
May 31st, 2009, 04:31
While JLF65 is right in what he says (its impossible to separate emulator programming from knowledge of programming), I feel the need to tackle your questions with a bit more of an actual answer (being that I just noticed that PM you sent me a while back)....

As for the compatibility vs. speed question, that is in large part up to the author. What I find is the best compromise is to focus on compatibility first (people don't want to play an emulator that doesn't play anything), then optimize from there. Choice of programming language can play a large part here in the optimization/speed department. Keep in mind though that most machines you'll be emulating (especially if you're planning on trying to write your first emulator), will be simplistic enough that in all likelihood your emulator will run fine on any machine made in the last 5 years (at least).

As for making it for "other machines", I suppose you mean making it so it runs on any PC that happens to be running the same operating system? That's largely a part of the APIs used for programming. This is a basic part of programming, and I don't particularly feel the need to explain it. As for making it portable to other machines (i.e, a emulator that originally ran on Mac OS X and then it is ported to Dreamcast, for instance), that is just a bit of a learned ability in writing code. Separate out the platform-specific from the platform-independent, and keep it that way. This may make the code slower, but it will pay off dividends when you try to port it.

It is indeed very hard to separate emulator programming from knowledge of programming languages, and I would not recommend trying to write an emulator if you've never programmed before. Start with something small and build your way up. Emulators are, in many ways, some of the more complex code that many programmers will ever write.

Darksaviour69
May 31st, 2009, 12:44
very interesting answers guys

MrTeressaBond
May 31st, 2009, 20:57
yes, very interesting answers indeed, and i am nto trying to rule out the prgramming knowlege because i know thats where alot of the answers rely, but i say that because i knew it was going to be the most explained answer through misunderstanding, thus the reason why i said that, nothing can be done without that power :D

anyways, BlueCrab, i am glad u ahve noticed my PM to you, i was wondering why i havent gotten a reply :D anyways, that was alot of helpful information you gave me there, however i am not actually going to be making an emulator, more of actually asking for volenteers (on who has made emulators) for help, but there are a few things i wanted to know before i would carry on.

i see now that compatibility is number 1 on the list correct? then optimization, however when that stage comes in, is that were sacrifices are made? like having a glitchy emulator but yet can still run the game?

regards to that, say if an author made an emulator solely for his machine, that would run perfectly, that would mean it would have big problems running on others?

anjd say if an authro made an emulator that emulates the system exactly, would this cause overall slowdown as many experience if i am correct?

JLF65
May 31st, 2009, 21:57
Speed vs compatibility example: Let's say you write your emulator in pretty straightforward C++. Let's say you've got games that does something like change the color palette in the middle of a line on the screen (say to show 5 colors when normally only 4 are the max). You could write your emulator to allow for the emulated CPU to change the colors at any time... but that would make the program ten time slower. Or you could say "screw it" and ignore palette changes in the middle of a line, thus the display isn't quite right for the few games that do that.

That's an example of the trade-offs you see in emulators. You don't emulate every last little thing the hardware COULD do simply because your computer isn't fast enough in the language you are programming in. For the above, maybe you switch to assembly language, or maybe you use some alternate method of handling colors associated with the screen that uses a lot more memory instead of requiring more cpu time. The trade-off will always be somewhere: in the time needed, in the language needed, in the memory needed, etc.

MrTeressaBond
May 31st, 2009, 23:36
ahh i see, i am somewhat starting to understand how it works, but as i said, i am not writing an emulator, i have already stated and with reason in my previous post.

i suppose one can already emulate every little thing, but as it is clear now its because an average computer simply wont be able to handle it? speed wise?

in that case, lets say we get a custom made computer which pretty much high-end specs, and with Linux on that system, could one potentially or is possible to make an emulator OR adjust the emulator to work on that computer alone? keeping in mind, that it is a clean computer, AND additional writing to the program to use the hardware directly to emulate a system, thus Hardware emulation. Is this a possibility?

im just assuming it pretty much would elimate the speed issue as the specs are waay more than enough and nothing in the computer to slow it down, therefore can one then author an emulator 'perfectly' without worrying about speed issues?

quzar
June 2nd, 2009, 10:27
in that case, lets say we get a custom made computer which pretty much high-end specs, and with Linux on that system, could one potentially or is possible to make an emulator OR adjust the emulator to work on that computer alone? keeping in mind, that it is a clean computer, AND additional writing to the program to use the hardware directly to emulate a system, thus Hardware emulation. Is this a possibility?

im just assuming it pretty much would elimate the speed issue as the specs are waay more than enough and nothing in the computer to slow it down, therefore can one then author an emulator 'perfectly' without worrying about speed issues?

This is essentially how many console emulators may outperform *some* PC counterparts. They are written for ONE hardware configuration alone, and will often use many little tricks to achieve as much as possible.

MrTeressaBond
June 22nd, 2009, 01:47
hey everyone, sorry for the late reply, honestly it has to do with the final stuff in my college as i am in my final year.

but to quazar, that is actually interesting, so if i am correct, what u must be saying is, an author would programme an emulator to his specs of his computer and then would slightly adjust it to correspond to the other PC's out there? (hence why there would be a new version of the emulator every so often and etc.?)

also, literally any of the author can make a literal translation of a console to PC emulation, but usually would go against it because either:

1) their own and other average consumer PC's wont be able to handle it, including speed as an importance, and will cause an overall slowdown

2) in relation to number 1, they dont hve the definitive specs to base their emulator on to run 100%, compatibility and speed, whic would require an overall powerful computer.

MrTeressaBond
June 27th, 2009, 13:46
hello?

sorry for the bump, but anyone may i ask?

JLF65
June 28th, 2009, 00:46
Well, ask away, but no one can guarantee answers. :)

MrTeressaBond
August 28th, 2009, 13:50
hi, sorry for the late reply, therefore in response to what u said, this is somewhat experimental then yes?

i have not yet forgotten what i intend to do, but i would like to ask now, say for example that the system (i.e. the hardware only with an OS running at least) was built, and say we contacted an emulator author who alreadty has suceeded authoring a stable emulator (like Gensis) isnt it possible to ask this person to further tweak the emulator so it would run on the system perfectly due to the high-end specs?

with those kind of specifications, i assume that if one would make an emulator that would run every bit of what the console did, but would have somesort of slowdown because an average computer (of last year?) wouldnt handle it, but that eliminated due to the case that it would be running on higher hardware specs?

JLF65
August 29th, 2009, 00:00
You can ask, but no one can guarantee they'll bother. If the author doesn't have one of these uber-machines, odds are he won't bother as he wouldn't be able to test the program.

MrTeressaBond
September 5th, 2009, 16:55
ahh that is what i was about to get at precisely, thus isnt here a way for the author to program the emulator to the specs i have mentioned to him?

like wouldnt he ask for somesort of benchmarking tools to give him an idea on how to tweak it or etc.?

JLF65
September 5th, 2009, 18:29
Unless the author has a machine like the one you wish the emulator to be made for, it's nearly impossible to get it working just the way you want. It's significantly more work as they can only guess at how some things would go on a machine they don't have. They only choice would be to make changes, send it to someone with that machine, wait for a response, then try again. That type of programming is a royal pain, so you're not likely to get an author to go for it.

MrTeressaBond
September 6th, 2009, 04:27
okay, u have made it clear that this is not practical whatsoever (even though i knew i had it coming :D) and i definately do not want to stray away potential authors this way either, hahahaha.

i suppose what i might have to do and if they will agree is to send them the machine itself for them to test on and via contact eachother email wise, although a high level of trust is regarded on this and if one is willing to accept and be able to handle such machinary safely, dont forget this cost money :D

i suppose, i just want to sum up my last question toget it clear for me so i will revise it now;

- if i am correct, if an author makes an emulator perfectly emulate a system 100% would this cause for it to slow down dramatically?

-if that is the case, will more powerful hardware, and that the program is also written specifically for it, make up the slowdown incresingly?

I will also intend on asking quite advanced questions if this is all possible, for example, like i mentioned before, hardware emulated, so the system would boot up exactly like a video games console. And also something like tweaking the emulators so they interact directly to take advantage of hard like the grphics card for enhancement. an example would be like running a Megadrive game on the system, and even though it'll probably look wonderful already, direct interaction with the graphics card to apply the wonderous 'Supersampling' :D will make the resizing aliasing completely elimated, this also goes for other intended and 3D games. Can you imagine playing a Saturn game like Sonic R at HD or 2K looking marvelous? :D

i know this all sounds really ambitious but i thought i would come open about it finally and dont want to stall anymore after many years of dreaming doing other wicked things (my main priority was to make a film as i am a Media/Film student but with good liking and knowlege of games).

JLF65
September 6th, 2009, 16:14
- It depends on the machine being emulated, but in general, emulating a machine 100% makes it MUCH slower than even, say, 95%. Most "optimizations" in emulators is determining which % of a machine to not emulate to make the program much faster.

- Yes, if an emulator runs tens times as slow due to some feature to be emulated, using a computer that's ten times as fast will let you run the emulator with that feature. That's the approach most modern emulators use compared to emulators from 1995 to 2000. They assume you have a 3 GHz PC instead of a 300 MHz PC. At some point, multi-core CPUs will be the norm and emulators will assume that everyone has at least four cores instead of one.

- In general, using a video card directly cannot magically make a 320x200 display look like high-def. The "super-sampling" you see in some emulators is basically a method of enhancing edges to look cleaner when the image is magnified, and is too complex for GPUs, so it takes a powerful CPU. What you see when people use the video card is the filtered look - instead of nice sharp blocky pixels, you get a smooth blended look.

MrTeressaBond
September 7th, 2009, 00:57
Well i have now a much better diea of how things go and it more or less fits to what i have originally thought, but kinda wanted more details and confirmation :D

Because i am dealing with alot of systems that are to be emulated, the mchine needs to be quite powerful, this definately has to go for one console that to my opinion is the most difficult video games console to emulate, the Sega Saturn. Even with 2 emulators making good progress, it has really taken this long to actually get somewhere, and i am really amazed with the results, i assume it has taken this long because of its heavy and complicated hardware that is needed to be emulated, and probably a hellalot of optimizations were done inorder to get it in a working state right now. To get good results from this, they would at least require a Dual core processor, however my system will act as if it were a current generation console, thus it will contain an Intel Core 2 Quad processor, im pretty sure that would be enough?

With that mentioned, this would alreadt counter the problem of complexity as i believ the hardware i intend on using will be over more than enough to do the job, but the extra little power it has will be where the enhancing goes in, and only the best will be used to give a fresh look on those old games.

Two techniques i will mention are 'Supersampling' and 'Anisotropic filtering'. Now i am not sure exactly, i am aware of thier job, but where does their job come in? Do these work directly onto the game natively? Or does the game get resized then the filters apply?

JLF65
September 7th, 2009, 16:06
They're generally part of the resizing code.

MrTeressaBond
September 7th, 2009, 20:25
ahhh i see then, so i am somewhat correct? but what resizer does it use?

i mean u get stuff like Bicubic, Bilinear and Trilinear resizers but all of them already tries to deal with aliasing, therefore what does Supersampling and probably Anisotropic filtering use? Nearest Neighbour and from their the filtering comes in?

JLF65
September 8th, 2009, 01:25
There are a number of different scalers that are supposed to look better than filtered: 2XSaI, HQ2X, etc. Here's a link to get you started on that:

http://en.wikipedia.org/wiki/Pixel_art_scaling_algorithms

MrTeressaBond
September 9th, 2009, 23:20
hahaha, funny you have linked me that because I've looked upon that a couple years ago when i was still on this very much when it came to enhancing older generation games, and initially i liked it, but came to dislike it because even though they did a good job i didnt really like the results.

in addition, i know with the methods i mentioned or not better results can be achieved, and they wouldnt work for 3d games either.

therefore this brings me back to my previous question, how do they render the games at a higher resolution so that Supersampling and Anistrophic filtering ca be used?

JLF65
September 10th, 2009, 00:36
You'll have to define "they" as you keep asking about things you don't name. Of course no one can tell you what "they" are using since we haven't the foggiest notion of who you're talking about. All the emulators I've seen use the methods on the page linked above.

MrTeressaBond
September 10th, 2009, 01:55
hahaha sorry about that, 'they' refers to the filters; Supersampling and Anistrophic filtering :D so now does this help make my question clearer by any chance? :)

u are right, very much like ZSNES, ive seen the Indiana Jones one before back 2 years ago and i didnt like it. And i can tell which one they use almost exactly because ive probably seen the same method used on the Ultimate Genisis Collection for the Xbox 360 and saw a sonic screenshot, i thought 'oh hell no'.

JLF65
September 10th, 2009, 04:43
I've not looked into that beyond the page I linked, and another on edge filtering in the frequency domain. This is something you'll just need to google for and work through what you find. There probably isn't a lot on it out there simply because it's sort of a "trade secret" to the programmers. "My edge enhancement is the best!!" If it's not part of an open source project, don't expect much info, if any.

Here's something to look at - a version of the Gens/GS emulator specifically tailored for displaying Sonic 2 in HD.

http://forums.sonicretro.org/index.php?showtopic=17323

MrTeressaBond
September 10th, 2009, 14:55
The link you have provided to the Sonic 2 HD is quite interesting and i alsmost very excited however once again upon having a closer look i can see the resizing method has a undesirable effect, which im kind of glad anyways.

Anyways i will have a look around, but i dont understand why (on what im asking and talking about) could be trade secret, but i suppose if one can programme the emulator to use the graphics card to do this filtering?

Also where would i discuss about advance prgramming for consoles around here?

in addition, i forgot to mention this but a few days ago when i was researching backward compatibility for the SMS/SMD etc. i came across KEGA by Steve Snake, and i must say this guy is a genius and i am very tempted to contact him about what i am doing and if he can help despite my small or limited knowlege, i am merely wanting to get this to happen but with great help with other who i will credit highly for their work. His work on his emulation of those console are apprantly accurate enough that any hardware glitches will even be emulated.

JLF65
September 10th, 2009, 18:20
You want boards that target specific consoles for more advanced info. For example, if you wish to talk about the SEGA 16 bit console and add-ons, your best place would be SpritesMind (by the way, Steve Snake is a member there).

http://gendev.spritesmind.net/forum/index.php

A better place for Dreamcast discussions would be DCEmulation.

http://dcemulation.org/phpBB/

A better place for PS2/PSP/PS3 would be PS2Dev.

http://forums.ps2dev.org/index.php

If you go to these places, please read all the old threads first to see if your questions are already answered (they usually are). Also be sure you're asking for specific advanced info and not generic beginner level programming. For example, go to any dev board and ask how to do collision detection for a 2D platformer and all you'll get is ridicule.

MrTeressaBond
November 6th, 2009, 00:41
Hello there, sorry for the late reply again, been abit busy with University and stuff, and finally got some money and needing to make films and etc (no i dont work), but i am still keen on this since i have something to help me abit on this.

i have chekced out those websites but not so thoroughly as one would have hoped for, i would indeed need to sign up and stuff, however they all look very advanced to me and im abit afraid going in with the image like a noob and asking a 'near' impossible question, a person with little knowlege but big ambition :(

Ive also done initial research on Supersampling and i think ive nailed it:

http://www.neoseeker.com/Hardware/faqs/kb/10,72.html

if i am correct, the process of Supersampling itself is resizing already of it own process, by allocating pixel nearby at a higher resolution and then sampling it down to its final display res. I believe from this that i will gain astonishing results from older games giving them new life but being extremely faithful and not like if they've been redrawn (like x2Sal and etc).

Because of wat im asking, do you think someone like Steve Snake would evr help a little guy like me for this project? and would have the patience as well on doing so? to even also stand the ongoing talks from me?

JLF65
November 6th, 2009, 17:54
You never know if you don't ask. :)

MrTeressaBond
November 7th, 2009, 00:14
Yes of course, but i dont knwo which of the sites to join and also how to ask as well, what do i ask? do i come up with my project? and spill the beans? Or do i ask relevant questions to what im asking for and etc.?

also, because of the brilliance of Kega Fusion is, i was thinking already of implenting that kind of code for hardware emulation because of its total accuracy which is exactly what im looking for, and im hoping whatever i am doing will bring it further or make better use of it. Do you think he would ever let anyone use or touch his precious thing? or even do a job for someone volenteeringly? :(

JLF65
November 11th, 2009, 21:01
The more technical the forum, the better your chances of getting a real discussion with a dev. If you wish to talk to Snake, you would have better luck over at SpritesMind than here.

Also, be frank with devs. They know how to keep their mouths shut. Most good devs are usually under a number of NDAs already. I'm under three myself, currently. If you really need to keep it that secret, go to an office supply store and get one of those pre-made legal docs for an NDA. You'll need to say at least enough to interest them into signing it.

gtmtnbiker
February 12th, 2010, 21:14
JLF65, I have to say that you have the patience of a saint in answering that guy's questions. Just about everyone else would put him on ignore. I'm not sure why he's trying to ask all of these technical questions when clearly he does not have the background to comprehend it.

MrTeressaBond, what are you trying to do? Unless you have a pile of money to fund some project, I would discourage you from bothering developers like Steve Snake.

MrTeressaBond
February 19th, 2010, 17:23
I am very appreciative of JLF65's help and replies, even though it may place me in a noobish section, i am confident that i do have some technical background but i do not know EVERYTHING thus why i asked such questions, i think i already made aware that i might be abit repetitive about this hoping that i wouldnt come across as an annoying user here as well.

I am not a rich person at all, but the project doesnt need a large sum of money either as that is one of my goals, its an on and off project due to my studies in Film & TV (thats where my main technical background lies in, it doesnt stop me from learning gaming as well due to the small similarities between the two.)

I have not yet contacted Steve Snake, soon i will but as JLF65 has pointed me, i will need to read up those forums he has linked me and possibily join them.