Game Programming Basics?

This is a discussion on Game Programming Basics? within the Game Programming forums, part of the General Programming Boards category; Ok, hi, I'm Dark Dude, aged 14, the only coder in a small group of friends who code, establish and ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    27

    Smile Game Programming Basics?

    Ok, hi, I'm Dark Dude, aged 14, the only coder in a small group of friends who code, establish and run games on the internet (most of which are quite successful so far).

    Up to now, we have only done stuff using PHP and MySQL, but, I've decided to evolve our ideas, and make a Graphical Game in C/C++.

    I'm not the best at C/C++. I'm pretty good at the C Standard I/O Libraries, and am slowly adapting to Win32 GUIs in C++ using the windows.h library.

    So, the games purpose you ask?

    Ever played Legend Of Zelda: A Link To The Past?
    It's going to be layed out like that (tile-to-tile, your character appears in the middle of the screen, scrolls where you move)
    You should be able to interact with other guys online at the time, preferably, through use of a MySQL Database on the server, though this isnt important this early on.

    So... Can anyone direct me to any decent tutorials or paths to set me on this route?


    (Please do not offer to write whole scripts for me unless necessary, as I like to be able to learn what everything does, and how stuff is done, so I can actually learn easier ^^)

  2. #2
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    That is called a Tile Engine, if you are planning on using Win32 API then I suggest you look into DirectX, it will provide the means for you to draw, get user input, sound, and networking, and in general it will let you do what you want to do.

    Do not jump into this project and expect to have something within a month or so, other than maybe some graphics (that you will need to refine) There are 2 on these boards who have been working on a Zelda clone for 2 years and are not done, and they are working together.

    Using a MySQL database to interact between players is foolish at least, and not very feasible unless you have a monster of a computer for your server, and even then.. unlikely.

    You should spend a lot of time designing the parts of the game, code a bit out and test those designs, you will find flaws in your designs and have to go back and revise them. This iteration is how all good games and really programs are made.

  3. #3
    Registered User Rennor's Avatar
    Join Date
    Aug 2006
    Location
    Finland
    Posts
    45
    For 2D tile engine, check: http://hge.relishgames.com/index.html

    Haaf's engine is 2D graphics engine (for games). It's all you need if you want to make tile based 2D games. It includes hardware accelerated gfx functions, audio, user input etc. This get you far with your client.

    The other thing is your server engine. You know some about MySQL already which is good, its nice data storage but I agree with Wraithan that it should not be used as communication method between clients, that's what you write server engine for.
    If youre making server side for Linux you get plenty of nice things that are more or less designed for this task; child processes and shared memory areas to work with shared data between clients and send messages between processes etc etc... pretty cool stuff.


    I am trying out Haaf's engine and writing my own simple 2D multiplayer game. It is also storing player data into MySQL database (login information with relation to tables containing high scores etc).

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,597
    I don't recommend using another engine at this point. Code your own and once you understand the concepts, then feel free to use whatever is out there.

    But this is not as simple as you make it sound. Counting tools and everything I've written approximately 40k lines of code just for this one game. The engine itself right now is sitting at about 9k lines of code which includes D3D setup, music/sound fx (MP3 and WAV), rendering, resource management, game objects, input, rendering, animation, special effects, D3D interface wrappers, and scripting support classes. To give you an idea of how complex writing a game engine can be our current core engine code is using approximately 137 source files which includes headers and implementation files.

    Things to still implement for the game (and not necessarily core engine code) are individual character classes, event handler functions, windowing GUI, resource caching, networking code (not used by this game), gamepad input code (mouse and keyboard implemented thus far), cut scene and storyline management code, and various updates and additions to our existing set of tools coded using MFC.

    The first main editor for the game was 11760 lines in MSVC 6, not counting MFC core code, but it had to be re-coded from scratch due to differences between MSVC 6 and MSVC .NET 2005 not to mention I didn't like some of the design.

    So these are very simple concepts but they are long in implementation. You gotta have resource management down to a science before you write your first graphical rendering code or it just won't work. I don't say this to discourage you, but I don't want to blow sunshine in your face either. It's very hard work and at times extremely frustrating and tedious. But the end result is more than worth it.

    I would say start with Tic Tac Toe or a card game if you are not good with C++. These will more than give you enough exposure to the language and to concepts that go beyond the language. Knowing C++ like the back of your hand is just the tip of the iceberg when it comes to game programming. You MUST know the language quite well along with STL, and DirectX and/or OpenGL depending on your choice of API.
    Last edited by VirtualAce; 09-29-2006 at 07:40 AM.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    27
    Yeah, I knew it would take longer than PHP games take; it's why I aim to learn C++ to a decent standard early on ^^

    Also, at the MySQL Comment: I plan on using MySQL because I've got a large amount of Web space on a Linux Debian Apache Server thing which includes MySQL (I would use my own PC, but it's terribly unreliable at server tasks), and I cant find any other databases I could use on it instead >_>

    Hm... I like Bubbas' suggestions of what to do most, mainly because he hinted the paths I should take with full reason.
    I will go and try learning Tic Tac Toe ^^ (any tutorials to help?)


    Also, how would I program my own engine? Or is this something i'll learn when learning the rest? =P


    *Goes to research difference between DirectX and OpenGL*


    Btw, Thanks guys, feedback was much appreciated =D

  6. #6
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    I'd advise against using a database if you want real-time interaction, its too slow. Use the DB to persist data but you'll need to write a server (to which your game is a client) to communicate the real-time data (position, avatar, actions, etc...)

  7. #7
    Registered User
    Join Date
    Sep 2006
    Posts
    27
    So... How do I set up this server? Can I use an adapted webspace?

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    If i were you i wouldnt worry too much about multiplayer and server, its complicated enough to write it for singleplayer.

    How to write an engine? Nobody can tell you how because there is no exact answer to that, it all comes down to your needs, your knowledge and what the engine should be capable of doing.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    27
    So, it basically is setup to handle your commands against scripts etc?

    Hm. I guess we could just not worry about the multiplayer-ness this early...

  10. #10
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,597
    Do the basics first. Learn the language doing less exciting stuff and you will be thankful later. BTW game programming is 5% excitement and graphics and about 95% grunt work that doesn't draw anything.

  11. #11
    Registered User
    Join Date
    Sep 2006
    Posts
    27
    Quote Originally Posted by Bubba
    BTW game programming is 5% excitement and graphics and about 95% grunt work that doesn't draw anything.
    Yeah, I have a quite high patience span, as I usually keep focused to what I should be doing and the prize at the end.

    And I'm slowly eliminating the basics; reading tutorials on this site and others help understand the languages more.

    But, I still dont see where DLLs come into stuff, and no tutorials explain them >_<

  12. #12
    Registered User
    Join Date
    Aug 2003
    Posts
    1,209
    DLLs can be used to change what api you use, for instance. If you choose to use opengl you use 1 dll, if you want directx you use another. The advantage is that you dont have to change anything in the core program, you just need to make sure the function prototypes are the same in the dlls. They are also useful for lots of other stuff, but is considered a more or less advanced topic and even moreso with graphics because you have to think carefully about the design.
    STL Util a small headers-only library with various utility functions. Mainly for fun but feedback is welcome.

  13. #13
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    I enjoy that Grunt work more than I am enjoying learning to do graphics. But that is just me.

  14. #14
    Registered User
    Join Date
    Sep 2006
    Posts
    27
    Does anyone here have a tutorial about making a standard game like Tic Tac Toe that works with Dev-C++ ?
    Everything seems to be for MSVC which I cant get >_>

  15. #15
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    The files should compile just fine under Dev-C++ unless they make use of something like DirectX. And then it only takes a bit of work for that. Just start a project in Dev-C++ and import the source files into it. Then try compiling and see what happens.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Open-source Game Project
    By Glorfindel in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 03-24-2009, 02:12 AM
  2. 20q game problems
    By Nexus-ZERO in forum C Programming
    Replies: 24
    Last Post: 12-17-2008, 05:48 PM
  3. HELP!wanting to make full screen game windowed
    By rented in forum Game Programming
    Replies: 3
    Last Post: 06-11-2004, 05:19 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-25-2002, 12:00 AM
  5. Game Basics
    By lemon-heads in forum Game Programming
    Replies: 4
    Last Post: 04-13-2002, 01:04 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21