Sonic Engine Demo Attempt at a completely C-based portable Sonic Engine
#32
Posted 30 November 2008 - 11:30 PM
Quexinos, on Dec 1 2008, 02:29 PM, said:
Also I didn't know that Retro Sonic used an actual Sonic engine. Last time I played it, it just seemed so so. I liked it, but I thought E02 and ProSonic were closer to the real engine.
I don't know where that came from, but none of the code in the Retro-Sonic engine is ported from the originals. It's all my own. In fact the 2008 revision of the engine is capable of more than just Sonic like E02, it's just that my primary use for it is for Sonic etc etc. I know the physics aren't 100% to the real games, but personally think that the difference is too minor to detract from it feeling like Sonic. I'm more focused on having a fast, flexible engine, with a good tool set (The RSDK) and nifty graphical effects... not to mention actually trying to get Retro-Sonic XG complete
#33
Posted 01 December 2008 - 12:06 AM
To be honest, it plays and feels like it is some sort of OMG EARLY BETAZ or something like that. You know, when they're just throwing ideas down and just whipped up an engine to get an idea for what kind of gameplay they wanted and also to see how their art would look in motion.
At any rate, it seems to function just fine playing the included .exe using WINE.
Edit: well, it plays just fine, broken loops and sloppy physics aside. I mean it doesn't outright crash on me.
#34
Posted 01 December 2008 - 12:32 AM
The Taxman, on Nov 30 2008, 10:30 PM, said:
Quexinos, on Dec 1 2008, 02:29 PM, said:
Also I didn't know that Retro Sonic used an actual Sonic engine. Last time I played it, it just seemed so so. I liked it, but I thought E02 and ProSonic were closer to the real engine.
I don't know where that came from, but none of the code in the Retro-Sonic engine is ported from the originals. It's all my own. In fact the 2008 revision of the engine is capable of more than just Sonic like E02, it's just that my primary use for it is for Sonic etc etc. I know the physics aren't 100% to the real games, but personally think that the difference is too minor to detract from it feeling like Sonic. I'm more focused on having a fast, flexible engine, with a good tool set (The RSDK) and nifty graphical effects... not to mention actually trying to get Retro-Sonic XG complete
dammit, sorry. Stealth brought it up and I thought he meant it was a port. So ports are from Saxman and Stealth, right? Retro Sonic is a clone, right? Please tell me I got at least that right.
Quote
Did ANYONE read the first post? They're not SUPPOSED to work yet. They won't work until the objects are implemented which is the next step.
As for Sonic on the PSP, this idea intrigues me.
#35
Posted 01 December 2008 - 12:53 AM
The Taxman, on Nov 30 2008, 11:30 PM, said:
Quexinos, on Dec 1 2008, 02:29 PM, said:
Also I didn't know that Retro Sonic used an actual Sonic engine. Last time I played it, it just seemed so so. I liked it, but I thought E02 and ProSonic were closer to the real engine.
I don't know where that came from, but none of the code in the Retro-Sonic engine is ported from the originals. It's all my own. In fact the 2008 revision of the engine is capable of more than just Sonic like E02, it's just that my primary use for it is for Sonic etc etc. I know the physics aren't 100% to the real games, but personally think that the difference is too minor to detract from it feeling like Sonic. I'm more focused on having a fast, flexible engine, with a good tool set (The RSDK) and nifty graphical effects... not to mention actually trying to get Retro-Sonic XG complete
I'm still waiting to see if Retro Sonic will ever get out there to the public. Not only does it sound easier to use than the current programs(though I'll admit I can't be sure of that as I haven't researched them much), but the thought of Dreamcast compatibility makes it just all the more nifty :D
But to get on topic, I think this project shouldn't be discouraged just because of the numerous other engines. I think a 100% port of the genesis code to C could really help for porting to other platforms, and expand the possibility of Sonic games on more than just PC and Genesis(and DC is Retro Sonic ever goes public :p). If something like this were perfected then there could be more engines for all types of platforms out there.
Don't give it up
#36
Posted 01 December 2008 - 12:56 AM
#37
Posted 01 December 2008 - 12:59 AM
Quote
For those who don't understand this, there is a highly significant difference between emulation and a port. Emulation is the process of having one piece of hardware simulate other hardware in order to run a program that wasn't developed for the system, such as running a game developed specifically for the Genesis on the PSP. That responsibility falls primarily on the PSP's main processor, which now has to translate opcodes it doesn't natively understand, simulate a different addressing structure and process access to "RAM" and other hardware such as graphics and sound, and simulate the process that the Genesis hardware uses to turn that data into data that is THEN fed through the PSP's actual graphics/audio hardware. That's not to mention interaction and simultaneous operation of the Genesis's 68k and z80 processors. The video and audio hardware on the Genesis (and other game console systems) handle complicated processing of data, like generating the screen image from tiles, nametable tile maps, sprite mapping data, and sprite/plane prioritizing, which would otherwise put alot of stress on the main processor, and would render games like Sonic impossible with the Genesis' 7MHz processor. The PSP has a 333MHz processor, though, and probably still has a tile/sprite video mode that can still take care of blitting and priority (I'm not sure about that) once the data is converted to it's native format. All of the required processing would still be a tight squeeze, though, and isn't quite as easy to manage on systems with even slower main processors, such as the DS, which only has a 67MHz main processor (and although it also has a 33MHz subprocessor, splitting the task would just make things even more complicated, and that processor is already burdened with responsibility to manage some of the DS's hardware). I haven't used any DS emulators personally, but I imagine that it's pushing it trying to squeeze out a Genesis emulator to run games at full-speed. The more complicated the game, the more slowdown you're going to see
The alternative is a port, which would be written specifically for the system you plan to be running the software on. A port (created by a competent person, anyway) has the benefit of not having the overhead of simulated hardware, allowing it to run on "lower-end" systems, especially if that system still has similar I/O hardware (in that, in this case, it still has hardware tiled/sprite 2D graphics rendering, and optionally, some native FM synthesis or something, though if that were available, it would probably still have a different sound), which would be why Sonic 1 GBA runs so well. Similar ports of Sonic 2 and even Sonic 3 would run just as well on the GBA
Quote
Quote
One thing I have trouble explaining to people is that E02 is NOT a "Sonic Engine". I abandoned the program I used for "Project Mettrix" in 2003 for a rewrite, but I decided to make it much more extensible and generic. I've even started a Megaman game with it. I'm also still building "Project Mettrix" with it, but really anything that makes it "Sonic" is scripted, meaning everything that makes the character do whatever Sonic would, right down to the physics. Only the position adjustment and collision are handled by the program, and it functions differently than the original Sonic games in that it traces the path instead of jumping to position and checking for it again, which is much more "accurate", but is too slow to be reliable on something like the Genesis. I prefer the method for that project because it prevents falling off convex curves, or entering the wall when traveling around a concave curve too fast and stopping-dead, which shows up most prominently in Sonic 3
Quote
I'm not exactly sure I see the purpose. The current disassemblies are perfectly modifiable, and I'm not the only one who would disagree that translation to C would make it any easer. I'm aware that it's a common misconception people have that they would be better able to work with something if it were presented in C than in ASM even though they've never done anything in the way of game development in their life, but that's usually just ignorance and laziness talking; They don't know enough about either language to know that it takes just as much effort to learn and use either of them, which isn't to mention learning the basics of game development and how to manipulate their target platform, and so go for the easiest-sounding solution. I personally avoided ASM for a while, myself, because it seemed "scary", and I still don't like x86 ASM (not only because it's kind of crappy, but also because of the rest of PC architecture, including Windows), but I instantly felt at ease using 68k ASM once I gave it a chance. Also, the C edition would add overhead during compilation through code that isn't quite as optimized, unnecessary header/footer code in function calls during compilation, etc.. , not to mention any that may be intrudoced during the translation process itself, which overall causes the program not to perform as well as the original in that it will be larger, extra processor cycles would be used by many operations, and there may even be wasted RAM depending on how RAM usage is set up. Working with a higher-level language like that unnecessarily forfeits a significant level of control over the generated code
That's to say nothing about portability, I just disagree that a Genesis C rewrite is especially practical. In terms of portability, though, you will have concerns about data formatting in terms of making use of the system's hardware, such as the conversions I had to do for the GBA, as it wouldn't be appropriate to leave conversion up to the program during runtime (it has to be done at some point). I don't think that was really made clear. Also, if Genesis "backward-portability" were taken out of the equation, there's alot more room to change how things work, which I mention in reference to what your original, unmodified post said about expansion. That's when you get into the prospect of keeping something like the physics entirely pure, or going the route I did when I decided how to manage level collision with E02, where the whole "exact port" thing kinda starts to fall apart.. It really depends on what you or any of the users actually wants to do with it, I guess
#38
Posted 01 December 2008 - 01:24 AM
Quote
Well, I know it's something Rob's wanted to do for a long time and even though you don't find ASM all that hard, I know other people prefer C. It's all French to me either way but...
I understand that you have doubts and are warning him about certain things, but Rob knows what he's up against. He's dedicated a lot of his time to this, and hey as far as I'm concerned, if he wants to do it, he should... Wouldn't it be awesome to have all of Sonic 2 on the GBA? Remember how much people loved your Sonic 1 on the GBA?... imagine the whole game. Rob's just making it possible and he's programmed for the GBA before so I'm going to assume he knows what he's doing in that aspect. In the long run I think it would do more good than harm.
Also I'm not trying to argue with you or anything or start anything, you do bring up a lot of good points. I'm just one of those "Hey if you wanna do it, go for it" people.
#39
Posted 01 December 2008 - 01:48 AM
You also bring up another point I forgot to mention. A full release like that is treading on dangerous territory. Precident for distributing sourcecodes like the current disassemblies is set by court cases legalizing obtaining method by means of reverse-engineering, and PC game source releases such as Wolfenstein, DooM, Half-Life, I think, and probably others, which provide you with the code, but no more data than you were given with the shareware version. That's where this becomes an issue, releasing the code (or a derivation thereof), along with all original data is hardly any different than distributing copies of the original build. It's copyright infringement/piracy. I was under the impression that that's why the data for the disassemblies was set up to be extracted by the user instead of included with the package, but I guess the decision may have been based on download size concerns (even though that then makes it slightly more difficult for the user to set up). This is why I didn't create a complete Sonic 1 remake when I made the original GHZ test level for Project Mettrix, and why I didn't create a full-game port to GBA myself. That's not to mention that it would also render me unable to use the prospect of a complete port as an incentive to get any professional work, or could cause the company to take and distribute my work for their own profit, but those things are beside the initial point I was making. This was what stood out the most to me when I saw that a significant portion of the game data was included with the current demo, and that seems to be the part of the product held most important to a company
I wasn't really telling him to stop doing anything, but those are some things I thought were worth mentioning
I also wonder, though, why the current demo has the errors that it does when Rob mentioned "recreating the game engine code instruction by instruction". I understand that it's incomplete; I'm just confused about why it performs incorrectly in EXACTLY the way that it does..
#40
Posted 01 December 2008 - 02:10 AM
#41
Posted 01 December 2008 - 07:19 PM
Stealth, on Dec 1 2008, 01:59 AM, said:
This is truly a "to each his own" type of argument. I can work with assembler just the same as I could clean oil out of cement floors for a living. I've done both but prefer neither, if I have a choice. This provides a choice. I find assembler something I can handle, but it requires a lot more brain power and imagination, and it's all too easy to screw up the stack or modify the wrong register and get unpredictable results, which was one of the problems I constantly ran into. And on your next point...
Quote
This is true. However, of all higher level languages I could use, I know of no greater controllable language than C. The memory you allocate is very specific based on types you use. I have so far recreated all of the major arrays used by the system and require exactly the same amount of memory they originally took, I ensured that with tests before committing. If you use GCC cross-compiling for 68K the RAM will be the same. Yes, there is always the trouble of the code not being as efficient. This is a fact of life with any higher level language. The best thing I can say is, observe the same healthy practices you use in assembler in C. Don't make unnecessary function calls (inlines are supported even in C with GCC), perform shifts / logical operations as appropriate, avoid straight up multiplication and division as much as possible. And, of course, turn on optimizations. I also do post-compile audits of code to see if they've become "ridiculous." However, GCC has time and again shown me some amazing generation that I personally would never have thought of doing if doing assembler by hand. Obviously that's not ALWAYS the case, so mind critical loops. It's a programming game. If I get further along and see that the performance will never be adequate (it will almost certainly be less, but I wouldn't write it off yet) then I'll see the futility of it.
Quote
Good ol' endianness.
Quote
Yes, that will depend on that. My first goal is to make it work. But keep it abstracted enough that the graphics system can be pulled later and replaced with something better.
Stealth, on Dec 1 2008, 02:48 AM, said:
Well, first of all, the "final" version of this, since it uses the same data in the same format as Sonic 2, can and likely will be distributed without data. I only did it this time for a quick "get up and go" demo. We didn't get into how my system works in detail. The "resource packer" program gathers up resources into a ".s" file and produces a header file that gets compiled with GNU as and externalizes labels. This is linked with compiled source. Thus there is no reliance on data actually being present in your code. So there's no reason I should have to distribute it either. (Just source and the freeware compiler.) And because I put the main code in a library and game specific code outside of it, making a whole new game is as easy as throwing away the other half.
Believe me, I did consider that venue. However, I have no evidence to support this, but I have heard from two different people with completely different associations that say that Sega has "lost" their original source and they actually are interested in what goes on with these works, rather than against them. I don't know if that's true, but I can see the possibility in the situation. Obviously if I got a cease and desist notice I would quit. But yes, the future would be a source/binary distribution sans data, and someone will have to use the existing tools on their own ROM with the split and whatnot OR obviously use their own data and forgo some of that legality. I don't know what can be said other than there's probably no practical difference to distributing assembler and data versus distributing C and data. All of us being in this association are treading foreign waters and that's just the name of the game.
As for your hope of professional work, I have no comment. Maybe it will happen, maybe it won't. I would say there's a far greater chance they're waiting for one of me so they can get it free than waiting to pay you. They are likely more interested in developing based on resources available to them, especially with some abysmal Sonic titles ruining the name and putting them in deep water. Sure I would love to do it for the same reasons you have, waiting for a paycheck for a hard earned porting job, but I'm not holding my breath. I'd rather do it and talk about having experience working with 68K assembler and making C ports of functions (non-specifically) than waiting for a contract that may never come. (Although seriously, if you're contracted tomorrow, I'd probably quit out of respect.)
Quote
Okay, I "sales pitched" that a little bit. It is instruction by instruction, but my guess is I made a few misinterpretations, based on the problems I do have reading assembly. It's darn close with subtle errors. I've gone through it before casually and found conditionals that get reversed or forgetting to pay attention to byte access and thus not wrapping an addition value in C correctly (which likes to convert up to integers if you're not explicit.) It just means it's time to audit the source function-by-function and clean up errors. Which I will certainly do.
#42
Posted 01 December 2008 - 07:36 PM
But on the legal thing, aren't Roms illegal as well and we distribute them? I really think if Sega had a problem, they'd have stopped us by now. I mean Nintendo has all ready done this but I haven't heard of Sega doing so.
But I'll stop now because Tweaker thinks I'm making an ass of myself. =P
#43
Posted 02 December 2008 - 12:31 AM
#44
Posted 02 December 2008 - 12:47 AM
#45
Posted 02 December 2008 - 04:29 PM

00