Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to make a Game Engine For Super Beginners?


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
27 replies to this topic

#1 donaldleow   Members   -  Reputation: 147

Like
4Likes
Like

Posted 03 April 2014 - 09:47 AM

Hi all,

 

I understand that there are already quite a few threads out there, but it seems that most of them are about the pros and cons of certain stuff in the game engine, or either that it's just a bunch of theories here and there. Perhaps I didn't look hard enough or either that I'm just really noob to not catch certain stuff mentioned.

 

So getting to the main point, my questions are what does a game engine really need? How to structure the engine in a industry-standard structure? (I'm still a student, but I'm going to graduate soon...) And last but not least, how do we make a game using this engine in question?

 

It depends on the situation, some might say, so I shall narrow down the question here. Let's say we're making a 2D RPG game engine that uses C++ and OpenGL as its programming languages.

 

From I have understood so far, a game engine is a program where a programmer does his magic on to create the game, and contains functions that instantly creates basic game mechanics that is needed in a game.

 

Can anyone change or add on to the sentence, and perhaps answer my the three questions as stated?

 

With regards,

Donald Leow

 

( P.S. Sorry if I sound weird or arrogant, as some have told me. I tend to sound like this when I try to ask questions...I apologize for my inability to ask questions in a normal way. )


Edited by donaldleow, 03 April 2014 - 09:48 AM.


Sponsor:

#2 Glass_Knife   Moderators   -  Reputation: 4996

Like
15Likes
Like

Posted 03 April 2014 - 09:56 AM


( P.S. Sorry if I sound weird or arrogant, as some have told me. I tend to sound like this when I try to ask questions...I apologize for my inability to ask questions in a normal way. )

 

An engineer lacking social skills?  No way!

 

I think an engine can be described differently depending on the audience.  I would talk about it differently to a programmer, artist, musician, designer, marketer, and my wife.  I see a lot of people get hung up on creating an "engine" like it is some magical thing that will solve all our problems.  Don't worry about it.  Write your code doing the simplest stuff possible to get the job done.

 

All great code starts out this way.  A small idea, with clean code that works.  Years later it has been improved, rewritten, refactored, tested, retested, and has become a tool for hiding the complexity of a task and making it easier to do, trading a lack of flexibility for easier development.

 

If you really want to write an engine, make a game.  Then start from scratch and make another game.  Then a third.  Then take all that common code and put it into a library so you stop repeating yourself.  Chances are, this has already happened naturally. 


Edited by Glass_Knife, 04 April 2014 - 10:28 AM.

I think, therefore I am. I think? - "George Carlin"
Indie Game Programming

#3 rAm_y_   Members   -  Reputation: 481

Like
5Likes
Like

Posted 03 April 2014 - 10:28 AM

Well this isn't really a super beginner answer but you should read a bit about how CPU's operate and the basics of how an OS processes messages.

 

For example a single core CPU can only process one instruction at a time, even though there are millions of transistors, it's still one instruction after the next. An OS has to be built to work with this principle, see, 

 

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

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

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

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

 

You don't have to really know much of how the OS works, but these topics can help you understand a basic principle that it's one instruction after the next and this is the root idea if a game engine also.

 

The engine also runs in a loop, like a while loop, do loop or for loop, and every other calculation runs inside this loop. 

 

Within the loop you are continually monitoring the user input(mouse/keyboard) and when the input changes the engine has to update the game state accordingly. That means the view you see or the sounds you hear have to be recalculated, there are hundreds of thousands of calculations/messages being processes every second. If you monitor is running at 60Hz that means it update the screen 1/60sec so that is the time the CPU/GPU have to calculate every graphical and physics, sound calculation, thankfully electrons travel extremely fast also.

 

This should help you understand that a game engine is split into components and is all based around the concept, check user input --->do loads of calculations-->update the screen-->check user input-->do loads of calculations-->update the screen.

 

The 'do loads of calculations' involves calculating new vertex positions, pixel colours, physics calculations, sound calculations, collisions detection. Loads of calculations but they are all broken down into individual parts and processed one after the other.

 

If you are serious about creating a game engine, you would learn the 'components' of a game engine, and build a thorough design document of your engine, decide on the classes and features you need to use and then code it.

 

