Smirnoff Ice is more my kinda scene to be honest :)
Printable View
Smirnoff Ice is more my kinda scene to be honest :)
ok,
This probably is a good way of trapping whatever what's wrong...
here you go, a screenshot from just before the crash.
May i note, it was the second time i saw it, at loading buildings.
So, the problem is not at the first time that msg is displayed.
Icheb
I had a feeling that was going to happen.
why ?Quote:
Originally posted by plenderj
I had a feeling that was going to happen.
Well from what we can tell, the CreateDC() and DeleteDC() functions arent working 100%.
We've both been testing them independently of eachother, and there are issues with both. Namely the fact that CreateDC() can be an abusive ****er, and DeleteDC() does not release the memory that was being used by the DC.
We're still working hard on it though.
This was the second time you saw it?
So you saw it once, followed by a tribe of other msgboxes - one of which saying that if you saw him then the problem was not with DCs?
And then this one popped up again?
Definately?
Madness, utter madness!
If it's crashing there, then that means it will have called at least one deleteDC, which is the little bugger that's causing the problem.
Also Plend,
You know that code you mailed to me yesterday, could you mail it to [email protected] please?
I'm at home today and I can compare it to the code in Sentience and see if there's any differences at all.
Sent.
Thanks Plend, you're a hero!
I'll start comparing the two in a second when I get your mail.
Icheb,
I've uploaded a new version just for you - Icheb.zip which creates the DC slightly differently.
It may or may not work but could you give it a try please?
Ta muchly!
Ok, 2 things
1. CONGRATS, the bug at loading buildings is solved
2. Sorry to report another out of mem at the end, at 'launching game'....
I hope you can solve it the same way !!
Conventional Memory is not used by windows programs.
I just tried it, pretty nice.
Though after I started the game and resigned, it simply got into an infinite loop of running the computer players, and then jammed up on turn 28. (I had 2 computer players).
Btw, you might want to add an option for NOT changing the screen resolution, because it didn't change back when i exited.
If you want to use sound without DirectX you could use FMod (www.fmod.com) - I wrote a typelib for it which makes it easier to use, if you think it might be worth it. I like it a lot better than directsound.
Mind pointing me in the direction of the latest files? All I have is GameDev.zip.
Oh, and by the way, try changing the name of the folder and file. I already have GameDev (Scrolling Game Development Kit) on my system. ^_^
Icheb,
Whooo hooo! Now all I need to do is find out why it's stopping at launching game. I'll post again in about 15 mins after I've cooked something up!
Janus,
Yep, Plend has educated me on the complexities of conventional memory. I'm a dinosaur and I was still living in the past... :rolleyes:
The latest files can be downloaded by following the link in my signature and downloading the update.zip. Extract the files and copy them over the top of the gamedev directory.
You may also rename the gamedev directory to anything you like or move it wherever you please, Sentience will find it's files as long as the directory structure is intact.
I'm great at finding those kind of bugs, you'd be suprised how many of them my older game projects had. If you want any help, let me know ^_^
Mind checking out my graphics library and samples? I need comments.
You're using piles of offscreen DC's, eh? I should check out your DC count in the task manager :)
I've uploaded a new icheb.zip.
This again will bombard you with msgboxes, so tell me the last one you see please...
Ta!
Janus,
What graphics lib and samples and what DC count in what task manager?
Ouch... more GDI usage than explorer >_< And quite a few pagefaults to boot. You might want to consolidate your images onto fewer DCs, each DC uses up a large amount of system memory. That can cause out of memory errors - DC's using up all your memory.
Mint!
So what should I use instead of DC's?
I'm a bit biased, but my graphics engine has it's own offscreen surfaces ^_^ But they're 32-bit so they take up a bit of space.
You could try consolidating the DC's, I see that each tile is it's own bitmap. Try loading them all and merging them into one big DC. If you are interested in using my graphics engine, let me know. It doesn't have the raw speed of DirectDraw or GDI, but it's close, and the special effects and buffering are extremely fast. :)
If you want to contact me, use my ICQ (130863581), AIM (FuryJanus, Shinja Samurai), or e-mail ([email protected]).
I won't be able to check these boards very often :)
I'm always looking for new projects to get involved in.
Janus,
Thanks for the offer.
Icheb,
Let me know how you get on with the new icheb.zip once you've had a test.
Ta muchly!
Icheb,
I've revised the code (yet again) and posted what I hope to be the final thing.
I don't think I can streamline it anymore than this without rewriting the whole engine so as not to use DC's.
Let me know how it goes.... :)
maybe this sounds quite stupid, but i thonk you upped it to icheb.zip, correct ?
If so, i dll'ed it and tested it, the error is still there, still at launching game...
No, no, no, no!
Oh well.
I've uploaded yet another with msgboxes, let me know which is the last one you see before the error....
Thanks!
I'll test all day, but only if you tell me what to download on that page. ;-)
Slider Blackrose
"That which does not kill me, has made it's last mistake"
u d/l the gamedev.....and the look could be a little better.....looks great man.....thats the oly thing i saw :)
Abiter : i got something special for you, a screenshot of the last msgbox...
Here u go :
:)
Theres nothing wrong with creating many DCs.
Especially on a system with a lot of memory.
Arbiter, here's an example of our problem :
VB Code:
Option Explicit Private Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long Private Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long Private Declare Sub GlobalMemoryStatus Lib "kernel32" (lpBuffer As MEMORYSTATUS) Private Type MEMORYSTATUS dwLength As Long dwMemoryLoad As Long dwTotalPhys As Long dwAvailPhys As Long dwTotalPageFile As Long dwAvailPageFile As Long dwTotalVirtual As Long dwAvailVirtual As Long End Type Private Function GenerateDC(FileName As String) As Long Dim DC As Long, picTemp As IPictureDisp DC = CreateCompatibleDC(0) If DC < 1 Then Exit Function End If Set picTemp = LoadPicture(FileName) SelectObject DC, picTemp DeleteObject picTemp Set picTemp = Nothing GenerateDC = DC End Function Private Sub Form_Load() Dim i As Long, x As MEMORYSTATUS For i = 0 To 250 GlobalMemoryStatus x Debug.Print i & " : " & (x.dwAvailPhys / 1024) & "Kb : " & IIf(DeleteDC(GenerateDC("c:\boilogo.gif")) <> 0, "DeleteDC() Worked", "DeleteDC() Failed") Next i i = x.dwAvailPhys Do DoEvents GlobalMemoryStatus x If x.dwAvailPhys > i Then Debug.Print "Have recovered some used memory ... " & x.dwAvailPhys i = x.dwAvailPhys End If DoEvents Loop End Sub
It should create+delete 250 DCs.
Each time it creates one, it immediately deletes it.
But the memory usage doesnt go down.
So thats where the problem is I believe.
Well,
I don't know about those memory DC's but I say we build up loads of artillery and beat the bastards into the ground, screaming DANGER WILL ROBINSON followed by a quick OH, the pain, THE PAIN and finally Welcome to the Rock as we steal a crutch from a one legged bouncer and use it to propel the nearest ****head towards Mars!
Get in!
*ahem* sorry.
Ah... Icheb,
That's great, the next line is merely setting one picture value to another (basically copying the background onto another form). What I'm going to do now is write a dual engine that can handle both DC's and not. You'll toggle them on and off in the options.ini. Not using DC's may result in degraded performance, but at least it might work...
Give me a couple of hours to write a whole new engine and I'll repost when it's done.
Plend,
This confirms what we were discussing. MicroSoft are CR*P!
SBlackrose,
You dl the gamedev.zip and the update.zip. Extract gamedev and then extract the contents of update over the top, overwriting where necessary. That will give you latest version of the game.
Let me know what you think please!
Motoxpro,
Got any comments as to how the game could be improved?
We must be missing something simple.
I'll see if I can find a way of getting back the memory
Righty ho.
I've uploaded another version (nondc.zip) where you have the option of using memory DC's or not.
In the zip is the ubiquitous sentience.exe and also a new options.ini. This options.ini must be copied into the scripts directory (overwriting the old one).
When you run sentience, a msgbox will appear telling you whether memDC's are enabled or not.
If this doesn't appear, you've either got the wrong Sentience.exe or not copied in the new options.ini.
You can toggle memDC's on and off by editing the options.ini in a text editor.
This HAS to work as it uses techniques so revolutionary, so groundbreaking, so sophisticated that it cannot go wrong!
Plend,
If you could run it under both engines and just ensure they both work on your machine please. Thanks again for your help in this!
Sentience is now missing walls.bmp ...?
Ahum...Quote:
Originally posted by Arbiter
This HAS to work as it uses techniques so revolutionary, so groundbreaking, so sophisticated that it cannot go wrong!
I tried it with and without memdc's...
The result is :
Both things DO NOT work :(
Keep getting a out of mem error, i really hate this error, i want to play the game now :rolleyes:
But i'll keep testing till the game is finished...:D
Icheb,
Sorry matey but I'm buggered if I know what the answer is.
When it's ran without memDC's it uses pictureboxes to store the images.
I don't think there's anything else I can do. It must be something with your machine.
As I've said, I've ran it on a P133 with 16mb of ram and a wanky graphics card and it plays.
I really am out of ideas now.
You're not running anything else in the background are you? I know I've asked this, but I get out of mem's if I'm running 2 copies of the VBIDE, MS Outlook and IE and then try running Sentience....
All I can do is spend some time trying to streamline the memory usage and then post another version tomorrow morning.
I was so convinced it would work without memDC's.
If it's any consolation, you've made it into the credits.... :)
Plend,
Walls.bmp is in the update.zip
Well its not in mine
:) :cool: :cool: :cool: :)
Arbiter :
You sound a bit, how do i say, hopeless...
I'm going to try running it on a old 486 (16 mb ram) and a P100 (32 mb ram) sunday...
I've got another idea...
If you can email/pm or whatever me the code from the loading form (don't need the rest of the prog i think), then i'll run it line by line to see if i can detect what's wrong with it...
(this is my last idea...)
Now i must admit, i know absolutely nothing about dc's, but i know how to run code through vb, so i think it's possible to debug it by running it line by line on a comp that has problems with it.
plenderj : what do you think ? Can it work ?
Icheb,
Thanks for the offer, but I don't give out any of the code to Sentience.
Besides, there are thousands of lines of code in (or called by) the splash screen so you'd die of old age before you'd gone through them all.
Also, you know when I produced the msgbox versions? They were doing the same thing.
Guru Kedaman has pointed me in the direction of createcompatiblebitmap, as he pointed out that picturebox controls also have associated dc's, so I'm going to experiment with that.
Have fun running it on those old machines. I've never tried it on a 486, let me know how that goes - bear in mind you need DX7 or above to run the sound. If the machine doesn't have that, then turn all the sounds (sounds, music, voices) off in the option.ini.
I'll get back to you shortly with another version.
The memory for a DC is not immediately deallocated when deleted.
If you point me in the direction of the right files, I can run it and watch the DC count in the WinXP task manager...
Anyway, not using DCs might be faster :P You'd be suprised. DirectDraw is tons faster.
Right,
I've uploaded yet another version (usedc.zip) which is my best shot yet. I spent about 2 hours on MSN talking to Kedaman and he's shown a 'better' way of using memDC's. I've now implemented this into a section of the code which should free up a bog load of memory.
If this works, I'll owe Kedaman a pint or two. If it doesn't - I'll kick his arse!
Icheb,
New version uploaded is usedc.zip. DC's should be enabled when this version is run and it should save some memory. If the msgbox doesn't state 'memDC's: True' on startup then it's not using the updated routines.
Let me know how it goes please, this is the best version yet!!!
Janus,
DirectDraw would be tons faster, but when I started this I couldn't even spell it. At this stage, I have no intention of rewriting the engine to support DD.
Well, I have to tell you this...
DirectDraw is a PAIN IN THE um... ARSE!
:)
I tried usedc.zip, and it seems to work well... but aren't there supposed to be map tiles below the buildings?
Janus,
There are indeed. However, you can get away with running the game without using DC's as you're running NT or XP or whichever.
From my own reading, the techniques outlined by Ked will not work on NT/XP (not sure about ME), but I'm using them to correct problems which have so far only occurred on 95/98 ('cos they're crap with memory).
If you can run it without DC's then feel free to do so. Use whichever engine works best for you...
Wow, 2 pages in 2 days :p
Arb, I don't really need to read all that to catch on or something, right? ;)
Ben try something along these lines
VB Code:
Private Function GenerateDC2(FileName As String) As MemoryDCType Dim DC As Long, picTemp As IPictureDisp, retVal As MemoryDCType DC = CreateCompatibleDC(0) If DC < 1 Then Exit Function End If Set picTemp = LoadPicture(FileName) With retVal .width = Me.ScaleX(picTemp.width) .height = Me.ScaleY(picTemp.height) .hDc = DC End With CreateCompatibleBitmap DC, Me.ScaleX(picTemp.width), Me.ScaleY(picTemp.height) Set picTemp = Nothing GenerateDC2 = retVal End Function
Ive found that the first few DCs one creates are fine, but then memory gets gobbled up nearly exponentially after that.
So why not bundle a few pictures all together and create a few large DCs instead ?
Jotaf,
Only if you really want to. :)
Plend,
If Icheb gets back to me and says that the latest upload doesn't work then I'll try this.
Do you want me to post you a Smirnoff Ice or just wait 'til you come to Blighty for a knees up?
Stick one in the post just in case ;)
Hi Arb (if you don't mind me calling you Arb)Quote:
Originally posted by Arbiter
Jotaf,
Only if you really want to. :)
Plend,
If Icheb gets back to me and says that the latest upload doesn't work then I'll try this.
Do you want me to post you a Smirnoff Ice or just wait 'til you come to Blighty for a knees up?
Let me get back to you...
I suggest you start trying Plend's new idea, I'm sorry to say but the update you made still gives the error, i've been trying to edit the ini's to exclude a few features when loading but that isn't very succesfull eighter :(
I've posted him a new method of creating device contexts that fox was so kind to point out to me.
That should work.
i hope so...
Plend,
The new way is no different to the way Sentience creates them already - check the code I sent you.
Even using the methods that Kedaman has outlined (which only requires one DC) Icheb's still getting out of memory errors.
I'm going to have to try and streamline the way graphics are dealt with. That should be fun.
Before that, however, I'm going to get drunk. Very drunk.
All,
You might not hear from me for the next couple of days as I've just moved into a brand new house and BT have not yet installed a phone line to the property.
You'll hear from me on Monday morning at the latest when I get in work. Be sure that I'll be working on this problem.
Well, ok, if you need help or think you're ready for me to give you some more ideas, gimme a buzz ;)
Morning people.
Well, I've moved into my new house now and I've set my machine up.
I really haven't the foggiest what I'm going to do to streamline the code.
I'll do some research today and try and get some work done on it this evening (amongst other things, like inflating my furniture etc) and with any luck I'll be able to upload something tomorrow.
Errr, scratch that - I can't access FTP sites at work.
Hummm.... how can I upload patches for all to play with then?
I'll have to eMail them to interested parties.
Ok, please eMail me from the account you want me to send the updates to if you wish to receive them.
*bump*
sorry, just wanted to see 3 games that wants comments on them with my name as the last poster ...:)
When you've quite finished masturbating....
Arb, you should be ashamed of yourself! :)
Jamie would NEVER do that with this thread open :D
(Probably because he has other more inportant pages to open instead)
LOL
LOL
LOL
LOL
LOL
ect.