Jump to content

  • Log In with Google      Sign In   
  • Create Account

Has there ever been game engines or libraries in assembly?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
14 replies to this topic

#1 bigbadbear9885   Members   -  Reputation: 177

Like
0Likes
Like

Posted 03 January 2014 - 11:45 PM

I know a bit of C++ and know about modern engines and libraries and am interested but don't know much of it.

 

I've noticed that back in the day when assembly was almost the standard for developing games (Nes, Genesis, Snes) that there were barley any shared engines. The only thing I've heard of is that Batman Forever on SNES and Genisis used Mortal Kombat's (Genesis port's) engine, and Super Noah's Ark 3d using Wolf 3d's (Snes port's) engine, but I imagine those games were programmed in C.

 

It makes me think it was because game engines, libraries, reusable/recyclable functions are not possible in assembly unlike C/C++ etc, but please correct me on whatever I'm wrong on, and if there's such thing as shared engines, libraries etc in assembly some examples or mentions would be nice.


Edited by bigbadbear9885, 03 January 2014 - 11:46 PM.


Sponsor:

#2 Nypyren   Crossbones+   -  Reputation: 4798

Like
1Likes
Like

Posted 04 January 2014 - 12:59 AM

There's nothing special about assembly that prevents you from making reusable functions, data types, etc. There are assembly developer tools such as MASM and NASM that let you simplify/reuse things more easily.

Transport Tycoon and Roller Coaster Tycoon were both supposedly written primarily in x86 assembly, though I'd wager only reusable functions involved in input and rendering were reused (those games both used pure software rendering).

Also, consider precompiled .lib files (static libraries). Regardless of their original language, they're in machine code now (Machine code is typically just a direct binary encoding of assembly language). The library is still usable by any language that is compatible with the library's ABI.

Edited by Nypyren, 04 January 2014 - 01:03 AM.


#3 LennyLen   Crossbones+   -  Reputation: 4023

Like
0Likes
Like

Posted 04 January 2014 - 01:08 AM

A lot of DOS games were also written in a mixture of C and assembly, where C was used for the logic and inline assembly was used for rendering, etc.

 

I wrote my own library in assembly using TASM for doing drawing operation which worked faster than the native graphics library that came with Turbo-C++ and I used that in several small games that I wrote.



#4 C0lumbo   Crossbones+   -  Reputation: 2498

Like
2Likes
Like

Posted 04 January 2014 - 01:47 AM

Apparently VD-Dev's Big Bang engine for 3DS is entirely written in assembly. http://nintendoeverything.com/interview-vd-dev-talks-ironfall-streetpass-support-tech-details-and-lots-more/

 

 

The engine used in Iron Fall is called the ‘Big Bang Engine’. Its an engine we have programmed from scratch and is optimized for the Nintendo 3DS. It took us several months to write (days and nights), and is written fully in assembly code, using all the ARM optimizations we know.

 

Although I wonder if the reality is that large chunks of code are hand-written assembly within a more traditional c/c++ framework, but the guy doing interviews isn't techy enough to know the distinction. If it really is 100% hand-written assembly, then it's a pretty impressive feat really, even if it does seem rather an unwise approach. Even if the game is a great success, they might want to port their engine to other platforms one day, and their premature optimisation of non-performance sensitive parts of the engine will make that harder. Can't help but wish them the best of luck though, I admire their chutzpah.



#5 GuardianX   Crossbones+   -  Reputation: 1522

Like
1Likes
Like

Posted 04 January 2014 - 03:52 AM

All those developers who wrote games with assembly for nintendo and co did that because hardware was very specific, which is why nintendo should have developed their own high-level language compilers, which they clearly cba to do. The development process in which high-level language utilized goes a lot faster than that based on assembly.



#6 Olof Hedman   Crossbones+   -  Reputation: 2950

Like
1Likes
Like

Posted 04 January 2014 - 06:20 AM

All those developers who wrote games with assembly for nintendo and co did that because hardware was very specific, which is why nintendo should have developed their own high-level language compilers, which they clearly cba to do. The development process in which high-level language utilized goes a lot faster than that based on assembly.

 

To be fair, its a very different thing, and a lot more straight forward, to write asm for 8 and 16 bit processors, then it is for a modern processor, but implementing something like a C compiler on 8 and 16bit processors isn't very efficient.

With limited memory and resources the push for high level languages wasn't that big.


Edited by Olof Hedman, 04 January 2014 - 11:26 AM.


#7 Madhed   Crossbones+   -  Reputation: 3134

Like
1Likes
Like

Posted 04 January 2014 - 07:56 AM

The Lucas Arts Adventures like Monkey island and Day of the tentacle used a virtual machine called scummVM. Actually I don't know if they used assembly for the engine but given the time I'm pretty sure large parts of it were written in ASM.

 

Also, Another world (Out of this world) was written as a virtual machine and could thus be ported to a lot of different platforms.



#8 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
0Likes
Like

Posted 04 January 2014 - 09:06 AM

For commercial game developers, directly handling in assembly has a few advantages but at the sacrifice of many of the advantages of middle or high level coding. Game engines are supposed to make coding of functions much more extensive and adaptable. The high level coding over a game engine in the middle over the assembly is much more friendly to features, innovation, and art assets.  Art assets in particular typically take a large shop of tools which I doubt will ever be available like that for assembly and far from it likely.

 

You just simply get much more for the dollar or the hour with middle or high level coding compared to assembly.


Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#9 AllEightUp   Moderators   -  Reputation: 4268

Like
3Likes
Like

Posted 04 January 2014 - 11:02 AM

It makes me think it was because game engines, libraries, reusable/recyclable functions are not possible in assembly unlike C/C++ etc, but please correct me on whatever I'm wrong on, and if there's such thing as shared engines, libraries etc in assembly some examples or mentions would be nice.

 

There is actually a fundamental reason which caused this more than anything else.  Let me first mention that I'm doing this on vague memory from the way back machine, so the details may be off, please don't nuke me for such mistakes too much.. :)  Anyway, take a platform such as the Super Nintendo and go over the spec's for the CPU and memory.  The processor was basically a 3.5Mhz split 8bit/16bit machine.  In general this was simply the 6502 instruction set enhanced with 16 bit registers and if I remember correctly a 16bit multiplier.  The problem here is the 3.5Mhz clock rate which directly maps to how many instructions could be processed per second and the lack of registers (only had accumulator and x/y index registers for general usage) exaggerated the problems.  Unlike current CPU's where clock rates don't map directly to instructions per second due to pipelining, caching etc, there was no pipelining or cache on that CPU and as such the clock rate directly mapped to the number of bytes of memory which could be read and that mapped directly to the number of instructions which could be processed.  (NOTE: zero page could be considered cache as it was faster to read/write from, but you had to manage it manually.)

 

