Archived

This topic is now archived and is closed to further replies.

ysotuff

All this for 2d?

Recommended Posts

Hi all, I bought Game Programming for Windows not that long ago. I wanted to create a simple 2d game. After reading a large portion, I''m amazed at how much work it is to create a simple 2d game. You should be able to create something along the same level of complexity as tic-tac-toe in about an hour, with all these calls to Windows and event handling and such it seems like even the simplest application would be very tough. By the way for all you super-game programmers is DX 5 much more difficult that DX7 or DX8. Thanks

Share this post


Link to post
Share on other sites
Was there a question?

Anyway, once you have the shell of a windows app, you should be able to use that for any project from then on. That should save you a lot of time from the start. Books like Game Programming for Dummies & Tricks of the Windows Game Programming Gurus include such a shell.

DirectX is a powerful tool, so the first time you use it you should expect to spend some time building libraries to make setup fairly easy.

^^^^^^^^^^^^^^^^^^^^^^^^^
Wait, wait, wait....who''s Nambla Fett?

Share this post


Link to post
Share on other sites
If you find there is too much work involved in 2d dx5 programming, don''t touch dx8, because there is no directdraw in it. I find dx7 very good to use for 2d games, though. I don''t know a whole lot about the differences in dx between version 5 and 7, but I would say it would be worth switching.

Also, for a tic-tac-toe game, you don''t need a whole lot. The hardest part would be AI and that is optional if you want to make a strictly 2 human player version of the game.

Share this post


Link to post
Share on other sites
Well that''s interesting. What I was trying to get across in my first email is that there is such a huge learning curve when starting to game program. Programming seems, so much (programming) for so little (game.)

I''m not interesting in using one of those game making programs. But I certainly think MS should have made peoples lives a little easier with DX.

Any hope for easy 2d in DX9?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yeah 2d in DX8 is a bit daunting, but once you get started and have done your first game + a made some simple helper funcitons, you should be able to whip out a fairly flash looking TicTacToe in no time at all.

Share this post


Link to post
Share on other sites
You could always use QuickBASIC to learn programming. I wrote Gravity Kills in 100 lines of code in QB. It took 3000 in DX 7. It''s available in the showcase and at The Rabbit Hole.

DirectX 7 is much better than previous versions. One reason is that DX7 won''t lock your computer up if you accidently blit something off the edge of the screen.

As you get better it''ll take less and less code to do what you want. If you want to learn you might as well start learning now. It''s only going to get harder.

Ben




Share this post


Link to post
Share on other sites
2d in dx8 is actually pretty simple - I got something nice up and running a lot faster than I ever did with dx7. Maybe I''m just an oddball, and just like 3d stuff more better.

But ysotuff touches on something that bugs me to no end - the misconception that game development is easy, and how little effort should go into a game.

I''m a professional game developer. I''ve been programming games in a professional environment for the past 6 years. I''ve worked on (and shipped) professional products for PCs, Macs, PS1 and PS2. Where does the misconception that any of the process is easy come in? Is it because games are a fun pasttime?

I''m so sick of "but why don''t you have a real job?" when I tell people what I do.

-scott

Share this post


Link to post
Share on other sites
quote:
Original post by ysotuff
Well that''s interesting. What I was trying to get across in my first email is that there is such a huge learning curve when starting to game program. Programming seems, so much (programming) for so little (game.)

I''m not interesting in using one of those game making programs. But I certainly think MS should have made peoples lives a little easier with DX.

Any hope for easy 2d in DX9?




Well, MS DID make your life easier. Instead of having to write different versions for each proprietary hardware interface, you only have to worry about writing to the DirectX interface.

IMHO, the actual game code should be much harder than getting DX up & running. Just follow the examples from a book/site/documentation.

And I doubt you will see 2D get any easier in DX9 because the focus has shifted to 3D.



^^^^^^^^^^^^^^^^^^^^^^^^^
Wait, wait, wait....who''s Nambla Fett?

Share this post


Link to post
Share on other sites
scaught, I agree with you people who''ve never tried to program games usually think it''s way easier than it actually is.

I do think that 2D game programming should be a lot easier than it is. Correct me if I''m wrong but 2d programming should essentially come down to.

