Mirage Source
http://web.miragesource.net/forums/

Optimized Surfaces
http://web.miragesource.net/forums/viewtopic.php?f=210&t=696
Page 3 of 4

Author:  frozengod [ Wed Sep 26, 2007 6:53 pm ]
Post subject:  Re: Optimized Surfaces

also i found this in big reds edit. he didnt remove the fps cap ??? but yet it still runs at 49 + fps ?

' Lock fps
Do While GetTickCount < Tick + 20
DoEvents
Loop

thats from his source

Author:  William [ Wed Sep 26, 2007 7:07 pm ]
Post subject:  Re: Optimized Surfaces

It doesn't matter how you tweak those numbers in the cap, removing it should set your fps to around 500-1000.

If nothing happens when you remove that cap, then the fault is not the cap. The fault is that you must be running a unbelievable big gameloop and doing a tremendous amount of things in it. I dont know what kind of things es has in its gameloop, but I doubt they messed it up that big.

So I'd bet you have done something wrong when trying to add this, post all your code and hope for someone to take the time and read it.

Author:  frozengod [ Wed Sep 26, 2007 7:14 pm ]
Post subject:  Re: Optimized Surfaces

Moved this to a help topic.

Author:  Matt [ Wed Sep 26, 2007 7:20 pm ]
Post subject:  Re: Optimized Surfaces

I got an idea.

Don't use ES.

Author:  Robin [ Wed Sep 26, 2007 7:21 pm ]
Post subject:  Re: Optimized Surfaces

Worst thing in that?

Visual Inventory xD

Author:  William [ Wed Sep 26, 2007 7:21 pm ]
Post subject:  Re: Optimized Surfaces

OMG, what did you just do????? xD

Make a new topic for this in the help board. And for god sake use the CODE tag and not the quote tag. And hell, I will never ever read that code without indents..

Edit:
Code:
 If Val(GetVar(App.Path & "\Main\Config\config.ini", "CONFIG", "SpeechBubbles")) = 1 Then


They are using a getvar in the gameloop, use a variable es Please!

ps. I cant even find the visual inventory in all of that code..

Author:  Robin [ Wed Sep 26, 2007 7:22 pm ]
Post subject:  Re: Optimized Surfaces

Use spoiler tags too :|

Author:  frozengod [ Wed Sep 26, 2007 7:22 pm ]
Post subject:  Re: Optimized Surfaces

well, this is ES version 1, and ive been working on my personal project for 2-3 years now and its got so much i dont want to have to redo, id rather redo the game loop than sacrifice my work =/, trust me im wanting to kick myself for starting over there rather than here :P
sorry ill move that to the help section :P
erm this blows lol

Author:  William [ Wed Sep 26, 2007 7:24 pm ]
Post subject:  Re: Optimized Surfaces

I don't have anything more to say really.

Author:  Robin [ Wed Sep 26, 2007 7:25 pm ]
Post subject:  Re: Optimized Surfaces

I did warn you xD

Author:  Matt [ Wed Nov 07, 2007 7:50 pm ]
Post subject:  Re: Optimized Surfaces

Anyone have a copy of the source code he had uploaded? Both links are dead..

Author:  Anthony [ Sun Feb 03, 2008 6:12 pm ]
Post subject:  Re: Optimized Surfaces

I know this is a pretty dead topic, but whatever haha.

I have been messing with this tutorial on and off for a few weeks and finally decided to attempt to get some help. I am using a vanilla MSE and only have tried to add this in. This is what I got.

I have added in the new variables like BigRed said to do, as well as initializing the surfaces and setting the color keys. This is my BltMap sub.

Code:
Dim Ground As Long
Dim Anim1 As Long
Dim Fringe As Long
Dim x As Byte
Dim y As Byte

    With rec
        .top = 0
        .Bottom = ((MAX_MAPX + 1) * PIC_X)
        .Left = 0
        .Right = ((MAX_MAPY + 1) * PIC_Y)
    End With
   
    DD_LowerBuffer.BltColorFill rec, RGB(0, 0, 0)
    DD_UpperBuffer.BltColorFill rec, RGB(0, 0, 0)

    For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX

            With Map.Tile(x, y)
                Ground = .Ground
                Anim1 = .Mask
                Fringe = .Fringe
            End With
           
            ' Ground
            With rec
                .top = Int(Ground / 7) * PIC_Y
                .Bottom = .top + PIC_Y
                .Left = (Ground - Int(Ground / 7) * 7) * PIC_X
                .Right = .Left + PIC_X
            End With
            Call DD_LowerBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT)
           
            ' Mask
            With rec
                 .top = Int(Anim1 / 7) * PIC_Y
                 .Bottom = .top + PIC_Y
                 .Left = (Anim1 - Int(Anim1 / 7) * 7) * PIC_X
                 .Right = .Left + PIC_X
            End With
            Call DD_LowerBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)

            ' Fringe
            If Fringe > 0 Then
                With rec
                    .top = Int(Fringe / 7) * PIC_Y
                    .Bottom = .top + PIC_Y
                    .Left = (Fringe - Int(Fringe / 7) * 7) * PIC_X
                    .Right = .Left + PIC_X
                End With
                Call DD_UpperBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
           
        Next x
    Next y


