Alpha Centauri Forums
  The Game
  Does your game slow WAY down? What's a MEMORY LEAK?

Post New Topic  Post A Reply
profile | register | prefs | faq | search

Author Topic:   Does your game slow WAY down? What's a MEMORY LEAK?
secret agent man posted 06-02-99 03:06 PM ET   Click Here to See the Profile for secret agent man   Click Here to Email secret agent man  
Sorry, I know someone has posted something about this before but I didn't know what they were talking about (it's hard to notice a slow down in the game when it was already slow to begin with on my old P166). Now I have a Celeron 450A, and the game starts out really fast. A just-loaded save game starts out pretty fast also, regardless of map size or #units, but as the turns progress, sometimes the game just slows down to about how fast it was on my P166! What was that thing about a memory leak that someone mentioned?

Any suggestions, solutions, or is it just my imagination?

Goobmeister posted 06-02-99 03:36 PM ET     Click Here to See the Profile for Goobmeister  Click Here to Email Goobmeister     
I doubt it is just your imagination.

A memory "Leak" as I understand it is when a piece of code does not release a section of memory, thus more and more memory is held out of play and useless untill the scarp of stuff is actually swapped out to virtual memory. Thus a program may seem to slow down, unless you have rebooted or done some other action to release the memory.

The best tool I have found so far to help avoid this is MemTurbo a memory defragmenter (www.memturbo.com). You can download a shareware version that will expire in 30 days, (I have talked with no one who has gotten around that either, maybe nobody tried hard enough) it will defrag your memory and give it that "just booted feel".

I hope this helps.

Goob

MichaeltheGreat posted 06-02-99 04:31 PM ET     Click Here to See the Profile for MichaeltheGreat  Click Here to Email MichaeltheGreat     
If you use installer/uninstaller software to monitor the installation, you can ALWAYS get around the 30 day bs - the most clever anybody gets is leaving a hidden .dll behind that invalidates the next installation of the program. If you use something like cleansweep, it's not a problem. You can always find a way to get software for free.

Goob, you're understanding is essentialy correct, but the code actually releases the memory, the OS just doesn't recognize it. If anyone is running Win95 Service Pack 1 or less (check the version number in control panel/system - if its 4.00.950 (a) or 4.00.950, there is a kernel fix from microsoft on their site. If you have Win95 OSR 2 or OSR 2.5 (version no.'s 4.00.950 (b) or (c) the kernel patch is already done.

Win 98 has no published or acknowledged leaks, but it is there - they managed to break the 95 fix.

Nell_Smith posted 06-02-99 05:54 PM ET     Click Here to See the Profile for Nell_Smith  Click Here to Email Nell_Smith     
Michael:
Hmm... MemTurbo doesn't leave behind any DLLs or other discrete files, but it does leave text strings in system.dat and user.dat... if you know a cunning way to get rid of these following a complete uninstall AND a registry search AND a cleansweep, I'd be fascinated to hear about it
Nell... always hunting new tips and tricks... hehe
MichaeltheGreat posted 06-02-99 08:12 PM ET     Click Here to See the Profile for MichaeltheGreat  Click Here to Email MichaeltheGreat     
Nell - I'll install it clean on another computer I have lying around, and record the changes, and tell you what to clean out. If I was 13 again and had all sorts of free time, I'd write a little C++ program to sniff and eradicate the changes and post it on every warez site in the universe.

I've played with it in the past, but I don't use it now, since I have so much RAM, and actually reboot occasionally. I'll email you the info on what to do to make it work continuously.

I assume you have a reliable hex editor like the old Norton diskedit.exe?

It'll take me about a week to get to it - I'm about to disappear off the forums for a while, due to crushing work deadlines and the need to earn a living. (snif....waaah)

Michael

secret agent man posted 06-03-99 12:55 PM ET     Click Here to See the Profile for secret agent man  Click Here to Email secret agent man     
Thanks for the replies. I have a question about what this program will actually do for me, however.

Is it something that runs in the background so that the game won't slow down anymore no matter how long I play it, or is it something that needs to be run manually every so often by quitting SMAC out to my OS?

I am using Win98 and I'm not sure if the memory culprit is the OS or SMAC. Also, I don't know if this is a related problem but if I play SMAC for a long time, then quit and try to shut down out of Win98, I get the blue screen of death.

Darkstar posted 06-03-99 01:06 PM ET     Click Here to See the Profile for Darkstar  Click Here to Email Darkstar     
SAM - That would be SMAC's fault. A very large part of it has to do with how they implemented using the multimedia aspects. On Win98, if I quit the game while its giving me the "Please don't go. The Drones need you. They look up to you." speech, SMAC doesn't bother to release MOST of its resources. The only problem is, that I only get that speech played in about one out of four times. But I still have to wait as if it was playing, other wise, I have the resource problem.

Its even WORSE for PBEM Multiplier. It seems SMAC shuts down at the save and exit without even BOTHERING to try and clean its act up and release its resources.

Before SMAC, I rebooted my home system about once a month. That wasn't due to any need, other than shutting it down to clean around my computer desk/area or swipe mice or clean up the system ventilation holes itself. Now, I have to reboot after every PBEM turn, and generally after every SMAC session if I want my system to behave like it did before the ugly piece of code that is SMAC.

-Darkstar

MichaeltheGreat posted 06-03-99 01:26 PM ET     Click Here to See the Profile for MichaeltheGreat  Click Here to Email MichaeltheGreat     
Darkstar - I had to glimpse daylight for a second, and am delighted to have a chance to renew our Apps/OS sparring - suckass app coding will create that problem, but my opinion is that it is still the OS's fault.

The OS is still supposed to be the sheriff in Computertown, and especially in multithreading/multitasking environments, where processes and threads can hang and get lost, it's still sheriff OS's job to round up the drunks passed out on the street and run 'em out of town.

It is very simple from an OS standpoint to track which exec's are still running and which memory regions and swapfile chunks they are claiming. SMAC, like all windoze apps, does it's thing through calls to the windoze API, and even if resources are unreleased, there are enough other API calls in app closure that Windoze could and should ensure proper deallocation - when you have an app hang and use control alt del, windoze 9 times out of 10 still doesn't fully deallocate.

The same types of problems happen with many apps, including Office and other microstupid products. It doesn't excuse bad coding practices on the app side, but the OS should still ensure that the dealloc is handled, regardless of whether an app terminates normally or abnormally.

Your turn <evil grin>

MtG

PS, When I fully reemerge to see if I can see my shadow, wanna join me in a "Coding practice lessons for Firaxis programmers" rant in non-SMAC?

You can originate that one, and I'll do a rant on "real OS's and what they are supposed to do" - maybe we'll scrape up enough design/coding talent to form our own game studio and rock the TBS world. Or at least piss off Firaxis for their attitude that gamers/app developers like us wouldn't be the elite of the elite as beta testers.

MichaeltheGreat posted 06-03-99 01:35 PM ET     Click Here to See the Profile for MichaeltheGreat  Click Here to Email MichaeltheGreat     
PS - Darkstar - try waiting a couple of sec's for the speech to finish - the dealloc problem may be a little better, since the speech is handled through (In)directSound and other Windoze sound components - it is essentially a process calling another app, and the inability to return from the call once SMAC is shut down may cause a hidden improper termination of the sound applet or SMAC itself.

Suckass coding if true, but still OS stupidity.

MtG

I notice that termination from Ironman seems to have a similar effect as shutting down after a PBEM. Have you noticed the same thing, or do you still play at Citizen with the SE on? :P~~~

marc420w posted 06-03-99 02:38 PM ET     Click Here to See the Profile for marc420w    
One little thing that I've found helps speed up SMAC when its slowing down.

(BTW, I normally play with all sound off...)
1) go into prefs and turn on one sound option. Usually I click SFX, but I don't think it matters. Just as long as Main comes on as well.
2) Say ok and exit prefs.
3) go back into prefs and turn the sound back off.

