Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Developing your own game engine??

Discussion in 'General Discussion' started by Hades II, Dec 9, 2014.

  1. Hades II

    Hades II

    Joined:
    Oct 23, 2014
    Posts:
    55
    Is it extremely complicated to develop your own game engine?? What if you only want to make it a 2d engine ..and then later on heavily rewrite it and make it 3d....how hard would that exactly be? and if possible can someone give me some sources on this...I've been hearing about many companies doing this and im just curios the development process.. '
    Thanks!
     
  2. thepenguinmaster

    thepenguinmaster

    Joined:
    May 22, 2013
    Posts:
    29
    I would not recommend trying to write a 2d engine and rewrite as a 3d. You would likely keep the 2d and the 3d parts as modules.


    Writing your own game engine can be easy of extremely difficult depending on the features you would like to include. It is like asking 'how complicated is it to paint a painting'.


    There will be some core parts that will be required: rendering, physics, resource loading, and states.

    You should plan to spend quite a bit of time working on the engine, this could take anywhere from 3-24 months depending on the complexity and experience. Realistically you would need to sink quite a bit of time into this. You would also need to have quite a bit of knowledge of DirectX, resource management, and have to make sure that it will work on all target systems.


    To be honest, unless you are planning on implementing special features that no other engine is capable of, I would not recommend doing a ground up engine. You could use a set of libraries to get you going, such as Havok etc.


    You may need to write your own engine if:

    The engine has special features that no other engine is capable of

    The game is very small and the engine would be a one-off game (would not take much time)

    The engine is very large, but would be used for several commercial games (much time and high reward)


    The honest truth is, if you set off to create your own engine, and did not have a team or the background, then it would likely never get completed if it was a complex game. I ran down this path when i was younger, and got very far, but always ended up leaving the project because I was just reinventing the wheel. By the time you implement a new feature, Unity or other professional game engines have already implemented two. Don’t waste time reinventing the wheel, unless the wheel you plan to reinvent has some quality that does not yet exist.


    If you decide to create your own engine, it would be a great learning experience, and there is a lot of value in that. Aside from that, if it is a simple game, and you don’t plan to resell the engine, I would not recommend going down that road alone.

    This is just my opinion :)
     
    kaiyum and Kona like this.
  3. MrBrainMelter

    MrBrainMelter

    Joined:
    Aug 26, 2014
    Posts:
    233
    It depends on your requirements. If your engine is only supporting one game and that game is relatively simple, then making an engine for that isn't "extremely complicated". Then again, I wouldn't call it trivial either.

    Complexity goes up significantly if you want your engine to support many games, or larger games.
     
  4. Neoku

    Neoku

    Joined:
    Oct 27, 2014
    Posts:
    261
    Yes is very complicate, but not imposible, many nice game engines are be made by one person, as Maratis 3D. Make a 2D game engine is more easy and a good exercise for then make a 3D game engine, I recomend you see the sites of open source engines as Ogre 3D for see the process. Next year I will start my own 3D game engine based on the Three.js framework. Last years many game companies are developing their own engines because you can control all aspects of the game production.
     
    Last edited: Dec 9, 2014
  5. Hades II

    Hades II

    Joined:
    Oct 23, 2014
    Posts:
    55
    Thank you everyone for your suggestions... I don't have enough knowledge to make my engine.. I'm afraid the the game I wanted to develop would be to complex to make on a engine I made... Soo yea haha I'm just gonna hold that project engine off for a while and use Unity for this project I kinda had in mind a engine kinda like runescapes
     
  6. thepenguinmaster

    thepenguinmaster

    Joined:
    May 22, 2013
    Posts:
    29
    Without giving away too many details, what deature is too complicated for unity? You would be surprised what Unity can do.
     
  7. Hades II

    Hades II

    Joined:
    Oct 23, 2014
    Posts:
    55
    That's not what I meant hahaha Unity is amazing it's just that I just kinda wanted to develop a engine just for a specific title
     
  8. MattMatt2000

    MattMatt2000

    Joined:
    Sep 6, 2015
    Posts:
    1
    If you want to make your game engine, it is not as difficult as you might think :) I wrote a complete 3D / 2D engine, from scratch, in c++/'Opengl in approximately 2 months; you might want to look at these tutorials here : http://learnopengl.com/#!Introduction ; it might take a little bit of time to learn opengl/c++; but you will have a better understanding of what really game programming is !
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    What features did your engine possess and how much prior knowledge did you have?
     
  10. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Yes it is. Game engine implies a general purpose engine and that just entails soo much. On the other hand pretty much any large task specific library can be called an engine. Terrain engine, pathfinding engine, etc.. Lots of games have these types of engines that are specific to their game, or at the very least highly customized versions of some other engine.

    Writing your own game engine for a specific game makes absolutely no sense. It violates one of the cardinal rules of software development which is don't solve already solved problems. There is just no way that most of your game is so different from every other game out there that it requires it's own engine. On the other hand you might very well have specific parts that require either a custom engine or a highly modified one. But even then you will be leveraging lessons learned from other engines, if not outright using a lot of existing code.

    People who write their own engines as a learning exercise miss a very key thing. Which is that most likely you are simply learning how to do things WRONG. And that's because the problem has almost certainly been worked on by lots of other people for many years, and the chances of you doing it better without having studied what has already been done? Basically zero. You will learn far more using an existing engine that was done well.

    Also keep in mind that many companies are not actually writing their own game engines. That's hardly ever done. They almost always start with something existing and/or leverage a lot of other existing libraries.
     
    Kiwasi and Ryiah like this.
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    Yes, like Bethesda's Creation engine is technically a modified GameBryo.
     
  12. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
    Easy to get hung up on semantics when discussing "engines" I think. There is a big difference between writing something from scratch using OpenGL vs. taking an existing rendering library, existing sound library, existing touch/input library and creating your own "engine" which is basically just a wrapper for all those things. That is done all the time and people still call it their game engine.
     
  13. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    There is this company called Unity Technologies that I use that does exactly that. Sure they write some original engine code. But they also do a pretty good job integrating existing libraries like PhysX and Enlighten.
     
    Not_Sure, tiggus and Ryiah like this.
  14. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I was actually in Visual Studio yesterday trying to make a rendering device for a program I want to make, but every time I access DirectX Visual Studio hangs up on me and says it can't access vshost (Delay) because another app may be accessing it. Another reason for me to HATE Visual Studio lol.

    I was gonna make (not a game engine) but make a terrain Generator kinda thing like World Machine, GeoControl 2, etc.
     
  15. tiggus

    tiggus

    Joined:
    Sep 2, 2010
    Posts:
    1,240
    Yeah exactly, just saying you don't need to be trying to write the next Unity to prefer to roll your own in some cases. Ie. if I want to write a game for HTML5 I can use a existing game engine like Unity/UE/Phaser/Impact/Construct 2/etc. or I can simply import a handful of rendering/physics/sound/input libraries and write a bit of abstraction to access them and I've created an engine for a specific game(s) with barely a difference in difficulty.

    That's assuming 2D, now when you get into 3D I'd say the existing engines are the way to go because that difference is not trivial.
     
  16. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,985
    Indeed. At that point you are creating a "game". If you can take like 80% of that code base and create a second game that is very different, then you are starting to make an engine.
     
    Kiwasi likes this.
  17. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Don't waste your time unless you're really really serious about doing this for important reasons. Unity does SO much for you that you would've have to have done yourself not so many years ago, it's a HUGE time saver. You really really don't want all the headache of managing an entire engine and having to do all kinds of lower-level programming. Sure some companies do their own engines but they also have tonnes of manpower and resources and want to differentiate themselves via technology innovations. If that's not you, don't waste your efforts. If you look back 5-10 years you'll find a graveyard of countless 'engines' many of them 3d all trying to build the next big thing and almost every single one of them stalling and failing and falling dead.
     
  18. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    Which at this point is either learning purposes or if you have special needs (ie an engine specifically for the demoscene).

    One awesome result of this is that occasionally the developer(s) will release their engine for free. I stumbled upon one such engine about the time it was released as open source (MIT license). It might serve as a good starting point.

    https://www.reddit.com/r/gamedev/comments/2fbkzr/dt3_open_sourcing_my_game_engine_fourteen_years/
     
  19. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    And it often means engine was abandoned. As it is the case here (last github commit 10 months ago). And as it was the case with Torque.
     
  20. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    An abandoned engine can be a good starting point though. I mentioned earlier that Bethesda's Creation engine is basically the GameBryo engine. Did you know the company that developed GameBryo is basically defunct? Last update was 2012.
     
  21. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,985
    Torque isn't abandoned, it is now fully open source and community driven. The last major update was about a month ago. It's community is fairly small so not the same pace as a commercial engine.
     
  22. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    Somewhere on the internet there is an interesting presentation by Kunos Simulazioni where they talk about why they chose to develop their own engine for Assetto Corsa. Unity was one of their options. I'll try to look around for it.
     
  23. GarBenjamin

    GarBenjamin

    Joined:
    Dec 26, 2013
    Posts:
    7,441
    I always write my own game engine at least to some degree. Mainly at this point just building on to the engine with each new project . This is not to be confused with building a graphics or audio api but rather just the game engine that sits on top of those lower level things.

    Things such as collisions, physics and world building and rendering I do myself but again they always are sitting on top of existing lower level APIs that handle drawing and sounds. I find it much faster to work this way than using fully canned game engines. Mainly because I can make things work in a way that is logical to me and easier for me to work with. I don't know about everyone else but for me personally there is a real disconnect between the way devs of existing game engines seem to have been thinking and the way I approach game dev. This causes even simple things to become more involved and time consuming because it often feels like one is fighting against the system to do things in a way that feels more natural to the game dev.
     
    Last edited: Nov 9, 2015
    Ryiah likes this.
  24. Mwsc

    Mwsc

    Joined:
    Aug 26, 2012
    Posts:
    189
    I first started programming around the time of wolfenstein 3D and Doom.
    At that time in history, the latest and greatest games were always built around a brand new game engine. Wolfenstein 3D was a game engine AND a game, likewise with Doom and Quake. I wanted to make games back then, and there was nothing like Unity at the time. So I got the teach-yourself-game-programming books, which showed how to set the graphics mode to 320x240 with 8 bit color, and how to write colors into the framebuffer. From this starting point it is straightforward to build up to games like asteroids and space invaders and even mario, totally from scratch. This was great for learning, and I suggest anybody really serious about game development take a little time to do the equivalent today. Build a really simple game in OpenGL, using no engine other than what you build yourself.

    But don't try to make something as big and complicated as Unity!
     
    Velo222 and GarBenjamin like this.
  25. GoesTo11

    GoesTo11

    Joined:
    Jul 22, 2014
    Posts:
    604
    I found it:


    About the 17 minute mark, he starts talking about the programming languages. About 19:49 he starts talking about Unity. The video has English captions. I found it quite interesting but then, I'm a big sim racing fan.
     
  26. thxfoo

    thxfoo

    Joined:
    Apr 4, 2014
    Posts:
    515
    Depends on how good a coder you are.
    If you are good, look at Ogre3D or OpenGL, should be easy. But if you are a good coder, why did you never use OpenGL just for fun? And why do you even have to ask this? So I think this will probably be hard for you...
     
  27. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    Because they choose DirectX instead? :p
     
    thxfoo likes this.
  28. thxfoo

    thxfoo

    Joined:
    Apr 4, 2014
    Posts:
    515
    The only legit answer. But why write code that only runs on one platform?
     
  29. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,141
    Ideally your game engine wouldn't be tied to any specific hardware API.

    A more serious answer to this is that it simply depends on their needs and the time period. Until recently cross-platform support was largely an afterthought. Linux support was practically unheard of. Available learning resources for OpenGL were generally lacking and those that were popular (ie NeHe) were often built around the Win32 API.

    Learning how to truly make cross-platform games with OpenGL, at least for me, wasn't simply a matter of learning OpenGL but learning all the other APIs that would surround it. It took a fairly long time before I finally managed to get a minimalist GNU environment running and compiling, as well as time to set up another system running Linux. I had to learn SDL too.

    By comparison Microsoft has excellent documentation. At the time I started learning they didn't have the most easily affordable IDE, but it was still fantastic. A couple of years after I got into it they even made it free.

    Then there was a period of about four years - between 2.0 (2004) and 3.0 (2008) - where OpenGL development felt stagnant while DirectX continued to receive minor updates as well as a major release.
     
    Last edited: Nov 9, 2015
    angrypenguin likes this.
  30. cyberpunk

    cyberpunk

    Joined:
    Mar 20, 2013
    Posts:
    226
    You know, there are some good reasons to write an engine from scratch. Believe me, I've been there. Back in the day, I wrote a software rasterizer in Java, messed around with DirectX a bit, various libraries, etc. If you're working for a big AAA studio, there could be some value in having custom tech. But even big companies are slowly moving toward off-the-shelf engines.

    Really, in this day and age it just doesn't make logical or economic sense to try to make a custom engine. It's a HUGE time-sink. Big studios, with huge teams, spends months and years with multiple coders to finish an engine. As a small indie house or one-man-band, you will not compete. Wouldn't you rather spend those months and years of time actually working on your game? That thing that you actually want to make. Not dealing with mundane plumbing you have to do to wire up a game engine. It's a losing battle.

    The only angle I could see is for education, or if you *really* want to get a job as an engine coder. Sure, that could be worth it. But the idea of building an engine just for a game doesn't make any sense. You will spend all your time on the engine, and probably struggle to finish a game (if you ever finish at all). I understand the glory aspect, but it's not worth it.
     
    Teo and Kiwasi like this.
  31. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    @cyberpunk pointed some good things. I will add some other points.

    Rendering stuff is easy with API like OpenGL/DirectX. Adding stuff like spatial partition for culling/optimizations can complicated things. Also shaders can sounds easy, but are not when you have to optimize everything for your engine. But remember, the power of the engine, do not come from rendering only, comes from tools you provide to work with. And you have to constantly update it with every OpenGL/D3D API update. Overall.. if you start making an engine, you will probable never finish a game, because you will be to busy working on engine. I will not recomend that, also I will not recomend doing it solo. Way to many things to code and improve or research.
     
  32. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    669
    Making a custom game engine is a fun, educational experience.

    Making a game in a custom engine is a slow, laborious, hair-pulling process.

    In my experience, it's better to build a framework for a game (or a company's general code framework) on top of an existing engine than it is to roll your own.
     
    Ryiah and GarBenjamin like this.
  33. NoPiece

    NoPiece

    Joined:
    Jan 5, 2014
    Posts:
    26
    Not_Sure and recursive like this.
  34. recursive

    recursive

    Joined:
    Jul 12, 2012
    Posts:
    669
    I also second Game Coding Complete: http://www.amazon.com/Game-Coding-Complete-Fourth-Edition/dp/1133776574.

    A friend of mine and I used a variant of that engine along with DX11 and a PBR setup to create an interactive rendering solution for a non-game project. Too bad it was scrapped because writing a rendering framework from scratch takes forever.
     
  35. GameDevGuy

    GameDevGuy

    Joined:
    Nov 4, 2012
    Posts:
    96
    Neither Torque 2D nor Torque 3D are abandoned. The MIT repos on GitHub receive constant updates and are discussed daily by the users and contributors. While the size of the community has shrunk, it's still a solid group of developers.
     
    Last edited: Nov 12, 2015
  36. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    Torque 3D had the chance to be a super engine, to bad main devs refused to modernize the engine, and took old Quake engine as model. So far look like abandoned, I doubt anyone still use it :(
     
  37. GameDevGuy

    GameDevGuy

    Joined:
    Nov 4, 2012
    Posts:
    96
    Like I said, the engines are actively used and contributed to. I do not want to derail this thread, especially if it leads to some heated engine debate (that never happens, right?)...but it's always nice for a thread to contain accurate information. So it can be boiled down to "Are the Torque engines abandoned?" Answer is "Nope, they have life left in them and people are enjoying using the tech".

    If there are any further questions or thoughts on it, feel free to send me a private message and I can send you additional links to whatever will be helpful. No sense in further cluttering up a Unity forum thread about Torque.
     
    Last edited: Nov 13, 2015
  38. Teo

    Teo

    Joined:
    Oct 31, 2009
    Posts:
    564
    @GameDevGuy No need, I've used commercial version of Torque in the past. For me Torque 3D is over, I doubt will ever have the power to make it into the modern engines, at least not how is right now.

    @on topic
    For peoples who want to make their own engine, they can take a look at Torque 3D or Ogre 3D source codes.. and make an idea what's about. Is not anymore one man task.
     
  39. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    3,541
    From what I gather, and re-enforced from reading this thread, it really depends on what you mean by "game engine". If you mean something that renders 3d in real time, then yeah it's not too hard. It's all those little things you pile onto it that matter.

    Things like physics, view windows, camera effected and functionality, terrain, networking, input management, scene management, skyboxes, renderers, support for art assets, and on and on and on and on....

    If you want to read some neat stuff on game engines NVidea did some neat articles on rendering techniques called "GPU Gems".
     
    metamorphist likes this.