I believe this is correct, I have removed the animation part of it to be replaced with this:

Code:
Sub BltAnimation()
Dim Anim As Long
Dim x As Byte
Dim y As Byte

For y = 0 To MAX_MAPY
        For x = 0 To MAX_MAPX
       
            Anim = Map.Tile(x, y).Anim
           
            If Anim > 0 Then
                With rec
                    .top = Int(Anim / 7) * PIC_Y
                    .Bottom = .top + PIC_Y
                    .Left = (Anim - Int(Anim / 7) * 7) * PIC_X
                    .Right = .Left + PIC_X
                End With
                Call DD_LowerBuffer.BltFast(x * PIC_X, y * PIC_Y, DD_TileSurf, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
            End If
           
        Next x
    Next y
End Sub


The other Subs like BltItem, Npc and Player have only been changed from BackBuffer to MiddleBuffer. Umm, in my GameLoop I have this:

Code:
        ' Clear the back and middle buffers
        DD_BackBuffer.BltColorFill rec, RGB(0, 0, 0)
        DD_MiddleBuffer.BltColorFill rec, RGB(0, 0, 0)


Which is right under the End If for the Clear Surfaces check. Then I have this:

Code:
' Draw all buffers to the back buffer
        With rec
            .top = 0
            .Bottom = ((MAX_MAPX + 1) * PIC_X)
            .Left = 0
            .Right = ((MAX_MAPY + 1) * PIC_Y)
        End With
   
        Call DD_BackBuffer.BltFast(0, 0, DD_LowerBuffer, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        Call DD_BackBuffer.BltFast(0, 0, DD_MiddleBuffer, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)
        Call DD_BackBuffer.BltFast(0, 0, DD_UpperBuffer, rec, DDBLTFAST_WAIT Or DDBLTFAST_SRCCOLORKEY)


Right before the back buffer is locked for the text to be drawn. I guess thats all. The Call BltMap is right after the GettingMap boolean in "mapdone" packet and I have added them to the EditorMouseDown and Cancel subs too however the tiles, items, npcs and players are all not being shown and there is no trailing on the map and no errors :P. Oh, also I did move the InitDirectX. I cannot seem to figure out where I went wrong and hope somebody can help me :D. Thanks a lot!

Author:  Anthony [ Mon Feb 04, 2008 11:49 pm ]
Post subject:  Re: Optimized Surfaces

I know how everyone around he reacts to impatience and stuff but there has been 20 more views on the topic and no replies :(. Sorry for double posting..

I have tried more to figure this out but can't get it. I have read the tutorial a few times over. I know there is one person who can help me out.. Robin :lol:.

Author:  Robin [ Tue Feb 05, 2008 4:37 pm ]
Post subject:  Re: Optimized Surfaces

Why is it that when people don't get a reply they always post my name?

What am I? Some sort of public property? Am I here to perform for you? Do you want me to perform!?

Author:  Anthony [ Tue Feb 05, 2008 7:46 pm ]
Post subject:  Re: Optimized Surfaces

Robin wrote:
Why is it that when people don't get a reply they always post my name?

What am I? Some sort of public property? Am I here to perform for you? Do you want me to perform!?


Haha, not really. I just know you have added this to Winds Whisper, and as far as I know, your the only one who has had it working properly.

Author:  Rezeyu [ Tue Feb 05, 2008 8:32 pm ]
Post subject:  Re: Optimized Surfaces

DFA got it working.. and he told me the trick to it, something needed to be changed.. or re-ordered or soemthing.


BUT, I forget, I can message him later maybe if I remember.

Author:  Becoming [ Tue Feb 05, 2008 10:05 pm ]
Post subject:  Re: Optimized Surfaces

this tutorial is to easy, i dont see why you people have so much trouble with it ;)
i could add it to a blank mirage in 10 mins :P

Author:  Rezeyu [ Tue Feb 05, 2008 10:29 pm ]
Post subject:  Re: Optimized Surfaces

Because as is, it doesn't work.

There's something that needs to be changed.
If you take whats here right now, and add it to a vanilla MSE, it'll display incorrectly.

Author:  Robin [ Tue Feb 05, 2008 11:08 pm ]
Post subject:  Re: Optimized Surfaces

I'm sure that's not the case, as I've managed to do it every time I needed it without adding anything.

Author:  Anthony [ Wed Feb 06, 2008 12:20 am ]
Post subject:  Re: Optimized Surfaces

Alright, well I will take a look at it when I get home. I have DFA on messenger so I will maybe talk to him about it too. Thanks for the replies. I will look over the tutorial again, too.

Author:  Mozza [ Tue Mar 25, 2008 11:22 pm ]
Post subject:  Re: Optimized Surfaces

This toturial is fine, apart from the map animation. If the map animation stay in the lower and upper buffer, they will not work as you would have to clear the upper & lower buffer every animation frame. If you use the Middle buffer they will work, but you will be able to walk over the fringe animation tiles. If you clear the upper & lower buffer every frame the map will dissapear as you will clear the map. Thats the only problem i can see with this tut.

POST EDIT
Sorry, i've just realised Mirage don't have Fringe animation layers. Sorry don't listen to me i don't know what i'm talking about.

Author:  Joost [ Wed Mar 26, 2008 8:08 am ]
Post subject:  Re: Optimized Surfaces

Tut works fine. I made 2 surfaces, one for ground/mask and one for fringe. Everything in between still is regular. I prefer it that way.

Author:  Robin [ Wed Mar 26, 2008 12:11 pm ]
Post subject:  Re: Optimized Surfaces

Mozza wrote:
This toturial is fine, apart from the map animation. If the map animation stay in the lower and upper buffer, they will not work as you would have to clear the upper & lower buffer every animation frame. If you use the Middle buffer they will work, but you will be able to walk over the fringe animation tiles. If you clear the upper & lower buffer every frame the map will dissapear as you will clear the map. Thats the only problem i can see with this tut.

POST EDIT
Sorry, i've just realised Mirage don't have Fringe animation layers. Sorry don't listen to me i don't know what i'm talking about.


You still have difficulty understanding buffers don't you.

The 'layering' effect is still there. If you render the Fringe Animation tiles after the player, even if you render them to the Middle Buffer, it will still appear above the player on the game screen.

Author:  wanai [ Tue Nov 02, 2021 8:18 am ]
Post subject:  Re: Optimized Surfaces

Econ216.3BettCHAPMamaWindJeweXVIILoveRafaRabiBestAtlaOmsaBobbalceTescFiskMikaHousGlenOlivChes
JuliHomeDeadExotthirFreeSexySheiSereNiveEugeBoucHereGarnDoctPresRichMavaBookHenrHaveXVIIChar
SpacLiliBaixSunnCotoAmarWoolDigiPockmicrPradStanNeviXVIIHeinPaulmailCircChroYorkMccrPrinWorl
ArktUnreJaanHoMMScooAngeClicenriVondJuliAdelMenuAlexZoneFuxiWildGeorCheoZoneZoneRescLudwZone
diamZonediamFireHumaZoneKiddLadiZoneXVIIZoneZoneZoneZoneZoneJohnSympMercNasoStilZoneMarcXVII
ZoneBrucMadePoweElecKronLiebKatsBookCHARBontVasiTexaJeweFiesLastWoodCaseProlARAGENSVDICOtrac
CleaEducEducRaisDodgMegaMimiBritWindDorlDanaConnWinxJohnFresCultDaviAmerADupLadyJameJeweAudi
LukiSagaCharXVIIXVIIAcadsomeAeroRainMartLiyaBestRobeWhitRollBarbVasiEddiSingNiccTwenEugeKlau
RobeRichRoacEnglJonaAdamreceWindMatlemocWindIvanVirgClifFredNichErleRussKeunOnkeJonaPowePowe
PoweAstrMafiOlivremiBittwwwrMartXiaoLudwLeShManaaututuchkasBriaSelt

Author:  wanai [ Fri Feb 18, 2022 1:38 am ]
Post subject:  Re: Optimized Surfaces

Econ208.8BettAIDSVivaStarGaleExpeSomeJoseXVIIHermJasmHoosMileWindLoreSambTescWindHughTadeStef
SpekAlicStyxLiviWindKeraPhilAtlaGAAPJackFyodDifeWestPolyVinoFredRETAPaleMichQuenMiraAnitKera
JohnAnurNintNormNighLineWindMediMoviSonysatiMcBaAureZdenOetkPrasPatrVansLucifantCircSympYell
ModeBudoEnriNelsWendStonAdobJeanDougQuanPierAeolVirgZoneEnteJeweFOTOtaglMiyoZoneWoulBarcZone
ArtsGanjdiamNothFIPRZoneVisiEricZoneWindZoneZoneZoneZoneZonediamRichWitoZoneGuitRHINGaryXVII
ZoneRaamXVIICARDMessKronVestCataBookNichPinnCHARPrelPonnCarrLukaDonaCaseSonywwwnXVIIChemFOLK
CleaEducEducEminWorlWaltKidsWindWindWindDisaValeChouCalvUrinThisPeteMarbFantSofiJameLighDwig
KerbClayDaviXVIIDaviKareStefHonoBornNighPeteGammCodeBeenNextRockJohnBillVictLastCapiattiHDMI
natiLarrwwwrWindPennBernBookwwwawwwsCafeFIFAWWIIAmerKateKlauTomaWindBeveJennLeonThemCARDCARD
CARDWordMegaSouloberToniMariRuedExceCaryRussHansFivetuchkasPainMarc

Page 3 of 4 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/