PDA

View Full Version : DrawAlpha Turns Things Green



andrew2110
25-08-2006, 03:56 PM
Hello everyone! Im having another problem with my side scrolling game, I feel yet again that there is possibly a fairly simple solution to it but I have looked through all the tutorials and examples I could find and still havent found a solution so thought I'd ask for help...

My problem is that when I call any of drawAlpha, DrawAdd, DrawSub or any kind of Draw function thats not just plain Draw, It turns things green

For example, this screenshot was taken when the player goes through a portal, the screen is supposed to fade to black. The line of code which is supposed to do this is:

Draw.Surface.FillRectAlpha(Bounds(0,0,800,600),ClB lack,FadeLevel);

Where fade level goes from 0 to 250...

http://www.cash-inn.co.uk/Green.png

Does anyone have any idea why this happens?

Thanks in advance!

DraculaLin
25-08-2006, 04:33 PM
Try this version of (Un)DelphiX.
http://www.micrel.cz/Dx/

P.S.
Wow...You are making a MapleStory-like game.
I also do that.Make my own version of MapleStory. :D

andrew2110
25-08-2006, 04:43 PM
hehe, the idea is maple story crossed with pokemon as a MMORPG, worried about getting sued by both of them! Will try out that version of undelphiX, Thanks very much!

WILL
25-08-2006, 07:48 PM
Could it be that your pixel format and fade function are using the different ARGB or RGBA or BGRA or ABGR combinations?

Speeeder
26-08-2006, 10:48 AM
DelphiX uses $BBGGRR colour format most of the places, add your colours like that.

Upload your compiled game to for example www.yousendit.com (enter a fake e-mail, copy in the address it gives you after it's up) and let us see.

Btw, you should use DXDraw.Surface.ClientRect (or way is only in the canvas property? Whatever :P) to get the rect of the client area, it's more versatile ^^

If nothing else works, I'd debug into the code of the FillRectAlpha drawing and look at what it does in class D2D, but as far as I know UnDelphiX 1.07 is very close to bugless...

andrew2110
26-08-2006, 11:33 AM
I would love to upload my game so people can try it out for me but from the start of it I have been implementing it as a MMORPG and as yet, I havent worked out how to run the server on any other IP address other than its LAN address so the game would just die straight away :( However as soon as I work out how to get my IndyTCPServer component to run on an external IP address I'll upload the game for all to see!

I moved to using UnDelphiX 1.07, and it now works in that things fade to black. However when it is fading out or in FPS goes down to 5 or 6 per second which is a bit too slow. I'm guessing this is because its being drawn over the whole screen and I suppose that D3D or OpenGl are better used for doing transparency effects (Correct me if im wrong, I've only been games programming for a couple of weeks!)

Thanks for all your help so far!

O and thanks for the tip regarding using DXDraw.Surface.ClientRect, that does seem like a much better way of doing things :)

Speeeder
26-08-2006, 11:44 PM
errr... Notice the "X" in the name... UnDelphiX is a DirectDraw and Direct3D library... So if the framerate goes down, you didn't turn the 3D acceleration on properly.

You need to set doDirectX7Mode, do3D, doHardware, doFlip (flip makes fullscreen mode a bit faster) all on to make the video card accelerate your game.

As for your game, you can just upload your server as well, and make the game connect to 127.0.0.1 (localhost in other words :P) by default... Or maybe it could read the target IP address from a simple ini file or whatever. :) (You should use DirectPlay for a game's network code, shouldn't you? :P)

andrew2110
27-08-2006, 02:00 PM
Oops! I've turned on 3D Acceleration properly and now it runs at around 270FPS pretty consistantly so thanks! I have just started making the battle engine for the game, in around a week or two I should have something to upload and show everyone what they have been helping with! I'll post it in the 'Your Projects' part of the forum.

As for using DirectPlay, I tried using that a few years ago for a game and just found it to be a bit annoying. Is there any good reason that I should not be using Indy Components on the Client?

Thanks again!

Speeeder
27-08-2006, 02:08 PM
Nope, I don't know of any reason for it.
Grats for your FPS, and as for the your projects part of the forums, I'm not reading it, so whatever :P