1. Display picture
2. Have events happen with user input.
3. Change picture

The is obviously ridiculously simple. But I firmly believe that if MS made if a priority they could have made 2d a lot easier to implement. For instance although my DX knowledge is minimal to say the least I know you need to create some device and do things with that device (I think) why can''t you do all the stuff you need to with in built ''options'' that would be created specifically for 2D games. When will MS learn less is more!

Share this post


Link to post
Share on other sites
People do do what you''re talking about all the time, its called an engine more or less. There are a lot of engines out that that you can use, though most of them are 3D engines. I''d recommend starting with a library like Allegro, then moving on to SDL. With Allegro you get to making games a lot faster than you would otherwise, and you learn the basics before having to deal with the intricacies.

------------
- outRider -

Share this post


Link to post
Share on other sites
I am glad that MS did not do what you just suggested. That would have limited everyone to the same graphics engine.

What they did do was provide very flexible, fairly direct access to the hardware.

^^^^^^^^^^^^^^^^^^^^^^^^^
Wait, wait, wait....who''s Nambla Fett?

Share this post


Link to post
Share on other sites
BASSOFeeSH - notice I mentioned ''options.'' It should be there for those who want it. Those who don''t, can ignore it. In the grand scheme of things MS could have easily built in a bunch of 2d helper classes to make the learning curve a little easier.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Personally, I like OpenGL much better for both 3D and 2D, rather than DirectX, *BUT* I think Microsoft is accomplishing a decent thing with DirectX, and not just for programmers. DirectGraphics means anyone can play your game, no matter what video hardware they have... Have you noticed how many people have stopped using just Glide? Wouldn''t it suck if Glide was the only API we had, and now that Voodoo is kaput, nobody has a hope of playing all these cool games?

Game programming is not easy. Writing custom video drivers is often less easy.

My 2 cents....

-Miner2049er

Share this post


Link to post
Share on other sites
quote:
Original post by ysotuff
BASSOFeeSH - notice I mentioned ''options.'' It should be there for those who want it. Those who don''t, can ignore it. In the grand scheme of things MS could have easily built in a bunch of 2d helper classes to make the learning curve a little easier.


I guess, but I guess they could have written simple engines for each portion of directX. I don''t blame them for skipping that part...afterall, it''s free.

But seriously, if you are having problems, you should be able to find some free 2D engines rather quickly on the web...even on this site I suppose.

Good Luck


^^^^^^^^^^^^^^^^^^^^^^^^^
Wait, wait, wait....who''s Nambla Fett?

Share this post


Link to post
Share on other sites
quote:
Original post by ysotuff
BASSOFeeSH - notice I mentioned ''options.'' It should be there for those who want it. Those who don''t, can ignore it. In the grand scheme of things MS could have easily built in a bunch of 2d helper classes to make the learning curve a little easier.


Next you''ll be suggesting that MS should include a Tic-Tac-Toe framework for everyone to use "as an option". MS provides a hell of a lot as-is - more than enough tools to create pretty much anything you want. As for 2D helper classes, what do you think DirectDraw is? All thost DX7 interfaces are accessible through DX8. Plus, there are helper classes like D3DXSprite to help you along. I threw together the beginnings of a 2D RPG complete with menu interface using DX8 in less than a weekend. (my little guy (after character creation) can run around a map (except over the water) and go into (empty) towns.)

If it''s too much work for you, I''d highly suggest seeking another solution. Some of the fancy Basics (Blitz/Dark/et al) provide a lot of what you''re looking for. There are also numerous free engines available for you to build upon, freeing you up from the ''dirty work''.

Game development is not (and should not be) for the lazy.

Share this post


Link to post
Share on other sites
Scaught - a few points:

1. I''m not lazy
2. Your tic-tac-toe framework option suggestion was unhelpful

Not everyone is able to pick up game programming as easily as yourself. My ultimate purpose of posting this message was to hear from peope who were having similiar problems and had ''helpful'' suggestions.

Regardless of what you think, DX is not very straightforward for those starting off.

Share this post