You will find that the CPU/GPU, the OS and the Drivers do a huge amount of work for you.

 

Think I used the word calculation a few too many times..lol



#4 menyo   Members   -  Reputation: 494

Like
6Likes
Like

Posted 03 April 2014 - 10:47 AM

Unless you really want to spent a lifetime creating a efficient engine You should just pick one of the dozens of amazing engines out there. Creating an engine requires you to already be a expert game developer. And if you where an excellent game developer you would not have posted this question here. So take my advice and just pick an engine to create your 2d rpg.


Edited by menyo, 03 April 2014 - 11:44 AM.

Current Project: TechnoFlux read all about it on my

DEV BLOG


#5 rpiller   Members   -  Reputation: 706

Like
6Likes
Like

Posted 03 April 2014 - 11:05 AM

The question is:

 

Do you want to make games?

 

or

 

Do you want to make a game engine?

 

 

 

Also, "Game Engine" is a fairly abstract term. Technically any code you have that runs a game is a game engine. It may not be very flexible but it's still the games' engine. Then you have very generic code that helps you make your game defined as a "Game Engine". Most people probably look at Unity3D and say it's a game engine. However it's purpose wasn't to run any specific "game" (not including demos which are there to show you have the engine works), but it's still considered a game engine by most. I would say a more true def of a game engine would be something like UDK, CryEngine, & Source. These are engines that were built for specific games. The reason they exist is because the company wanted to make a specific game. Engines like Unity don't exist because they wanted to make a game. They want to aid you in making games (which they do well).

 

So you can see there are 2 approaches. Make a game and refine it over time until it becomes generic enough to be considered a game engine. Or, make a generic game engine and then make a game with it. When just starting out I'd go with making a game first by using higher level libraries for gfx, sound, physics, etc as this will help you see what the issues are when making a game and you'll have to figure out how to solve them. Then you can refactor it so that it's more generic.


Edited by rpiller, 03 April 2014 - 11:08 AM.


#6 serumas   Members   -  Reputation: 730

Like
7Likes
Like

Posted 03 April 2014 - 01:42 PM

Unless you really want to spent a lifetime creating a efficient engine You should just pick one of the dozens of amazing engines out there. Creating an engine requires you to already be a expert game developer. And if you where an excellent game developer you would not have posted this question here. So take my advice and just pick an engine to create your 2d rpg.


If you want to become an expert some day, you must go this way and reinvent something every time.

#7 ProtectedMode   Members   -  Reputation: 1284

Like
8Likes
Like

Posted 03 April 2014 - 03:33 PM

 

Unless you really want to spent a lifetime creating a efficient engine You should just pick one of the dozens of amazing engines out there. Creating an engine requires you to already be a expert game developer. And if you where an excellent game developer you would not have posted this question here. So take my advice and just pick an engine to create your 2d rpg.


If you want to become an expert some day, you must go this way and reinvent something every time.

 

Yes, but if you say things like "From I have understood so far, a game engine is a program where a programmer does his magic on to create the game, and contains functions that instantly creates basic game mechanics that is needed in a game." then you should probably learn more about general programming instead of creating your own engine first...



#8 Godmil   Members   -  Reputation: 744

Like
4Likes
Like

Posted 03 April 2014 - 04:04 PM

Well for a start if it's for 2D games, I wouldn't use OpenGL directly. I'd rather something like SDL2 which will take care of all the OpenGL stuff for you as well as giving you lots of great features like input checking.



#9 Mouser9169   Members   -  Reputation: 401

Like
4Likes
Like

Posted 03 April 2014 - 06:44 PM

The question is:

 

Do you want to make games?

 

or

 

Do you want to make a game engine?

 

^This.

 

You used the example of a 2D RPG. The stuff that most people would think of as being done by the 'game engine' (graphics, rendering, collision detection) is the LEAST part of a good RPG. You've got to write a plot with quests, sidequests, and dialogs. You need music - background sounds, background music, battle music, character themes. You need to create the characters, their backstory's, their character arcs. And you build the world, with all it's lore, history, npc's, and then create the maps for every town, building, and outhouse in that world. Before you can code the mechanics like the combat system or character classes you have to create all those concepts and work them out on paper so the game will be reasonably balanced: you'll tweak it as you go, but the basic concepts have to be sound.

 

You can spend all your time working on the engine, or you can spend your time working on all (or even some) of that other stuff.

Try to do everything and you'll end up accomplishing nothing.


"The multitudes see death as tragic. If this were true, so then would be birth"

- Pisha, Vampire the Maquerade: Bloodlines


#10 ferrous   Members   -  Reputation: 2146

Like
4Likes
Like

Posted 03 April 2014 - 07:19 PM

 

The question is:

 

Do you want to make games?

 

or

 

Do you want to make a game engine?

 

^This.

 

You used the example of a 2D RPG. The stuff that most people would think of as being done by the 'game engine' (graphics, rendering, collision detection) is the LEAST part of a good RPG. You've got to write a plot with quests, sidequests, and dialogs. You need music - background sounds, background music, battle music, character themes. You need to create the characters, their backstory's, their character arcs. And you build the world, with all it's lore, history, npc's, and then create the maps for every town, building, and outhouse in that world. Before you can code the mechanics like the combat system or character classes you have to create all those concepts and work them out on paper so the game will be reasonably balanced: you'll tweak it as you go, but the basic concepts have to be sound.

 

You can spend all your time working on the engine, or you can spend your time working on all (or even some) of that other stuff.

Try to do everything and you'll end up accomplishing nothing.

 

 

Yup, I agree, you have to decide what it is about making an RPG that you want to concentrate on making, and what stuff you don't find interesting.  If you want to make an RPG with a unique engine/look, or whatever, and don't really have this giant urge to put the story in your head into a game, then perhaps an engine is the way to go.

 

 

Also, as an aside, just because you don't decide to make your own engine on your first project, doesn't mean you can't make your own engine later.  One can get a pretty good understanding of what it takes to make a good engine after having used one.  Or you get annoyed enough by the limitations of the one you're using, and decide to make one that avoids the problems =)



#11 menyo   Members   -  Reputation: 494

Like
4Likes
Like

Posted 03 April 2014 - 07:25 PM

 

Unless you really want to spent a lifetime creating a efficient engine You should just pick one of the dozens of amazing engines out there. Creating an engine requires you to already be a expert game developer. And if you where an excellent game developer you would not have posted this question here. So take my advice and just pick an engine to create your 2d rpg.

If you want to become an expert some day, you must go this way and reinvent something every time.

 

 

To create an engine you need a lot of knowledge of game development. To create a proper and efficient engine you need to be expert on the subject. These are the first steps to take imo. For learning purpose reinventing is good, for developing anything it is a absolute no go, you should already have that knowledge. If you want to sent the OP straight into C++ engine design you clearly missing the point of the beginners topic.


Current Project: TechnoFlux read all about it on my

DEV BLOG


#12 Satharis   Members   -  Reputation: 1263

Like
3Likes
Like

Posted 03 April 2014 - 08:17 PM

So getting to the main point, my questions are what does a game engine really need? How to structure the engine in a industry-standard structure? (I'm still a student, but I'm going to graduate soon...) And last but not least, how do we make a game using this engine in question?

The fundamental point of a game engine is that a game engine is just a concept. If you make a breakout clone then the code that relates to how the game itself interacts is usually what you would consider the "game logic" layer. For instance the code that says if a ball hits a wall it has to reverse velocity and bounce off the wall, that would be logic level code.

On the other hand, the code in the game loop that gathers input on how to move the paddle, then code that actually renders the ball and the bricks and all that, that could be considered engine level code.

The thing is there isn't any "rule" on how seperated these things have to be, many a beginner and even professional will happily make a ball class that should be game logic and they put a bunch of opengl drawing commands in it, that usually is bad in terms of engine seperation because it means that the parts of the game depend heavily on each other, and are coupled. If you want to change from opengl to directx suddenly instead of having to go into the "rendering subsystem" and change all the "draw a thing" code into directx, you'll instead be going into every single game object class and changing it, bad news!

The only real difference between that and something supermassive like unreal is:

-More parts: big engines tend to be generic, they tend to be designed to happily render different file formats, different shapes and sizes and materials and so on. They also tend to have more subsystems that you might not even use. For instance if you want to play full motion video in your game, you'll probably need a library for that. Most big engines have a lot of these features built in standard and extensively tested and performance benchmarked.

