Jump to content


Coding a game from scratch


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

#1 Coredev

    New Member

  • Members
  • Pip
  • 6 posts

Posted 15 November 2007 - 01:11 AM

Hello all.

Im a new member of this board, have read posts for a long time but never posted. My coding knowledge is newb. I know C/C++ but no graphics programming as of yet. I have done some games in text mode and yes, I must say it, ASC-II graphics because I was borred :) Im probably not a total newb but when it comes to 32-bit programming like win32 I am and need some help. I have recently come over some spare time and would now like to refresh and learn game programming. Here is my idea.

I want to make a small simple game to get into the swing of it all. Its a space ship shooter game. Think of Galaga but in 3D. Instead of a Vertical scroller the objects move in a Z axis. So if an asteroid chunk is comming towards you the object begins out small and by the time it reaches you/your ship its say 5 times larger in size so you get the feel of travel.

Here are some questions whoever has time to answer or if your borred and feel compelled to help out. Anything is mega appreciated.

Language of choise : C++ via Visual C++ 6.0

1. Do I use DirectX or would OpenGL be easiest to start with.
2. I know Im going to have to use Win32 skills that I lack but bought a ton of books on the subject.
3. Should I, as a learning stage, program from scratch or find a good freeware game engine.

Many thank yous in advance whoever has some spare time on their hands to answer some questions.

Regards, Mike.

#2 hunguptodry

    New Member

  • Members
  • PipPip
  • 31 posts

Posted 15 November 2007 - 01:44 AM

1) why don't u try and make a galga or asteroids clone first.
2) it is an appropriate step up from where u r now.
3) like u, i work on games for fun in my spare time. been doing this for years.
4) i'm now working on steering behaviours of autonomous agents.
5) i use rectangles, circles and lines in my 2D simulation.
6) not great graphically but it works for me.

#3 hunguptodry

    New Member

  • Members
  • PipPip
  • 31 posts

Posted 15 November 2007 - 02:36 AM

1) don't look down on asteroids.
2) the very popular "geometry wars" is more or less a souped-up asteroids clone.

#4 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 15 November 2007 - 03:12 AM

Coredev said:

I have done some games in text mode and yes, I must say it, ASC-II graphics because I was borred

Be careful knocking text mode graphics around here. :ohmy:
http://www.devmaster...ead.php?t=11223

I just recently won this little ASCII game for the first time after 15 years or trying!
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*

#5 Coredev

    New Member

  • Members
  • Pip
  • 6 posts

Posted 15 November 2007 - 05:18 AM

Heh ok will give up on text mode :) Well I did demo's on the Amiga, mostly Assembler though and a ton of poke coding, that realy sucked hehe.

Hunguptodry, gonna take your recommendation and just do it plain and simple to start with.

Thx for the info.

Regards, Mike.

#6 Mattias Gustavsson

    Senior Member

  • Members
  • PipPipPipPip
  • 413 posts

Posted 15 November 2007 - 10:45 AM

If you need something to get you started, you might want to have a look at my little graphics library thingy:

http://www.colossuse...GameEngine.html

I've kept it all as simple as possible, and it should be very easy to get your head around it. Even if you do everything yourself from scratch, it can be good to have something to look at or nick stuff from :-)

It's 2D of course, but all good things are :D
  • www.mattiasgustavsson.com - My blog and current projects
  • www.rivtind.com - My Fantasy world and isometric RPG engine
  • www.pixieuniversity.com - My Software 2D Game Engine

#7 SamuraiCrow

    Senior Member

  • Members
  • PipPipPipPip
  • 459 posts

Posted 16 November 2007 - 12:55 AM

Coredev said:

Well I did demo's on the Amiga, mostly Assembler though and a ton of poke coding, that realy sucked hehe.
If poke coding was so bad, why didn't you use AmosPro or Blitz? Even custom copper-lists could be done from BASIC or C on the Amiga...

BTW, would you be interested in encapsulating some copper effects into shared libraries so they could be used in a modern Amos BASIC sequel? I'm sure we could use some help on the Amos compatibility extension of Mattathias BASIC if you don't mind putting some of your demo coding experiences to use.

It wouldn't be a paid effort but Sidewinder52c, the guy who's doing the classic AGA chipset Amiga version of Mattathias, has never coded a copper-list before and is pretty involved in trying to make an extensible parser after having to start the whole project over mostly from scratch (after having worked for several years' worth of spare time on a "fixed function" parser that couldn't be extended).

I'm in charge of doing the SDL and OpenGL version so I could help you brush up on how to do those same special effects on a semi-modern graphics card.

If you're interested, PM me or post on the Mattathias Yahoo group linked above.

#8 Coredev

    New Member

  • Members
  • Pip
  • 6 posts

Posted 16 November 2007 - 01:31 AM

Would be fun if I had that much time on my hands but being 16-17 when I played around with Amiga and TRS-80's until now, 36 you tend to lose EVERYTHING you know in coding and more :) Now a days I try to stick to C++ and away from everything else :-) Maybe some time in the future when I might spark an interest in Ami coding again.

Regards, Mike.

#9 LmT

    New Member

  • Members
  • PipPip
  • 15 posts

Posted 17 November 2007 - 04:13 PM

Since it appears that you are using Windows OS, I think it would be best for you to use DirectX. There are a lot of books out there focusing on game development and DirectX. amazon.com will be your best friend. You could also look for some online materials, but if you have the money to spend on a hobby, then it will be well worth it.

#10 SamuraiCrow

    Senior Member

  • Members
  • PipPipPipPip
  • 459 posts