Link to post
Share on other sites
quote:
Original post by ysotuff
Not everyone is able to pick up game programming as easily as yourself. My ultimate purpose of posting this message was to hear from peope who were having similiar problems and had ''helpful'' suggestions.



Who said I picked it up easily? I didn''t pop out the womb doing 3D math, you know. My point was it takes a lot of work, not very much of it "easy". It is, however, extremely rewarding and interesting if you''re into it.

quote:

Regardless of what you think, DX is not very straightforward for those starting off.



Then I highly suggesting starting off somewhere else, and get to DX when you''re ready.

Let''s take an analogy from the "real" world, shall we? Let''s say you really want to get into knitting. You don''t immediately start off trying to knock out a super fancy sweater - you start ultra basic. (but, uh, since I don''t know the first thing about knitting, I don''t know what''s even considered ultra basic.) Likewise, if you *need* a super fancy sweater, what do you do - you go buy a pattern or a how-to-make-a-sweater kit. (heh...what hole did I just dig myself into?)

Programming games is the same way. Get a nice solid foundation of programming concepts underneath you, and stuff like DX will come more naturally. Start small and program often. Experience can''t be learned.

I''m not trying to discourage you or be negative/cynical - I''m just pointing out that it IS hard work and a lot of "no fun" to get to the point where you can be working on the top rated baseball game each year. (ahem)

Cheers,
-scott

Share this post


Link to post
Share on other sites
quote:
Original post by ysotuff
DX is not very straightforward for those starting off.

I''m with scaught, largely. Game development is not for beginning programmers. Even a simple 2d game (employing make-my-life-easier libraries like Allegro or SDL) requires some fundamental knowledge and ability. It''s not as simple at a .sig around here says - "use the WriteCoolGame() function."

Think about the fact that DirectX is not a game programming library, even though gaming is its primary focus. It''s used in visualization software, Windows multimedia applications (media players for instance), content creation (3d modelers), etc. If Microsoft had put a lot of work into providing you with frameworks for games, they may have alienated other developers. Furthermore, you''re only whining cause you''re just getting in. 3, 4 years ago, you had to write your own VESA drivers for DOS, your own memory management and "multithreading" (DOS multithreading, haha) code, your own input drivers - one for every type of input device (one for each Thrustmaster, one for each Gravis pad, one for the keyboard, one for Microsoft-compatible mice, another for Logitech-compatible mice), your own soundcard drivers (SB, AdLib, Gravis Ultrasound...) The list goes on. All of that has now been abstracted for you via this framework of libraries and vendor-supplied device drivers.

Be appreciative. Things could have been a lot worse.

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

Share this post


Link to post
Share on other sites
If programming was easy, everyone would be a programmer. Same thing goes for other technical jobs like engineering or dentistry. You should be thankful the folks down at Microsoft were kind enough to make a nice little API for you to produce programs fast and efficiently (can't forget the community that made OpenGL ). If they didn't, you would be spending a lot more time trying to make your own API.

Also, once you have your basic setup with a few nice classes you made yourself (this is also called a skeleton, base, etc. code), you will be on your way to making a simple game easily and quickly. Tic-tac-toe is not hard; it's just those first few steps you are taking that makes it so hard (i.e. setting up DX).

All tic-tac-toe is, is a 2D array. Then, you check its states every so often (HINT: when a user or the computer makes a square selection).

Sometimes people take for granted how programming is when you do it all in ASM (do many people code in binary anymore?; that's really taking it for granted ).

Keep with it and you wil prevail ysotuff.



Edited by - Floppy on December 12, 2001 7:10:42 PM

Edited by - Floppy on December 12, 2001 7:11:56 PM

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I´m not an expert programmer, but I´ve read Tricks of the Windows Game Programming Gurus and it´s a very complete and easy to understand DirectX tutorial. In fact, the author prepares a complete (altough simple) 2D engine very suitable for making some demos. Moreover, he prepares two more engines for sound & music and input and his e-mail support is great. ysotuff, I recommend you to take a look at that book.

Share this post


Link to post
Share on other sites
Myself it took me awhile to learn 2d DirectDraw programming. ysostuff-I could use your argument and apply it to 3d programming; it should be easy just:
1)render 3d objects
2)get input
3)move 3d objects
Personnally, I like DirectDraw because it''s easy for me (remember I said it took me awhile to learn it though). The hardest part now is programming specific to the program/game (stuff like AI/physics, that sort of stuff) stuff that might not be DX specific though. Other stuff like ANSI C, MFC type dialog based apps (not games), and DAO database type stuff is pretty much the only other C/C++ programming I really know. And compared to advanced game mechanics that other stuff is relatively simple.


