Advertisement

Miscellaneous programming questions

Started by July 09, 2000 08:40 PM
4 comments, last by GreG_K 24 years, 5 months ago
Hey, I have a few questions 1.Does anyone here use references instead of pointers? what are there advantages? 2.Why does C++ some so much more huge than C? How long does it regularly take to learn? 3.Can someone explain to me the concept behind creating a game, It hurts my head trying to think of how the lines of code actually turn into objects on the screen, and how variables can actually control graphics. It''s like the language knows what it''s doing, but C doesn''t really understand models or pictures, it''s really confusing me 4.IS OOP really the solution to all games? because people do tend to plan games procedurally. for example, a TODO list for the engine or something, some ppl will write down things they want done then look over each major part and do the most important first, that''s pretty much procedural don''t you think? 5.Why is VB not classified as a "real" programming language? 6.Why do people seem to "care" as to what programming language you use, as long as the project is finished and it''s a good game? Not to say I use VB, but most C or C++ programmers will say, "VB?! eww" and stuff like that, I think it''s seriously retarded. 7.I had a question earlier that I asked, but noone answered but I thought It was something that needed answering. Do you people have innovative ways to use short-cuts in game development without loss of quality, I mean scripts for example, or anything in general that will speed development of the project up. 8.can someone list some things that are bad to use in C/C++ for my future reference? So far on my list ( that books have told me) are: 1.Do NOT use GOTO statements 2.Don''t use too many globals 3.Do not go crazy with multiple inheritance. 4.Do not go "class crazy" ( tricks of the windows GP gurus) and speaking of this subject, why doesn''t someone make a book on C/C++ that teaches the language AS it teaches you gamedev. kind of introducing you to 2 things. I think that would be cool. 9.Why when C was the most popular language and used to make many games, noone complained, but now that C++ is the "in" language now people act as if C has "dissolved" and that C++ is the answer to everything. People say that C can be extremely hard to manage. Well maybe, but how did those thousands of games before C++ was extremely popular manage to come around? Well, can''t think of any more questions now, damn Greg K.
Greg K.
quote: 9.Why when C was the most popular language and used to make many games, noone complained, but now that C++ is the "in" language now people act as if C has "dissolved" and that C++ is the answer to everything. People say that C can be extremely hard to manage. Well maybe, but how did those thousands of games before C++ was extremely popular manage to come around?
Well, C was hard to manage by today''s standards Now we''re all spoiled. Anyway, C++ is a better choice than C the way Windows 95 is a better choice than Windows 3.1. Not only is everyone using it, it''s simply more advanced and easier to use. (Sorry for annoying anyone who doesn''t like MS)

lntakitopi@aol.com - http://www.geocities.com/guanajam
Advertisement
1. Yes, I try to use references as often as possible. They''re cleaner than pointers and faster than variables for passing large objects as function parameters. (By the way, I don''t use references ''instead'' of pointers. They both have their uses.)

2. C++ is just C with a few extra features. An experienced C programmer can pick up C++ in a day, though getting the hang of OOP takes a little longer.

3. I can''t really tell you how it works without going on and on and on. Best bet: get one of those ''Game Programming'' books. They aren''t too great for actually teaching you programming but they can give you a basic understanding of simple game programming techniques and graphics code.

4. there''s no single solution for all games. A lot of game programmers are from old-school backgrounds, including assembly, which is ''pure'' procedural programming. So, OOP hasn''t really caught on with game programmers quite as much as with other software developers. However, I think this is changing and OOP is slowly becomming the norm.

5. Most people using VB are total newbies, so the language itself is associated with newbies. Also, VB is extremely high-level and doesn''t give you too much low-level control. Finally, VB is too slow and inefficient for anything other than budget games. You can optimize, and I''ve seen optimized VB code run faster than unoptimized C.. but, optimized C will always beat optimized VB code. Oh yeah, and VB is Windows-only.