You could basically fetch or store 3.5 million bytes of memory per second.  In the case of a simple NOP (0xEA opcode, I'll never forget that one) instruction this meant the CPU loaded the piece of memory pointed to by the PC, incremented the PC and setup the instruction processor on the first cycle.  The second cycle of the instruction performed the actual NOP work, which of course did nothing.  So, you have just split the 3.5 million clock cycles in half to 1.75 million per second with the fastest "do nothing" instruction on the CPU.  Most instructions could take significantly more clocks and as such you generally ran less than a million instructions per second.  So, using round numbers, assume your typical code could run 300,000 instructions per second, average of about 3.5 cycles per instruction which is somewhat realistic as I remember it, and you want to target 30FPS, you have only 10,000 instructions to use each frame.  Oh, but there's still more loss, you have to update any hardware/graphics typically only during the vertical blank or you cause tearing and other undesirables and of course there are interrupts etc taking up some of those instructions.  So, you might only be able to use 7000 instructions per frame and still hit 30FPS.

 

So, why were the engines not made reusable and generic?  Quite simply because any *generic* code was refined down to do only exactly what was needed in order to fit into the hard limits required to maintain a given framerate.  In the process of refining the code you are obviously removing any concept of generality involved.  There really were no other reasons, it wasn't a language issue and no compiler could touch the required level of optimization, it was just the only practical way to do things at the time with the available tools.



#10 Anthony Serrano   Members   -  Reputation: 1248

Like
2Likes
Like

Posted 05 January 2014 - 05:02 AM

All those developers who wrote games with assembly for nintendo and co did that because hardware was very specific, which is why nintendo should have developed their own high-level language compilers, which they clearly cba to do. The development process in which high-level language utilized goes a lot faster than that based on assembly.


At least in the case of the NES and SNES, development in high-level languages is unrealistic, owing to low clock speeds (1.79 MHz and up to 3.58 MHz, respectively), limited register counts (1 general-purpose and 2 index registers), small stack space (256 bytes for the NES, up to 8 KB on the SNES), and in the case of the NES small RAM (only 2 KB) and compiler-unfriendly bankswitching to increase the effective address space.

It's no coincidence that the first console to see significant use of high-level languages was the Sega Genesis, whose 68000 CPU has a much more compiler-friendly architecture. (For example, some Genesis EA sports titles were programmed in Pascal rather than assembly.)

I know a bit of C++ and know about modern engines and libraries and am interested but don't know much of it.
 
I've noticed that back in the day when assembly was almost the standard for developing games (Nes, Genesis, Snes) that there were barley any shared engines. The only thing I've heard of is that Batman Forever on SNES and Genisis used Mortal Kombat's (Genesis port's) engine, and Super Noah's Ark 3d using Wolf 3d's (Snes port's) engine, but I imagine those games were programmed in C.
 
It makes me think it was because game engines, libraries, reusable/recyclable functions are not possible in assembly unlike C/C++ etc, but please correct me on whatever I'm wrong on, and if there's such thing as shared engines, libraries etc in assembly some examples or mentions would be nice.


What you're seeing is largely due to the fact that the idea of a "game engine" is relatively new in terms of game development - in the era when games were predominantly programmed using assembly, people didn't really talk about "engines" per se.

Part of this is that people didn't really talk much about "engines" before the era of 3D games and especially before the 21st century, where the sheer amount of code that can be reused from game to game increases drastically (due to 3D graphics being far more code-intensive than 2D graphics) coincidentally more general-purpose solutions become feasible (due to increased RAM and more powerful processors). Another part of it is that what we now call using an engine was just called code reuse back then, and was as a rule done in-house rather than with engines licensed from 3rd parties.

But make no mistake, large amounts of code were reused. For example, Square released 3 Final Fantasy games on the Famicom in Japan, and all three share significant amounts of code*. Square's SNES RPGs also have a lot of code in common. Super Mario Bros, Metroid, and Kid Icarus share code. Most Capcom-made NES games are built on one of two code bases depending on when they were developed.

As a general rule, any game made in the 8- and 16- bit eras will share a decent amount of code with other games from the same developer on the same platform (Batman Forever on SNES and Genesis and the Genesis port of Mortal Kombat II, which you mentioned, were developed by the same studio, Probe Entertainment), and this trend increases in the early 3D era up to the modern day where many games are built upon large collections of general-purpose code - which we now call "game engines" - that are often licensed from other developers (much like Wisdom Tree licensed the Wolfenstein 3D SNES code from id software to make Super Noah's Ark 3D).

---

* This includes, for the first two, segments of code that serve only as placeholders for English-language ports - one of which never got made. The NES port of Final Fantasy uses different bankswitching hardware than the Famicom original. The Famicom games have code that does nothing in the Famicom version, but can be easily changed into code that controls the bankswitching hardware used in the NES version of Final Fantasy without changing code size or performance.

#11 fir   Members   -  Reputation: -456

Like
0Likes
Like

Posted 05 January 2014 - 06:09 AM

 

Part of this is that people didn't really talk much about "engines" before the era of 3D games and especially before the 21st century, where the sheer amount of code that can be reused from game to game increases drastically (due to 3D 

 

I still find a name "engine" as a unpleasant term (personally), the bettter term imo would be a 'subsystem' or something like that

 

I liked the old term library, in the domain of windows programming 

people stopped to call winapi (api) things as a library because it was

part of the system but now i think it eventually can be called library

too 

 

I also somewhat dislike the term SDK, at the beginning of learning this term i also disliked the term 'framework' but now i am not to much angry

on that



#12 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
1Likes
Like

Posted 05 January 2014 - 11:02 AM

Engine is more descriptive whereas the other terms are too vague.  Like a vehicle, the motive source of the operations for a game is typically in the game engine but the computer brain of the vehicle is the game source code.


Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer


#13 Ravyne   GDNet+   -  Reputation: 8160

Like
1Likes
Like

Posted 05 January 2014 - 11:56 AM

Back when I was writing games in high school using QuickBasic 4.5 all the libraries were written in assembly language. The libraries were mostly for rendering, but often also provided things like better joystick and keyboard handling or high-red, high-color screen modes that QB didn't offer directly. IIRC, some of them offered access to SoundBlaster cards and to extended/expanded memory.

You can probably still find them online if you want to take a look. You could write C-language bindings pretty easily I think, but of coarse you'd have to build your code against DOS. The big one was DirectQB, the other was CosmoX.

There's a part of me that wants to do just that myself some day, as an exercise in nostalgia.

Edited by Ravyne, 05 January 2014 - 12:01 PM.


#14 fir   Members   -  Reputation: -456

Like
0Likes
Like

Posted 05 January 2014 - 11:59 AM

Engine is more descriptive whereas the other terms are too vague.  Like a vehicle, the motive source of the operations for a game is typically in the game engine but the computer brain of the vehicle is the game source code.

subsystem is more clear and general (you could name everything applicable as a subsystem), engine term is at least for me somewhat opaque

 

what is engine? is this a pack of dll's or something more?



#15 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
1Likes
Like

Posted 05 January 2014 - 12:38 PM

The game engine is everything that propels the development and operation of a game.  It typically includes render to screen libraries such as graphics APIs, device input library, sound library, miscellaneous dlls, encoders and decoders, runtime clock. scene graph, compilers, JIT compilers, extractors, installers, effects libraries, physics library, and sometimes a whole workflow pipeline for software development is included but often used are interfaces to outside applications and external software for integrated workflow pipeline.  Sometimes only the parts of the game engine needed to execute and play the game are included but sometimes part or all of the development tools are included for developers and modders. Game source code can be distinct from game engine source code, partly integrated, or fully integrated. Packaging only the game coding and game engine libraries needed for game execution and play is the most common distribution to end-users. It is possible to create a game code which interfaces interoperably with two different versions of a game engine. This is sometimes the case when the game code on a new release version of a game is fundamentally the same as the original game code but it is run with a new game engine.  Some players have complained that they got tricked by the publisher advertisement when a game was advertised as being built on a new game engine but the actual game structure and function was basically the same. On the other hand, some "once and done" development has the game coding and much of the game engine so integrated that it is either impossible or impractical to separate them.   


Personal life and your private thoughts always effect your career. Research is the intellectual backbone of game development and the first order. Version Control is crucial for full management of applications and software.  The better the workflow pipeline, then the greater the potential output for a quality game.  Completing projects is the last but finest order.

 

by Clinton, 3Ddreamer





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS