Author |
A Question for programmers out there... |
Kanman Grand Admiral Pitch Black
Joined: August 26, 2005 Posts: 1017 From: Virginia, United States
| Posted: 2007-02-10 22:37  
As you guys know, I tinker with my weak understanding of C++ to write simple games.
My question is rather straight forward. Why is it that my computer can play games like DarkSpace and HomeWorld2 and Battlefield 1942, etc smoothly, but when it comes to my games, it seems to encounter lag rather quickly? For example, You all remember my games? Well, why is it that after only a few thousand particles are in play that is slow substantially? How is that so much more processing power than big games like Ds and stuff?
I have already figured out that loops within loops are really bad. But really, what is causing this lag in my games? For general info, I am using DevC++ and programming in OpenGL. Perhaps one of those is really inefficient or something. My code can be quite simple and short and still not run so smoothly as I would desire.
Thanks for any ideas that may come to mind explaining this to me.
_________________
|
Supertrooper Marshal Pitch Black
Joined: March 18, 2004 Posts: 1895 From: Maryland, U.S.A
| Posted: 2007-02-10 22:39  
Because those games are done by Industry Professionals, not amateurs (Not to sound rude =P). They have different programs, and a more advanced and streamlined code they use, which applies to their games engine.
_________________
|
Drafell Grand Admiral Mythica
Joined: May 30, 2003 Posts: 2449 From: United Kingdom
| Posted: 2007-02-10 23:05  
The CPU tends not to be that good when trying to draw several thousand separate 'objects' on screen at one time, and your code is probably telling the computer to draw each object individually, whereas you should be able to find away to draw all objects of the same type/class in one pass...
Also, particle physics are very CPU intensive. Even a fast CPU will have trouble rendering a few thousand objects on screen and calculating the paths and interactions between them. It's one of the reasons why many complex graphical effects are pre-rendered and only shown as multi frame animations.
I honestly don't know enough about this kind of stuff to be much help, though.
_________________ It's gone now, no longer here...Yet still I see, and still I fear.rnrn
rnrn
DarkSpace Developer - Retired
|
Light-of-Aurora Grand Admiral
Joined: December 01, 2003 Posts: 602 From: NJ, USA
| Posted: 2007-02-11 00:32  
If there's anything I've learned in my very short existance, it's that games that look pretty look pretty because the artists are good at making crap look beautiful.
I guess they use low-poly models, and they work magic with low-res textures to make things like EVE, WoW, Darkspace, etc.
A lot of the 'pretty' factor and the 'apparent complexity' factor are derived from skill with texture work.
Imho, instead of making those few thousand particles, try to make something that looks like a few thousand particles.
But of course, it can't all be artistic ability, there are probably some code-side things they do better.
[ This Message was edited by: [AÐ]Light-of-Aurora on 2007-02-11 00:34 ]
_________________
|
$harp$hooter*M* Marshal
Joined: April 20, 2006 Posts: 42 From: Massachusetts
| Posted: 2007-02-11 00:32  
Get a Better Graphics Card/Video card ETc.... and more internal memory, like more Ram, that should clean things up quite nicely
_________________
|
doda *EP5 no longer exception...* Grand Admiral
Joined: December 11, 2005 Posts: 1012 From: happy land
| Posted: 2007-02-11 01:55  
you need tons of cpu to run a game, also better coding = less stuff to generate.
_________________ Please resize your Admin - signature
VCA since June 5th 06
|
Coeus Grand Admiral Sundered Weimeriners
Joined: March 22, 2006 Posts: 2815 From: Philly
| Posted: 2007-02-11 02:35  
A lot of the problems with unoptomized code lie in "memory leaks" that occur with loops and functions in programs, where something that has already happened in game will continue to eat up RAM as new parts of the program are initiated.
Graphics Engines and whatnot are also ususally designed to take advantage of the built in properties of video cards, to take the strain off of CPUs and RAM.
_________________ Do I really look like a guy with a plan?
'I'm gonna go crazy, and I'm taking you with me!'
ICC Security Council Chief Enforcer
|
Lyedtau Admiral
Joined: January 18, 2007 Posts: 147 From: Dev land
| Posted: 2007-02-11 09:34  
Doing poly/particle drawing on the CPU is always a bad idea. You've got a freaking graphics card, make use of the damn thing! The reason their games run properly, is because they make use of all available hardware. They use the graphics card to draw graphics-relating content, and use the CPU for things like AI, and such. This balances the load a lot more than simply using the CPU for everything, although using the CPU in simple games much like your own, is fine.
Also, like someone else said, graphics artists are genius' at working magic with textures and modeling. They can make a model with a poly limit identicle to UGTO dreads, look a thousand times better, simply by rendering bump-mapped textures, and using shaders.
- Lyed
_________________ rn
Made by Doran
|
Sixkiller Marshal Courageous Elite Commandos
Joined: May 11, 2005 Posts: 1786 From: Netherlands
| Posted: 2007-02-11 10:50  
well, you all heared lyedtau, time to kidnap some people and put them to work!
_________________
|