"A man can''t just sit around." ''Lawn Chair'' Larry Walters (1982)

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ysotuff- From the sound of your post, it sounds like you are new to Win32 developement. If that''s the case, then not only do you have the learning curve for DDraw, but also for Win32.. which, if you aren''t used to the message/event style of programming, can be very frustrating.

I used to miss the days of DOS programming, where you could just write directly to video memory... and writing custom blitting routines in assembly was fun (trying to wring those last few cycles out of your code). But now DDraw offers you hi-res, hi-color, hardware accelerated graphics in a fairly generic API, that works on every computer (heck, they even emulate most of the APIs that aren''t native to the hardware!)

Also, it may seem like MS neglected the 2D stuff, but take a look at Direct3D. There''s about a million more things that you have to do and setup to make even a simple spinning cube (and then there''s stuff like texture mapping and lighting!). The bottom line is that generic graphics APIs are just getting more and more complex. When I first started messing with DDraw, I swore up and down at the fact that there wasn''t a simple PutPixel() or DrawLine() routine .. I had to do everything myself! But if you are writing a game, would you rather call a generic (and likely slow) putpixel/drawline/sprite routine? Or one that you wrote yourself to be fast and efficient for your particular case? If you''d rather use the generic implementation, then MS has the perfect API for you, it''s called GDI (and there''s a reason it isn''t used for games).

Several people on this thread have suggested using SDL or Allegro. Personally I find the SDL API pretty clumsy and I don''t like the "style", but if you want to write a 2d game in under an hour, then I suggest you look into it. www.libsdl.org I believe will get you there. In the past I have always used SDL when I want to get something up and running as quick as possible. There are a ton of very useful support libraries for it too (like SDL_ttf, or SDL_image). I haven''t used Allegro myself, but I have looked at the API docs for it, and it is a much more complete game API (I believe it has APIs for sprite blitting, etc).

Graphics APIs are definitely getting harder. You can use some of these other libraries to simplify things, but be careful that you don''t cheat yourself out of learning DDraw in the process. It''s like learning to program for Win32 using VisualBasic. Try that for a while, and then try moving to Visual C.. you''ll realize how much more power you have, and how much you took for granted because VB handled it all for you.

Brannon

Share this post


Link to post
Share on other sites
If you wanted to draw a square, would you render a cube in 3DS Max and view an orthogonal projection of it?

Of course not, way too complicated. You could draw a square this way, but it''s much easier to open up windows paint and use the square drawing tool.

If you wanted to make tictactoe would you do it in DirectX?

Same answer, of course you wouldn''t becaue it''s way too complicated. You could but it would be a waste of time. Do a simple visual program in VB, or write a console program in C.

Why use DirectX? Does your tictactoe just have to be full screen and have exclusive mouse control? Do you want to alpha blend your X''s and O''s or something? It takes a lot of work to make Tic Tac Toe in dx just like it takes a lot of work to make anything in dx. Dx can do many, many different and complex things, so it has many options and requires a lot of setup.

Share this post


Link to post
Share on other sites
Thanks Brennan, your message was very helpful. I should mention that I never intended to create Tic Tac Toe, I was just using it as an example. If I was, I would probably just use VB.

Share this post


Link to post
Share on other sites
Bah.. direct3D this, DirectDraw that. Use OpenGL for 2d, it''s much faster than DirectDraw because of the 3d acceleration and you get things like masking, blending, etc.. for free. You can use Direct3D but OpenGL will be a lot easier to code.

You won''t have to write 4000 line programs to make tic-tac-toe

Note that you can still use DirectX for everything else. I hate it when people think you can compare all of directX to openGL or any other 3d api. Compare apples to apples, not apples to oranges, bananes, mangoes, and whatever else!

Share this post


Link to post
Share on other sites