-More generic: big engines, even if they aren't sold, are often used to develop multiple games because they are seen as an investment by the team with programming time. If they spend two years making an engine and it makes three games with some minor modifications, they've saved perhaps a year of extra programming time for each title.

-More people and expertise: With size can often come advantage, between the years of experience of the engineers and money poured into big engines they tend to be a lot more tested and designed with performance in mind. For someone like an indie there isn't usually practical purpose to spending three years improving the framerate of your pong game, with a large 3d open world game with lots of shaders and nonsense, performance is critical, so they have a lot of people spend a lot of time on each subsection of the engine to make them perform as optimally as they can.

So what should YOU do? That depends on what you want to make. If your plan is to become a programmer for a living in the AAA industry it is definitely worth making your own projects. Experience is never wasted in programming, learn that lesson early. Using unity or something isn't a 'waste of time' but it will teach you -specific- things. You won't ever learn the fundamentals of making a game engine by using unity, like the game loop and the rendering libraries and stuff like that. Realistically if you get into the game industry as a programmer, or even as an indie, you will probably need to acquire that knowledge at some point.

It really comes down to goals, if you just want to design games then I would never recommend coding, even using an engine like unity might be too much "lower level" work for most people. On the flip side if you wanted to become specifically a programmer an learn the real meat and potatoes of how a game functions as a program, you might get a good start using an existing engine, but eventually you'll have to learn that lower level stuff.

#13 aregee   Members   -  Reputation: 1026

Like
7Likes
Like

Posted 03 April 2014 - 10:03 PM

Can someone explain to me what all the fuss about 'engine' is, and why there is so much magic and mysticism around it?  In my world, an engine is what you naturally create while you are making a game, not necessarily a ready made 'system' made by some other company/person.

 

Not an uncommon game loop (details may of course vary):

    while (!quit)
    {
        //Manage inputs from the user (joystick, keyboard, mouse, etc...)
        //Do some calculations
        //Draw your scene/graphics based on the previous steps
    }

To me, this is an engine.  It arises naturally from the process of creating a game.  Yes, it looks simplistic, but might not necessarily be.  Please explain if I am wrong?

 