Posted 17 November 2007 - 05:47 PM

@LmT

DirectX 10 is only available for Vista but OpenGL 2.x and 3.0 will still work on XP and will support many of the same features as DirectX 10 (including geometry shaders in the case of OpenGL 3.0).

Microsoft really dropped the ball when it came to Vista and DirectX 10. And the fact that OpenGL works on Macs, Linux boxes, and modern Amigas is just an added bonus!

#11 GrimFang4

    New Member

  • Members
  • Pip
  • 2 posts

Posted 17 November 2007 - 08:36 PM

Coredev said:

Language of choise : C++ via Visual C++ 6.0

1. Do I use DirectX or would OpenGL be easiest to start with.
2. I know Im going to have to use Win32 skills that I lack but bought a ton of books on the subject.
3. Should I, as a learning stage, program from scratch or find a good freeware game engine.


Hey Mike,

I use Windows and program 2d and 3d games in C++. My suggestion would be to take a look at SDL (www.libsdl.org) for a simple way to get access to various hardware, especially video. SDL allows you to create 2d games, but also sets the stage for an OpenGL context. I do not recommend DirectX, mostly because it is non-portable, but it has some ugly syntax and bad history too (Thanks a lot, Microsoft!). With SDL and/or OpenGL, you'll avoid any nasty Win32 programming as well. My preference has been to write games from scratch (on top of SDL), but it's up to you to try a game engine.

Feel free to email me with any more questions,
Jonny D

#12 LmT

    New Member

  • Members
  • PipPip
  • 15 posts

Posted 18 November 2007 - 02:58 AM

There are tons of books for DirectX 9, which is XP compatible. I've found DirectX to be better for me although I do want to try OpenGL. Just figure out what will be best for you =)

#13 SamuraiCrow

    Senior Member

  • Members
  • PipPipPipPip
  • 459 posts

Posted 18 November 2007 - 07:29 PM

GrimFang4 said:

I use Windows and program 2d and 3d games in C++. My suggestion would be to take a look at SDL (www.libsdl.org) for a simple way to get access to various hardware, especially video. SDL allows you to create 2d games, but also sets the stage for an OpenGL context. I do not recommend DirectX, mostly because it is non-portable, but it has some ugly syntax and bad history too (Thanks a lot, Microsoft!). With SDL and/or OpenGL, you'll avoid any nasty Win32 programming as well. My preference has been to write games from scratch (on top of SDL), but it's up to you to try a game engine.

I'll second that with the following caveats: SDL is written in C rather than C++ and makes more sense in C than C++. Sure there are wrappers for it to be used with C++ but they are just memory-consuming wrappers. Also, it's license is LGPL so you can only dynamically link closed-source software to it legally.

I'm thinking of switching some of my future projects to SFML instead of SDL. It has a few advantages over SDL: It is written in object oriented C++. It has a more liberal ZLib/LibPNG license so it can be statically linked without having to open up the source code (just be sure to credit the author in the readme files). Has fewer library dependencies. Doesn't include music player in memory (useful if you are streaming audio for all of your music or, like me, have a self-running music format).

The main downside to this switch is that SFML is a much newer (read that as buggier) library than SDL and may not have as much 2d functionality as what SDL 1.3 will have when it comes out. Since they are both open-source you can look at the source code and figure out what the problem is if you run into one.

#14 GrimFang4

    New Member

  • Members
  • Pip
  • 2 posts

Posted 19 November 2007 - 05:57 AM

Well, I'm happy with SDL being just in plain C. The big point of SDL in the first place was to be cross-platform. The C-ness of it allows for a small library that even fits into integrated systems (very small memory). I saw some research a while ago that included a test showing that Java handles object-oriented operations more than two times faster than C++ does. What speed you gain in using C/C++, you can lose just as easily by using too much OO. What that means, of course, is up to each of us.

You're right about the licence. That's kind of a drag sometimes, but I personally don't mind a couple of .dlls. On certain operating systems (e.g. MacOS), you can hide those, though.

If you're not going to rebuild SDL, any dependencies don't matter. SFML looks interesting, but yeah, it's pretty new. SDL has been around since 1999 or earlier, has a huge base of users (including major games like Neverwinter Nights), and it's getting on towards a 2.0 release (1.3 will become 2.0 since it's such a major set of changes). Historically speaking, SDL is _the_ reason gaming on Linux has gotten so far. SDL 1.3, which you can download already, doesn't include any really new functionality for 2d, but it does work much better with hardware acceleration than previous versions. It gives you hardware accelerated rotation, mutliple windows, and such on top of the already possible accelerated blitting. I'm excited about some of the other things, like multiple mouse input, which will make its way into my next game. SDL is very good with input and events. The SFML site says that it only supports up to two joysticks, but that's not a problem for most games.

#15 SamuraiCrow

    Senior Member

  • Members
  • PipPipPipPip
  • 459 posts

Posted 24 November 2007 - 04:13 PM

Dependencies make a difference in Linux when you have to make a half-dozen different packages just to get it to work on multiple builds. Being able to statically link makes a huge difference on Linux.

As for SFML, I like that it uses OpenGL for everything just like SDL 1.3 but has all of the 2d stuff hidden in the sprite class. Likewise, OpenAL doesn't have embedded MikMod music player routines in it so it should be streamlined in ways that SDL_mixer isn't.

One of my projects is to make a clone of Amos using emulation for all of the Amiga graphics chipset features used. I'll probably make a backend for both SDL and SFML since I may need to embed the libraries into the executable for some of the home-brew console development.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users