6. If you actually finish a game and it''s good then I don''t think anybody really cares what language you did it in. It''s just that there''s so many newbies who come on boards and say ''Hey I''m making a game like diablo II in VB but I need help with my new 3d engine!! what is a normal??!?'''' that after a while you tend to associate VB with those newbies, even though there may be some decent developers working with it.

7. The best way to save time in a game is to have a good design. If your code is very well designed and documented even before you start writing it, you shouldn''t have to rewrite it, and that''s the best time saver possible.


8a. Never use GOTO statements. It creates insane spaghetti code (try tracing through JMP statements in aseembly sometime) and is never necessary anyway.
b. Lots of globals is avoided for two reasons: one, it''s confusing, and two, it goes against OOP. If you don''t care about OOP then using globals can speed up some critical sections of code. A few years ago it was common practice to optimize critical functions by passing parameters using globals to avoid pushing and popping them onto the stack. Nowadays, micro-optimizations like that are generally overkill.
c. Multiple inheritance is confusing as hell and buggy on most compilers. Considering how it''s almost never useful in game development, I''d avoid it like the plague.
d. I think this is a common misconceptions and I disagree with it. There''s virtually no performance hit in using classes and nothing wrong with using objects whenever applicable. I''ve worked on many projects where the -only- global function was WinMain (and a handful of macros). But, it''s all a matter of personal style.
d(2). This is a pet peeve of mine: people trying to delve right in to what is very easily the most difficult branch of programming (game programming) immidiately. Believe me, I''ve worked on OS kernels and device drivers before, and I''ve had more problems with DirectDraw than those. You gotta have patience and a good background first.. I don''t think anybody should even think about programming a game until they know their language and they know how to work with their OS.

9. Natural progression. People used to code games in assembly and never complained because there was nothing better available. As each language gets simpler people get spoiled with them and don''t want to go backwards. I mean, when I first bought my old 486 with 8MB of RAM and a CD-ROM drive, I thought it was amazing! But two years later, after I had a Pentium with four times the RAM, the old one seemed like crap . And now, my old Pentium is crap next to my Athlon.

If you don''t believe me, check out some of the open source for the older games, especially ones using assembly and procedural C, heavy on the goto. And tell me it''s easier to read than modern C++ .

-RWarden (roberte@maui.net)

1) I never use references. Just personal preference that I always use pointers.
2) C++ contains everything from the C language and then some extra stuff. That is why it is bigger then C. What ectra stuff ? Classes and inheritance mainly
3) you referec to tricks of the windows game programming gurus. Read it, read it again. Do some of the examples, then read it again.
4) OOP is not the solution to ALL games but it sure does help.....ALOT. Most of DirectX and windows is OOP
5) i have never used VB so I cant dis it. But most people say it is slower then C++ but I dont know myself.
6) As long as the game is done and has quality, it doesnt matter what language you use. Most of those guys who say ewww to VB are prob using c/c++ and dont get nothing done themselves. It is mostly loyalty to a language b/c the person knows it very well is why they are turned off by other languages.
7) yes, most people have shortcuts without loss of quality to make a game. I would say the best shortcut to use (the one I do) is to write your own class wrapper to encapsulate DirectX. The wrapper I wrote GREATLY reduces the amount of work YOU have to do to get things going without a big hit on framerate.
8) Dont use goto statements. If you want to use goto statements then GOTO Visual Basic
9) already answered in above post


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Alright I can answer a couple of those. To start with I''ve been programming in VB for 6-7 years and was about to be microsoft certifide and probably still will. But within the last year I have just about dropped vb and gone to assembler... yah people will gasp harsh switch eh? Well to start most people won''t consider vb a Game-programming language because it''s slower. No matter how much they improve vb, it''s still slower and requires all those dll''s and ocx''s and such. When you develop a game for a commercial purpose or even for fun your trying to beat current technology so you need to fit more effect per frame and stuff, when your using a slow language like vb, you *could* make a game, but you won''t be able to make the same game I''m making in asm run on the same level of machine.

The wisest thing to do as a newbie is to start with C++, it''s a bit tricky but it''s not as hard as asm and is WAY faster then vb and is transferable to other careers other then gamedev.

Umm in terms of a script or short cut for making games, they do make "engine" where all you do is right stories and scripts and it makes the game for you, but again it''s like using vb, usually slow only good for turn based rpg''s or something like that.

Which leads into the concept of game developement. Gamedev is an art which combines Programming, Graphics, Sound, and Creativity/Story, etc... You must try to balance your games. A game with incredible graphics but no sound or music and a bad story line will still do bad.

So programming a game (The programming part) is a process, you start by initialising the screen. Then you display a picture. Then you move the picture around the screen using arrow keys. Then you move the picture around over top of a background pic, like terrain, then you learn to play music, then you make a menu system. Then you develop your playing arena or playing field. Then you maybe tile a map. Then you move units on the map or explor the map with you character. Then you have multiple maps. Then you have multiple units. Then you add networking. Etc, etc..
I guess this is speaking in terms of most 2D games, which is a great place to start as a newbie to gamedev.

Hope this helps some!
See ya,
Ben
__________________________Mencken's Law:"For every human problem, there is a neat, simple solution; and it's always wrong."
"Computers in the future may weigh no more than 1.5 tons."- Popular Mechanics, forecasting the relentless march of science in 1949
5.Why is VB not classified as a "real" programming language?

I''ve been using VB for a number of years now, it''s basically what I do professionally. It''s not a fast language suited to graphics or such processor intensive applications - but then it was never designed to be.

It has no support for directly using memory for example. Now it''s quite easy to get around that, as well as most other things - but you''ll just end up trying to get around the language limitations and restrictions.

I prefer to use C++ unless I am trying to prove a concept - it''s a lot faster and easier to get something working in VB and then "translate" to a C++ version.

VB has it''s place, but it most definitely is not for serious 3D stuff!

This topic is closed to new replies.

Advertisement