While OpenGL or Direct3D might be hard to learn initially, it is an important process in learning to make games, and if you can make one textured quad output to the screen, it is not hard to expand to that so you can make your own class to plot a lot of tiles to the screen either.  If you want to postpone on that, you can of course use one ready made APIs to render 2D graphics, or if you are more adventurous, try to make some simple 3D graphics.  How about running around in a maze?  That would be a nice challenge if you are going for 3D.  My point is that you have to start somewhere, and it is just to dive into it.  Make something really bad, and refactor and make better as you go.  Start with something that is so easy that you think you can manage to do it.  (I wouldn't really recommend 3D, if you are an absolute beginner, though.)

 

Sorry if I am way off with my thoughts.

 

EDIT: I also disagree that you need to be an expert to make an engine.  When you are learning, you are allowed to fail.  Actually, failure is what you will learn from.  Your first 'engine' need not be perfect in any way - just work.  Knowledge is what you gain by doing.


Edited by aregee, 03 April 2014 - 10:14 PM.


#14 Tutorial Doctor   Members   -  Reputation: 1685

Like
2Likes
Like

Posted 03 April 2014 - 11:08 PM


You can spend all your time working on the engine, or you can spend your time working on all (or even some) of that other stuff.
Try to do everything and you'll end up accomplishing nothing.

 

Absolutely! Take it from me! 


They call me the Tutorial Doctor.


#15 3Ddreamer   Crossbones+   -  Reputation: 3165

Like
6Likes
Like

Posted 03 April 2014 - 11:26 PM

Hi,

 

Typical successful game engine:  Takes a team many thousands of coding hours to create and more thousands to update. Budget is typically 100,000s to millions of dollars each version of a game engine that is really worth doing.

 

Typical successful game: Takes a team many thousands of coding hours to create and more thousands in following versions. Budget is typically 100,00s to millions of dollars each version of the game that is expected to be popular and profitable.

 

Exception:  Genius game developer works 70 hours per week for 10 years and hit the big time with his or her high achievement Indy self or the stupid public likes a simple game that took only a month to create but sells millions of copies. rolleyes.gif

 

"Do you feel lucky?"


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


#16 Satharis   Members   -  Reputation: 1263

Like
3Likes
Like

Posted 04 April 2014 - 01:00 AM

Hi,
 
Typical successful game engine:  Takes a team many thousands of coding hours to create and more thousands to update. Budget is typically 100,000s to millions of dollars each version of a game engine that is really worth doing.
 
Typical successful game: Takes a team many thousands of coding hours to create and more thousands in following versions. Budget is typically 100,00s to millions of dollars each version of the game that is expected to be popular and profitable.
 
Exception:  Genius game developer works 70 hours per week for 10 years and hit the big time with his or her high achievement Indy self or the stupid public likes a simple game that took only a month to create but sells millions of copies. rolleyes.gif
 
"Do you feel lucky?"

To be fair and less cynical you tend to get back the amount of money you put into something though, generally a low budget game that succeeds will make a moderate amount of money, probably a lot more than was put into it, depending what it is. It also has to fit the market, tahts why you don't see huge RPGs and crap on iphone, because the best way to be profitable is to have 20 small games in rotation instead.

Most of the big devs, even if they make a complete flop of a game, still end up spending a couple, or tens of millions of dollars, if they screw up royally they might not even get it back.

And yes we all think Minecraft is a roulette wheel win, not a well designed game.

#17 Buster2000   Members   -  Reputation: 1775

Like
8Likes
Like

Posted 04 April 2014 - 01:38 AM

To be honest if you are a beginner and you want to create a game without using a third party engine then the steps to writing your engine is this.

  1. Dont't write an engine.  Just start writing your game  and finish it.
  2. Now you want to write another game.
  3. Hmm I can reuse bits of my previous game to write my new game
  4. GOTO 1.

Follow these steps a few times and you will soon discover that you have a library of code that you know perfectly and can adapt to suit your needs and your coding style.  This is your engine.

 

There is the alternative way which is to try writing perfect systems upfront but you will never finish because you will read an article that differs with the way your engine works and then keep restarting and could spend the next 20 years trying to write the perfect engine.  Don't forget ALL successful games engines from simple ones like cocs2d to Crytek are permenantly under development.



#18 Nathan2222_old   Members   -  Reputation: -400

Like
2Likes
Like

Posted 04 April 2014 - 08:43 AM

To be honest if you are a beginner and you want to create a game without using a third party engine then the steps to writing your engine is this.

  • Dont't write an engine. Just start writing your game and finish it.
  • Now you want to write another game.
  • Hmm I can reuse bits of my previous game to write my new game
  • GOTO 1.
Pong to pacman?
If you want to write an engine (i.e. not from the scratchy scratch), write a game using the needed libraries instead of an engine. By the time you're done, you would have made the different libraries work together well (i.e. if you did it well).
Voila, that's your engine (which would be as good as the work you put into making the game).
You would need to learn how to use those libraries though.

UNREAL ENGINE 4:
Total LOC: ~3M Lines
Total Languages: ~32
smile.png
--
GREAT QUOTES:
I can do ALL things through Christ - Jesus Christ
--
Logic will get you from A-Z, imagination gets you everywhere - Albert Einstein
--
The problems of the world cannot be solved by skeptics or cynics whose horizons are limited by the obvious realities. - John F. Kennedy


#19 donaldleow   Members   -  Reputation: 147

Like
2Likes
Like

Posted 04 April 2014 - 09:00 AM

Unless you really want to spent a lifetime creating a efficient engine You should just pick one of the dozens of amazing engines out there. Creating an engine requires you to already be a expert game developer. And if you where an excellent game developer you would not have posted this question here. So take my advice and just pick an engine to create your 2d rpg.

Well, I did mention I am still a student...and yeah that's what I wanted to do initially...but yeah I got curious about making a game engine...that's why I posted the question. 



#20 donaldleow   Members   -  Reputation: 147

Like
2Likes
Like

Posted 04 April 2014 - 09:01 AM


You can spend all your time working on the engine, or you can spend your time working on all (or even some) of that other stuff.
Try to do everything and you'll end up accomplishing nothing.

I will take note of that. Thanks.






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