Next Generation Emulation banner
1 - 20 of 57 Posts

· Registered
Joined
·
5 Posts
Discussion Starter · #1 ·
Hello everyone,

I was wondering where i should start when i would like to create my own emulator.
I'm not a proffesional programmer but i'm trying to learn as much as possible. ( Standard c++, OOP etc..)

What if i know how to work with the windows api's and directx ?
I should have enough skills to create a simple emulation right ?

I would be thankful if someone told me what i should learn/do if i would like to create an emulator.

Cheers,

k2xx
 

· Registered
Joined
·
9,992 Posts
Sorry to burst your bubble here kid, but you are really biting off more than you can swallow if you think you can learn to program by writing an emulator. It's probably one of the most difficult things you can do.

DirectX is the least of your worries, what you'd need concentrate on is learning the x86 processor archecture, as well as that of the processors present of your emulated system.

No offense, but give up on this plan for now, and master the programing basics first. You'll be grateful you did later on ;).
 

· Registered
Joined
·
5 Posts
Discussion Starter · #4 ·
I must have said it wrong..

I don't want to jump directly into the emulating stuff but i was just wondering how it works and maybe some info on how to begin after my programming skills are better.
thnx for the links Chrono Archangel.. i'll bookmark them for later use. :)

Cheers,

k2xx
 

· Registered
Joined
·
1,577 Posts
Lower-level languages like C or C++ are more suited to emulation development. Also, some assembly wouldn't hurt. By far the simplest project to start with would be Chip8. But be warned, Chip8 is a very easy project. Anything else will be a lot more difficult.

Anyway, I now feel inspired to program a NES emulator. :p
 

· Registered
Joined
·
5 Posts
Discussion Starter · #6 ·
scottlc said:
Lower-level languages like C or C++ are more suited to emulation development. Also, some assembly wouldn't hurt. By far the simplest project to start with would be Chip8. But be warned, Chip8 is a very easy project. Anything else will be a lot more difficult.

Anyway, I now feel inspired to program a NES emulator. :p
sweet man!,

i'm not that good atm.
OOP is kinda hard to understand but i'm getting there. :)
i just need to have patience.. lot's of patience.

Cheers,

k2xx
 

· War Games coder
Joined
·
1,927 Posts
TBH, OOP is rarely (if ever) used in an emulator - it's all procedural. See this instruction, do this, not inherit this, that and the other and then do this.
 

· Registered
Joined
·
1,577 Posts
Besides OOP adds extra overhead and slows an emulator down. Though zenogais is an OOP nut in his emulator projects. :p
 

· PCSX2 Coder
Joined
·
11,343 Posts
i dont really see C or C++ as a full on OOP language like VB for example, its only really the GUIs you make that are object oriented, you dont rely on other dll files as such to make a program work, where in vb you do rely quite heavily on components such as timers and windows classes.

this is why C++ is greatly advisable for emulator programming, its not too difficult to understand compared to the likes of Assembly (even tho assembly would by far be the best choice) but it also isnt as slowed down as VB as it doesnt completely rely on what windows uses.
 

· Emu author
Joined
·
1,490 Posts
refraction said:
i dont really see C or C++ as a full on OOP language like VB for example, its only really the GUIs you make that are object oriented, you dont rely on other dll files as such to make a program work, where in vb you do rely quite heavily on components such as timers and windows classes.

this is why C++ is greatly advisable for emulator programming, its not too difficult to understand compared to the likes of Assembly (even tho assembly would by far be the best choice) but it also isnt as slowed down as VB as it doesnt completely rely on what windows uses.
C++ is just as OOP as VB, your comments make me wonder if you completely understand what OOP is about...

Writing an emulator in assembly isn't necessarily the best way to go. First, you lose platform independence, second, your code might not be as good as the compiler's if you aren't good at hand optimization. For emulators of powerful machines you need dynarec anyway so it'll already be platform dependent but for a simpler emulator I doubt efficiency would even matter enough to sacrifice portability in that way.

For emulators C is the best way to go. Some people use classes for emulators, but I have yet to see anyone who did it in a way that wasn't a complete waste :\

- Exo
 

· Premium Member
Joined
·
8,437 Posts
I would NEVER reccomend C++ for emulator programming (when emulating a recent console). I found an EXCELLENT tutorial on writing an emulator. I found it on alta vista. I'll take a quick look for it and see if I can find it again.
 

· Premium Member
Joined
·
8,437 Posts
Sorry, can't find it. I'll upload it when I get a chance.

Before trying to emulate a certain system, learn how to code for it. Writing a GB emulator is much easier when you have coded games for it in it's assembly language. :p
 

· Registered
Joined
·
5 Posts
Discussion Starter · #14 ·
I'm not learning programming just because i want to create an emulator but also stuff like application development and game engines.