The above can very noticeably speed up SMAC on my system. For instance, usually I notice it by seeing that the 'blink-rate' on my units is slow. By doing the above, even though I end up exactly where I started, I can see the blink rate get much faster. Something is cleaning up when I do that, probably when I turn the sound completely off is when something gets cleaned up.

HTH
Marc

PS, Michael, drop me a line when you get your TBS game company going. I'm only a half-@$$&d programmer, but I know enough to do Tech Support for a software company. And I always have lots of big ideas and I love to write to the point where you'll have the thickest manual in the game biz...

Nell_Smith posted 06-03-99 02:57 PM ET     Click Here to See the Profile for Nell_Smith  Click Here to Email Nell_Smith     
Michael:
Hey that would be great... much appreciated You sure I can't persuade you to revisit those old C++ days?? hehe

Secret Agent:
MemTurbo loads on Windows startup and runs constantly in the background. It takes up virtually no system resources (around 0.5% of CPU time according to WinTop) and you can set it to automatically defragment and recover RAM whenever the amount of free RAM goes below a level set by the user (I find 10Mb to be a good level). At any other time, you can run MemTurbo manually by using the hotkeys CTRL+ALT+M. It only takes a couple of seconds and you don't have to quit out of your current application, so no, you don't have to quit and restart SMAC.

I highly recommend MemTurbo and find that it speeds up SMAC enormously after I've been playing for an hour or two and RAM is full of junk.

Hope this helps,
Nell

Darkstar posted 06-03-99 03:06 PM ET     Click Here to See the Profile for Darkstar  Click Here to Email Darkstar     
MTG- Get back to work, ya bum! Don't you know that the Forum is a trap?

Yea, that is most CERTAINLY a problem on both sides of the house. We exiting QUICKLY, the resources associated with the DirectSound should be left either still allocated (as it was still in use) and shutdown (poor method), or it should do that neat Unix File System trick of Delete temp file now (and when its done, actually DELETING) [never done this under M$ OS's... I'm TOLD they can, but I just never trusted it that much], or throw a simple boolean and have that one of the last items cleaned up... and wait until it finishes. You can shut down the screen and release all the other resources, including the DirectX jazz in a lot of cases, while waiting on it.

Yeah, the OS is SUPPOSE to catch that. But I don't think that they ever "gets done" using it, so therefore it never goes away. Like in M$ Office case of the certain M$ Word modules... the first time they get loaded, they tend to stay as they get used in EVERYTHING (E-mail, Internet Exploder, etc etc etc). Its quite funny to sign into my NT workstation, and start a document and have its title be Untitled #12... I wonder what I could get it up to if I didn't power it down over most weekends?

I was thinking of going to back to Citizen and seeing what Transcend level options are in it by mistake. Transcend gets the Citizen Bonus Credits, so Citizen must get screwed somewhere. Besides, that would probably be the only way I would ever Transcend. Otherwise, the AI would piss me off too early, and I would have to put it in its place...

And I would think that Firaxis has a clue how to program. They just don't do so when they are in the crunch. Too bad that is when they write 60% (at least) of their Game code.

I don't play Ironman very often. I DO get a strange crash now and then (once every couple of days of SMACing)... especially if I play Ironman. It seems to attract it.

Marc - It does indeed sound as if that trick causes it to refresh, and dealloc its resources. I'll have to remember to try that.

-Darkstar

Chowlett posted 06-03-99 03:49 PM ET     Click Here to See the Profile for Chowlett  Click Here to Email Chowlett     
MTG: would you mind sending me the solution to the MemTurbo un-re-install? I have much the same problems, and would be grateful of assistance.

Thanks

MichaeltheGreat posted 06-03-99 04:32 PM ET     Click Here to See the Profile for MichaeltheGreat  Click Here to Email MichaeltheGreat     
GASP - another breath of air!

