die fps bei tiles zeichnen ist sehr langsam :(
Übersicht

cybyBetreff: die fps bei tiles zeichnen ist sehr langsam :( |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
hi,
könnte ihr dashier bitte mal testen und eure FPS und Rechnerdaten angeben ? denn bei mir läuft das nur mit 8-13 FPS , habe aber auch nur 233Mhz ^^ aber bald 2,7Ghz *gg* Code: [AUSKLAPPEN] ;///////////////////////////////////////////////////////////////////////////
;/////////////////////////////////////////////////////////////////////////// ;///////////////// graphicsmodus starten /////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// Graphics 800,600,16,2 SetBuffer BackBuffer() ;############################### daten laden ############################# ;//////////////////////////////// *tiles Global tilex = 32 Global tiley = 32 Global max_tiles = 225 Global free_tiles = 0 ;//////////////////////////////// *map Global mapx = 500 Global mapy = 500 Dim layer(1,mapx,mapy) ; 1layer,unter dem spieler Dim layer(2,mapx,mapy) ; 2layer,selbe höhe wie spieler Dim layer(3,mapx,mapy) ; 3layer,oberhalb vom spieler Dim layer(4,mapx,mapy) ; layer wo noch kommt.... For y = 0 To mapy-1 For x = 0 To mapx-1 layer(1,x,y) = Rand(1,2) layer(2,x,y) = Rand(1,2) layer(3,x,y) = Rand(1,2) layer(4,x,y) = Rand(1,2) Next Next ;//////////////////////////////// *scrolling Global scrollingx Global scrollingy Global scrolling_speed = 32 Global scrollingx_max = 23 Global scrollingy_max = 16 Global scrollingx_min = 0 Global scrollingy_min = 0 ;/////////////////////////////// *fps Global loop_time = MilliSecs() ;///////////////////////////////////////////////////////////////////////// ;//////////////////// bilder ///////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;############################ tiles ###################################### Global tiles = LoadAnimImage("tiles.png",32,32,0,max_tiles) MaskImage tiles,255,0,255 ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;///////////////// hauptschleife /////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// Repeat Cls draw_layer() scrolling() ;###### infos Color 0,0,255 Text 10,30,"scrollingx: "+scrollingx/32 Text 10,50,"scrollingy: "+scrollingy/32 ;##### fps loop = loop + 1 If MilliSecs()-1000 > loop_time Then fps = loop : loop = 0 : loop_time = MilliSecs() Text 10,10,"fps: "+fps Flip Until KeyHit(1) End ;///////////////////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;///////////////// functionen //////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;############################## scrolling() ############################## Function scrolling() ;//////////////// tastatur befehle If KeyDown(200) Then ;////////////////////////// hoch If scrollingy > scrollingy_min scrollingy = scrollingy - scrolling_speed EndIf EndIf If KeyDown(203) Then ;////////////////////// links If scrollingx > scrollingx_min scrollingx = scrollingx - scrolling_speed EndIf EndIf If KeyDown(205) Then ;////////////////////// rechts If scrollingx/32 < (mapx-1)-scrollingx_max scrollingx = scrollingx + scrolling_speed EndIf EndIf If KeyDown(208) Then ;////////////////////// runter If scrollingy/32 < (mapy-1)-scrollingy_max scrollingy = scrollingy + scrolling_speed EndIf EndIf End Function ;############################## draw_layer() ############################# Function draw_layer() ;############################################################## 1LAYER For x = scrollingx_min+(scrollingx/32) To scrollingx_max+(scrollingx/32) For y = scrollingy_min+(scrollingy/32) To scrollingy_max+(scrollingy/32) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(1,x,y) Next Next ;############################################################## 2LAYER For x = scrollingx_min+(scrollingx/32) To scrollingx_max+(scrollingx/32) For y = scrollingy_min+(scrollingy/32) To scrollingy_max+(scrollingy/32) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(2,x,y) Next Next ;############################################################## 3LAYER For x = scrollingx_min+(scrollingx/32) To scrollingx_max+(scrollingx/32) For y = scrollingy_min+(scrollingy/32) To scrollingy_max+(scrollingy/32) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(3,x,y) Next Next ;############################################################## 4LAYER For x = scrollingx_min+(scrollingx/32) To scrollingx_max+(scrollingx/32) For y = scrollingy_min+(scrollingy/32) To scrollingy_max+(scrollingy/32) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(4,x,y) Next Next End Function die tiles http://home.arcor.de/24web4free/tiles.png habt ihr vielleicht verbesserungs vorschläge das das schneller wird ? clipping ist drinne (karte 500*500tiles) mit den pfeiltasten kann man sie bewegen.... schomal ein BIG THX ! MfG cyby ![]() |
||
![]() |
simi |
![]() Antworten mit Zitat ![]() |
---|---|---|
Habs nichgt ausprobiert, aber ich würde nur eine for schleife machen in der functiond drawlayer.
[/code] |
||
x.Force |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
ich hab 20 - 22 fps mein system steht unten in der signatur | ||
AMD Athlon XP 2000+ | 1024mb DDR-Ram | Asus Radeon 9600XT | BENQ FP757 17°Zoll TFT Was kümmert mich mein Geschwätz von gestern? (Konrad Adenauer) -.- |
![]() |
Slayer |
![]() Antworten mit Zitat ![]() |
---|---|---|
102 | ||
AMD2500XP, SB5.1, DX9, 512MB DDR333,
XPPro SP1a,ATI 9800SE 256bit 128MB,B3B, B+ immer die neue Version |
![]() |
Abrexxes |
![]() Antworten mit Zitat ![]() |
---|---|---|
100 FPS (109 ohne vsync/168 mit angepasster Levelgeschwindigkeit)
Zum Vergleich:Die Engine von TS bringt bei vergleichbarem mit 3fach Parallax incl.animierten Tiles auf meinem System 269fps(ohne ruckler) AthlonXP(Barton)2600+/Dualchannel infineon 512MB/Radeon9600proFireblade. cu Linux |
||
![]() |
YellowRiderEhemaliger Admin |
![]() Antworten mit Zitat ![]() |
---|---|---|
125 mit flip 0. Sonst 85.
AMDAthlon2500+ @ 3200+;512MB;GF-FX5200 Du bräuchtest immer nur die Tiles zeichnen die man sieht. |
||
Dreamora |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Wenn du funktionen benutzt, dann versuche globale Variablen zu vermeiden, das erzeugt nur fehler und probleme.
Gab auch einiges zu optimieren, kannst ja ma versuchen. Hier die optimierte Fassung, teste die mal ( editiert - mit dem hinweis von oben ) Code: [AUSKLAPPEN] ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;///////////////// graphicsmodus starten /////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// Graphics 800,600,32,2 SetBuffer BackBuffer() ;############################### daten laden ############################# ;//////////////////////////////// *tiles Global tilex = 32 Global tiley = 32 Global max_tiles = 225 Global free_tiles = 0 ;//////////////////////////////// *map Global mapx = 500 Global mapy = 500 Dim layer(1,mapx,mapy) ; 1layer,unter dem spieler Dim layer(2,mapx,mapy) ; 2layer,selbe höhe wie spieler Dim layer(3,mapx,mapy) ; 3layer,oberhalb vom spieler Dim layer(4,mapx,mapy) ; layer wo noch kommt.... For y = 0 To mapy-1 For x = 0 To mapx-1 layer(1,x,y) = Rand(1,2) layer(2,x,y) = Rand(1,2) layer(3,x,y) = Rand(1,2) layer(4,x,y) = Rand(1,2) Next Next ;//////////////////////////////// *scrolling Global scrollingx Global scrollingy Global scrolling_speed = 32 Global scrollingx_max = 23 Global scrollingy_max = 16 Global scrollingx_min = 0 Global scrollingy_min = 0 ;/////////////////////////////// *fps Global loop_time = MilliSecs() ;///////////////////////////////////////////////////////////////////////// ;//////////////////// bilder ///////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;############################ tiles ###################################### Global tiles = LoadAnimImage("f:\temp downloads\tiles.png",32,32,0,max_tiles) MaskImage tiles,255,0,255 ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;///////////////// hauptschleife /////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// ;/////////////////////////////////////////////////////////////////////////// Repeat Cls draw_layer() scrolling() ;###### infos Color 0,0,255 Text 10,30,"scrollingx: "+scrollingx/32 Text 10,50,"scrollingy: "+scrollingy/32 ;##### fps loop = loop + 1 If MilliSecs()-1000 > loop_time Then fps = loop : loop = 0 : loop_time = MilliSecs() Text 10,10,"fps: "+fps Flip 0 Until KeyHit(1) End ;///////////////////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;///////////////// functionen //////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;///////////////////////////////////////////////////////////////////////// ;############################## scrolling() ############################## Function scrolling() ;//////////////// tastatur befehle If KeyDown(200) Then ;////////////////////////// hoch If scrollingy > scrollingy_min scrollingy = scrollingy - scrolling_speed EndIf EndIf If KeyDown(203) Then ;////////////////////// links If scrollingx > scrollingx_min scrollingx = scrollingx - scrolling_speed EndIf EndIf If KeyDown(205) Then ;////////////////////// rechts If scrollingx/32 < (mapx-1)-scrollingx_max scrollingx = scrollingx + scrolling_speed EndIf EndIf If KeyDown(208) Then ;////////////////////// runter If scrollingy/32 < (mapy-1)-scrollingy_max scrollingy = scrollingy + scrolling_speed EndIf EndIf End Function ;############################## draw_layer() ############################# Function draw_layer() ;############################################################## 1LAYER For x = scrollingx_min+(scrollingx/32) To scrollingx_max+(scrollingx/32) For y = scrollingy_min+(scrollingy/32) To scrollingy_max+(scrollingy/32) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(1,x,y) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(2,x,y) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(3,x,y) DrawImage tiles,x*tilex-scrollingx,y*tiley-scrollingy,layer(4,x,y) Next Next End Function |
||
Ihr findet die aktuellen Projekte unter Gayasoft und könnt mich unter @gayasoft auf Twitter erreichen. |
- Zuletzt bearbeitet von Dreamora am Mi, Jun 30, 2004 22:00, insgesamt einmal bearbeitet
![]() |
YellowRiderEhemaliger Admin |
![]() Antworten mit Zitat ![]() |
---|---|---|
Sind bei mir die gleichen FPS werte. | ||
cyby |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
THX @ ALL ![]() jetzte läuft es immer mit 17FPS ![]() Zitat: Du bräuchtest immer nur die Tiles zeichnen die man sieht.
wie meinst du das genau ? also wenn z.b. die tiles 11 und 21 sieht, die dann nur zeichnen ? Zitat: Zum Vergleich:Die Engine von TS bringt bei vergleichbarem mit 3fach Parallax incl.animierten Tiles auf meinem System 269fps(ohne ruckler)
gut danke, werde sie mir anschauen ![]() |
||
![]() |
Markus2 |
![]() Antworten mit Zitat ![]() |
---|---|---|
Du könntest noch die 8 Multiplikationen weg machen in dem
du die Schleifen in step 32(TileXY) laufen läßt und vorher schon von bis ausrechnest . Oder einmal ausrechnen x*tilex-scrollingx,y*tiley-scrollingy Ist zwar gering aber macht sich evtl. bemerkbar . Das was nicht transparent ist mit DrawBlock zeichnen z.B. den 1 Layer . CLS ist denke ich auch überflüssig !? |
||
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group