Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

abhi2011

Members
  • Posts

    2897
  • Joined

  • Last visited

    Never

Everything posted by abhi2011

  1. > ``` > > For i > ``` > variable not defined :( That is just some code I wrote on the spot for you to work with. Work upon that, improve it and shit. HINT: To solve that particular error declare the variable i.
  2. You could do something like this: ``` for i = 1 to 255 if not fileexists(app.path & "\screenshot" & i & ".png") then Call SaveDirectX8SurfToFile(App.Path & "\screenshot" & i & ".png", Direct3D_Device.GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO), ImageFormats.PNG) saved = true end if next ``` If you want the date to be a part of the file name try something like this: ``` Call SaveDirectX8SurfToFile(App.Path & "\screenshot" & now & ".png", Direct3D_Device.GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO), mageFormats.PNG) ``` That will result in a filename like this: Screenshot 07-05-2015 20:32:17.png I haven't tested out that code so I'm not sure that'll work exactly as it's intended right off the bat.
  3. Wait, you are actually going to make a tutorial on how to make a Pokemon Engine? And I believe, Sherwin has already done this, though I don't think his source code has ever been released.
  4. > On this forum, yes. But there were far more DirectX8 variants of Mirage, albeit mostly broken ones. :o, that I did not know.
  5. It's been a long time since I checked the Custom Engine board, but I'm pretty sure Crystalshire is the only other DX8 engine.
  6. Tell us the error and we'll be able to help.
  7. Nice work. I read through the code but I found that this only rewards the player with the first item. Why not expand on this idea? Like the game maker can decide which item(s) to give, how many of those items to give, check for inventory space before giving the item and stuff.
  8. abhi2011

    DX7 to Dx8

    There is no easy DX7 to DX8 tutorial here. Though, I'm pretty sure copying over the rendering module from a DX8 (like Eo 3.0) do a DX7 engine (like EO 2.0) would mostly. Sure, they'd be a decent number of compile errors, but if you get rid of most of the redundant code and fix the compile errors and such, then I'm supposing it'll work.
  9. The Crystalshire Developers Edition doesn't have the fix for that particular bug. But most other DX8 engines do. Please look into their source code. If you are in need of further help, please do not leave it here, but rather make a new topic in appropriate Forum Board.
  10. The source code for the attached file is here, just in case it's lost during in the future due to forum conversions or some other reason. >! ``` Option Explicit ' This method allows you to convert your Direct3DTexture8 or Direct3DSurface8 texture into an image file Public Enum ImageFormats ' All the image formats supported by GDIp BMP PNG JPEG End Enum Public Function ConvertSurfaceToArray(Surface As Direct3DSurface8, ByRef Pixels() As Byte) As Boolean Dim SurfDesc As D3DSURFACE_DESC, LockedRect As D3DLOCKED_RECT, rc As DxVBLib.RECT Dim TempSurf As Direct3DSurface8 ' This methods converts a Direct3DSurface8 using a format ARGB with 8 bits 'per component into an array of bytes ' You can get the ARGB value in the form of a long by copying 4 bytes (starting from the first) using CopyMemory ' i.e CopyMemory Long, byte(count), 4 ' Each individual component of the ARGB can be extracted directly from the array ' For eg. starting from 0, x = 0 -> A = Arr(x + 3), R = Arr(x + 2), G = Arr(x + 1), B = Arr(x) ' Currently this method only provides support for 32bpp images. Though you can add support for 24bpp or 16bpp or 8bpp. ' Contact me if you want more help with that. Call Surface.GetDesc(SurfDesc) ' Check if it's a format that we can convert to a byte array If SurfDesc.Format = D3DFMT_A8R8G8B8 Or D3DFMT_X8R8G8B8 Then ' Set up the rect so that DX8 knows which parts of the surface we want to copy from With rc ' This will select the entire surface .Left = 0 .Right = SurfDesc.Width .Top = 0 .Bottom = SurfDesc.Height End With If SurfDesc.Pool = D3DPOOL_DEFAULT Then ' If the Texture is in the D3DPool_Default pool then we can't lock the rect ' We have make a copy of the Surface elsewhere before we attemptt lock it Set TempSurf = Direct3D_Device.CreateImageSurface(SurfDesc.Width, SurfDesc.Height, SurfDesc.Format) ' Copy the rect to the TempSurf Call Direct3D_Device.CopyRects(Surface, rc, 1, TempSurf, rc) Else ' If not in the Default pool then just set the TempSurf to the original Surf. Set TempSurf = Surface End If ' Lock the surface to get the pixel data. Call TempSurf.LockRect(LockedRect, ByVal 0, 0) ReDim Pixels((LockedRect.Pitch * SurfDesc.Height) - 1) ' Pitch = Bytes Per Pixel * width If Not DXCopyMemory(Pixels(0), ByVal LockedRect.pBits, LockedRect.Pitch * SurfDesc.Height) = D3D_OK Then ' We weren't able to copy the data ConvertSurfaceToArray = False Exit Function End If ' If you want, you can tweak the Pixels array. To put it back into the DX8 texture copy back into pbits. ' Just reverse the Dest and Source parameters in DXCopyMemory. Make sure UnLockRect is called. Else it the texture won't update Call TempSurf.UnlockRect ' This call is essential. If LockRect is called and this isn't called then it can lead to memory leaks ConvertSurfaceToArray = True End If End Function Public Function ConvertTextureToArray(Texture As Direct3DTexture8, Pixels() As Byte) As Boolean ConvertTextureToArray = ConvertSurfaceToArray(Texture.GetSurfaceLevel(0), Pixels) End Function Public Sub SaveDirectX8SurfToMemory(Data() As Byte, Surf As Direct3DSurface8, Optional ByVal ImageType As ImageFormats = PNG) Dim GDIToken As cGDIpToken, renderer As cGDIpRenderer, Image As cGDIpImage, I As Long Dim PixelFormat As ImageColorFormatConstants, Width As Long, Height As Long, SurfDesc As D3DSURFACE_DESC Dim ImageStride As Long, DataPointer As Long, Pixels() As Byte If Not ConvertSurfaceToArray(Surf, Pixels) Then Exit Sub Call Surf.GetDesc(SurfDesc) Set GDIToken = New cGDIpToken Set renderer = New cGDIpRenderer Set Image = New cGDIpImage Call renderer.AttachTokenClass(GDIToken) I = renderer.CreateHGraphicsFromHWND(frmMain.hWnd) ' afaik the hWnd can be the hWnd of any form in the project If Image.LoadPicture_FromNothing(SurfDesc.Width, SurfDesc.Height, I, GDIToken) Then ' Set up the values for locking the image 'Image.ColorFormat PixelFormat = PixelFormat32bppPARGB Width = Image.Width: Height = Image.Height ' lock the GDIp Image DataPointer = Image.LockImageBits(ImageLockModeWrite, PixelFormat, 0, 0, Width, Height, ImageStride) If DataPointer > 0 Then ' Copy the data that we had in DirectX8 Texture to the GDIp image Call CopyMemory(ByVal DataPointer, Pixels(0), ImageStride * Height) ' Unlock the Gdip image so that the image updates, pass back the values that we used in LockImageBits Call Image.UnLockImageBits(PixelFormat, Width, Height, ImageStride, DataPointer) End If If ImageType = ImageFormats.PNG Then Call Image.SaveAsPNG(Data) ElseIf ImageType = ImageFormats.BMP Then Call Image.SaveAsBMP(Data) ElseIf ImageType = ImageFormats.JPEG Then Call Image.SaveAsJPG(Data) Else Call Image.SaveAsPNG(Data) ' Just save as a PNG End If End If Set Image = Nothing Set renderer = Nothing Set GDIToken = Nothing End Sub Public Sub SaveDirectX8SurfToFile(ByVal Path As String, Surf As Direct3DSurface8, Optional ByVal ImageType As ImageFormats = PNG) Dim Data() As Byte, f As Long ' Convert the texture into a readable file Call SaveDirectX8SurfToMemory(Data, Surf, ImageType) ' Dump the data we got into the file at the path If FileExist(Path, True) Then Kill Path f = FreeFile Open Path For Binary As #f Put #f, , Data Close #f ' The file should now be a valid image End Sub Public Sub SaveDirectX8TextureToMemory(Data() As Byte, Texture As Direct3DTexture8, Optional ByVal ImageType As ImageFormats = ImageFormats.PNG) Call SaveDirectX8SurfToMemory(Data, Texture.GetSurfaceLevel(0), ImageType) End Sub >! Public Sub SaveDirectX8TextureToFile(ByVal Path As String, Texture As Direct3DTexture8, Optional ByVal ImageType As ImageFormats = ImageFormats.PNG) Call SaveDirectX8SurfToFile(Path, Texture.GetSurfaceLevel(0), ImageType) End Sub >! ```
  11. Hey guys, With the new DirectX8 engines, one of the functionalties that were lost from the DX7 engines was the inability to screenshot the map and/or the client screen. This meant that mappers couldn't showcase their awesome mapping talent and admins couldn't create screenshots of their games directly from the engine and has to resort to other tactics. Well, this tutorial solves that problem. You can now create as many screenshots as you possibly want. Attached to this post/topic is a module called "modAdvDX8Tex.bas", this module contains all the functions necssary to convert the game screen into a valid PNG, BMP or JPEG file. I've made sure to comment and document as much of the code as possible so that people can learn from it if they so desire. The actual module has been written for Eclipse Worlds, but it'll work with any and all DX8 engines. All that has to be changes is the usage of said module **WARNING: THIS TUTORIAL ASSUMES THAT YOU HAVE APPLIED [THIS](http://www.eclipseorigins.com/index.php?/topic/136966-bug-gdip-bug-in-dx8-engines/) BUG FIX.** **Steps to add in the module to your ****project:** 1. Put the module in the client src folder and open up your client project file. 2. Press Ctrl+D or go to Project -> Add file. Here are a few source tutorials on how to actually use the module: >! **Taking a screenshot of the game viewport:** Find the method **Render_Graphics** in your rendering/graphics module At the end of the method, ust after the call to the **Direct3D_Device.Present, **add this line of code: ``` Call SaveDirectX8SurfToFile(App.Path & "\screenshot.png", Direct3D_Device.GetBackBuffer(0, D3DBACKBUFFER_TYPE_MONO), ImageFormats.PNG) ``` **Taking a screenshot of the entire map: ** –coming soon-- The provided module does not have any error handling functions. Error handling should be added in by you based upon the engine you are using. Regards, Abhi2011
  12. No, that's a totally reason. And most engines already handle that problem. Which engine are you using?
  13. Hey guys, So going through the entire code and more specifically through the GDIp code, I found a weird bug that JC left in with the original working DX8 engine. Almost every DX8 engine on this forum was based on JC's EO 3.0 and hence has this bug. I believe that this should be fixed. Even though it doesn't cause anything to crash and is pretty much harmless, it's still a coding mistake. **I urge all those who have created a DX8 engine and all those who are making a game in a DX8 engine to please fix this. ** In **cGDIPImage** find the method, **LoadPicture_FromNothing** Change ``` hImage = pvCreateSourcelessImage2(hImage, Width, Height, 1&, TokenClass, graphics) ``` to ``` hImage = pvCreateSourcelessImage2(hImage, Width, Height, 0&, TokenClass, graphics) ``` Find **LoadTexture**. It'll most probably be in the Rendering module of your engine. Change this: ``` Call ConvertedBitmap.LoadPicture_FromNothing(newHeight, newWidth, I, GDIToken) 'I HAVE NO IDEA why this is backwards but it works. ``` To this: ``` Call ConvertedBitmap.LoadPicture_FromNothing(newWidth, newHeight, I, GDIToken) 'This is no longer backwards and it now works. ``` Make sure this is done for every call of **LoadPicture_FromNothing **i.e swap the first two parameters that correspond to the width and height of the Image. So, what's this bug all about? Well, LoadPicture_FromNothing is a method that JC created in the original cGDIpClass so that textures that don't have dimensions in the powers of two can be converted. He basically wanted to load up the original png file, make a new image with the dimensions which is a power of two closest to the original png. But, there was no method for creating an image from nothing. But when he actually wrote the code for it, he set up parameter wrong in the method. Originally it was **1& **but now, it's been changed to **0&**. That parameter is a flag for flipping the image i.e it swaps the width and height of the image. Now, is this fix an absolute necessary for your game to run smoothly without any crashes? Probably not. I haven't heard of any bugs caused due to this method. But, should you fix it? Absolutely. Mainly because it's a coding mistake that should be fixed. If you have any questions about this bug fix or would like to learn more about this then shoot me a PM and I'll be glad to help. Regards, Abhi2011
  14. That's a false positive. The EO engine doesn't have any viruses.
  15. If you're using a dx7 engine, then that means you're using an engine that doesn't have a rendered gui, which means that the background will always be black or some other colour. The reason for this is that the actual inventory is rendered onto a Picture Box which doesn't support transparency. If you know how DX7 works, then you can render the gui onto screen and use a ColorKey/Mask to mimck transparency.
  16. I heard that the lottery is rigged. don't tell anyone
  17. All the best for that. Since your problem has been solved, please edit the main post and set the topic tag as **Solved**.
  18. > That feature doesn't come until next year. I'm make sure to bump up this topic in around 6 months to enquire about the download. You better have it ready by then!! :angry:
  19. > **Download** > > ![](http://i.imgur.com/xPNbDn7.png) I know it's April Fools day but where's the download?
  20. The best way to prevent that is to encrypt the data files. Other way would be to make the data files folder a hidden folder, this would mean that the folder wouldn't normally be seen in Windows Explorer. But keep in mind if the person who is playing the game has hidden folders by default as visible then they can see your data files folder.
  21. From what I understand you converted tilesets from PNG to BMP. In BMP tilesets for the DX7 engines, the colour of the first pixel has to be the transparent colour. In this case the background of the tiles.
  22. If you have the time then go for it. If there's any mistakes in the code or if there is a better way to do stuff than the way you've done it, then the community will be able to help. It'll also help you learn new stuff that you never knew existed.
  23. I'm guessing that your problem has been solved. Please mark the topic as solved.
  24. Server.vbp is found inside the server folder, same place where Server.exe is found. You need VB6 to open the .vbp file.
×
×
  • Create New...