Chowlett - sure I'll send it to you when I email Nell with it.

DarkStar - Crunch time is when we all do about 90% of our programming, so if Firaxis only does 60% during the crunch, they're not doing badly. Suckered ya tho' - I got YOU to defend Firaxis' programming hehehehe now I'll never let you live it down. :P~~~~

Back into the hole - I'll be QCing crap until way past midnight again.

Captain Action posted 06-03-99 11:56 PM ET     Click Here to See the Profile for Captain Action  Click Here to Email Captain Action     
There is another possiblity. In my games on a 350 mhz k6-2 I get MASSIVE slow down when I scroll the map over the "Energy pyramid" that I constructed. On this mountain of ecshlon mirrors and solar panles are 80+ supply crawlers, 30+ infantry, and 10+ superformers. The same occurs when I put all of these units (120+) in one city. I scroll over that city and it justs crawls to a near halt! I think that the programmers of SMAC got lazy and just drew each of the units regardless of the units could be seen! Hell, I even used this "feature" to scope out probe teams sneaking in the fungus patches! This may or may not be of any real help but it never hurts.
MichaeltheGreat posted 06-04-99 12:58 AM ET     Click Here to See the Profile for MichaeltheGreat  Click Here to Email MichaeltheGreat     
It's not lazy dude - you have to leave placeholders for the units, then clip the ones not on top so the one on top shows with the terrain background. You do this because the player can toggle between move and view mode, rotate units to the top of the stack, etc.

What you're looking at is not just a little picture, but a dynamic object with a bunch of flags set for damage, monolith upgraded, movement remaining, special abilities, etc., and since this is a windoze app - you're not really looking at a picture at all, but at a tile that calls a portion of a separate picture file. Since the AI can attack the stack, and you can do things to individual units in the stack, etc. when you bring the whole thing in view, you are not only processing calls to the pic files for each terrain tile and object tile, once the graphics engine has determined what objects are in view, you are also processing calls to get unit attributes from a temp file and load all the specific unit attributes into one or more arrays in RAM. If you didn't do it that way, you'd have to either: (a) leave it all in RAM all the time, so normal humans with normal computers couldn't play the game, or (b) go through the temp file reads and writes each time for each object as it got focus, so the game would crawl to a bleeding halt while your hard drive thrashed itself to death, since you'd end up doing 120 separate temp file reads and writes for your 120 unit stack.

Also - you never program this sh*t to be dependent on runtime events like someone actually picking a unit of bumping it for combat - that's one way to send your whole coding staff to run time error debug hell.

This is further complicated by two points - the relative position changes as you scroll, so the screen is redrawing everything each time you move, and the visibility depends on techs and improvements - such as deep radar flags on the unit tiles, and sensor improvement flags on the terrain tiles.

The probe team issue is a progamming problem/choice, but not really a bug - you first call the object tile, get the pic, then read the attributes from the temp file, and only then determine that the thing should be invisible in fungus - you also have to take into account sensors and other visibility issues to make the visible= on or off determination - normally this processes so fast that the pic tile is never seen - but it has to be there for when your unit might bump into it, so you grab the pic, figure out the unit is invisible, and drop the pic below the terran tile's pic. In your situation, the slow processing makes the pic visible for a brief instant.

You could do it on the flip side, but then the problem would be that all the time, you'd scroll and get this "popping" effect as units suddenly materialized out of nowhere everytime you scrolled - they'd be invisible till the end, as the pic would be called last. That would be a real cheesy graphics problem, and players would hate it -enough to just about kill the game.

Hey DarkStar - wanna start a tbs game studio? "DarkSide Studios" or somethin' of the sort? <evil grin>

Thread ClosedTo close this thread, click here (moderator or admin only).

Post New Topic  Post A Reply
Hop to:

Contact Us | Alpha Centauri Home

Powered by: Ultimate Bulletin Board, Version 5.18
© Madrona Park, Inc., 1998.