It's a long way to go but i'm getting there.
Lately i did some tutorials on C++ and ordered some books to get me busy for a while.
Though i'm in a exam year so i won't have alot of time to do some coding.

Cheers,

k2xx
 

· Premium Member
Joined
·
3,092 Posts
blueshogun, if you know how to edit as i can see in your second post, then do not double post, i see no reason for doing it here, specially considering there isn't even half an hour difference between the 2 posts.
 

· Premium Member
Joined
·
8,437 Posts
blueshogun, if you know how to edit as i can see in your second post, then do not double post, i see no reason for doing it here, specially considering there isn't even half an hour difference between the 2 posts.
Sorry I-Chan, it won't happen again. :innocent:

I'm not learning programming just because i want to create an emulator
Yes, i see that. I was just telling you which language is better to use when you are ready :)
 

· Registered
Joined
·
116 Posts
blueshogun96 said:
I would NEVER reccomend C++ for emulator programming (when emulating a recent console).
And why is that ? It's quite the opposite ! :rolleyes:
The more recent is the console, the more likely C++ can be used for its emulation ... there's a lot of recent console emulators that use C++ ;)
 

· OUYA Angel Backer
Joined
·
197 Posts
refraction said:
(even tho assembly would by far be the best choice) but it also isnt as slowed down as VB as it doesnt completely rely on what windows uses.
Assembly is a terrible choice. This is why ZSNES only runs on x86 machines and will likely never be ported to ppc or other architectures unless someone sits down and converts all those hundreds of lines of painful, painful assembly to C.

Exophase said:
C++ is just as OOP as VB, your comments make me wonder if you completely understand what OOP is about...
C++ has an absolutely terrible implementation of OOP. A proper implementation can be found in Objective C, Java, or Ruby. But using these languages makes your program take a performance hit. And emulators need all the CPU they can get. C is the best choice.

Exophase said:
Writing an emulator in assembly isn't necessarily the best way to go. First, you lose platform independence, second, your code might not be as good as the compiler's if you aren't good at hand optimization. For emulators of powerful machines you need dynarec anyway so it'll already be platform dependent but for a simpler emulator I doubt efficiency would even matter enough to sacrifice portability in that way.

For emulators C is the best way to go. Some people use classes for emulators, but I have yet to see anyone who did it in a way that wasn't a complete waste :\

- Exo
I agree.

blueshogun96 said:
I would NEVER reccomend C++ for emulator programming (when emulating a recent console).
Well, neither would I. But only because C is better. If you're hinting that assembly is the way to go, you're wrong. See above.
 

· <B><font color="lightyellow" size = "1">A BIG BAD
Joined
·
6,550 Posts
I used C++ initially (hello Exo :p), ended up with some hybrid form of C++ and C intead. Not that C++ couldn't accomplish the task, but it just had more structural overhead that I bargained for. So I had to sacrifice some legibility in order to achieve "better" performance (in other words I ended up with my own mudpit). Of course, as emulators become even more complex C++ could prove to be much more useful for these tasks. However, if the situation doesn't really call for it, stick with C, less pains that way.
 

· Premium Member
Joined
·
8,437 Posts
Runik said:
And why is that ? It's quite the opposite ! :rolleyes:
The more recent is the console, the more likely C++ can be used for its emulation ... there's a lot of recent console emulators that use C++ ;)
Sir, with all due respect, correct me if I'm wrong, those recent console emulators are using HLE. There is a reason why Cxbx uses C++ and pcsx2 uses C. If you were programming something old like GameBoy or psx it's ok. But I garuntee you if you write a LLE emulator in C++, it will be much slower than one written in C.

Well, neither would I. But only because C is better. If you're hinting that assembly is the way to go, you're wrong. See above.
I'm not reccomending asm.

I should have reccomended this earlier, just because one language is "easier" to use than the other, doesn't make it better for an emulator. C++ has alot of "junk in the trunk" and is not necissary. C is cleaner and efficient. Let's compare the two as car fuel. C++ is gasoline, and C is hydrogen. Hydrogen burns more efficiently than gasoline. Gasoline pollutes and Hydrogen does not. But if you piss of hydrogen (make a mistake in C) it blows up (complains alot with many errors and warnings). Extra caution must be taken with Hydrogen. Gasoline on the other hand, if you screw up with it it, it burns, sometimes with a "WOOSH". Does this make sense? No not really, nothing I say makes sense. The point is OOP is easier to use, but is too costly. So it's better to do it the hard way. It's okay to use C++, but IMHO only wimps rely on OOP. Procedure is the best way to go.


BTW: I found that emulation tutorial, but lost it again :???:
 
1 - 20 of 57 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top