Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  rogue-like rendering  (Read 1141 times)
0 Members and 1 Guest are viewing this topic.
Offline thalador

Senior Newbie





« Posted 2007-10-29 09:02:17 »

Hello,

I want to write a rogue-like game and decided not to use any of the curses libraries and use ogl instead. Right now I want to represent a standart sized console window with 80x25 characters. This is how I draw the tiles at the moment:

1. I use vertex arrays with 2 triangles for every tile I want to draw as background.
2. Then I draw the same geometry again with textures and alphablending on and other colors(foreground color)

With that I can draw every letter with any background/foreground color combination. The letters are stored in the texture. This method is not very fast so I wanted to ask you what kind of improvement you would suggest. Vertex sharing was my first idea, but that would mean that every vertex has only one colorattribute and therefore the colors would mix over tile boundaries, which is bad..

Thanks
thala
Offline cylab

JGO Ninja


Medals: 38



« Reply #1 - Posted 2007-10-29 09:58:34 »

That's 4000 triangles and 12000 vertices. Should be fast enough. What's your system's spec? Have you profiled the bottleneck? Maybe it's the way you are filling the vertex array.

Mathias - I Know What [you] Did Last Summer!
Offline thalador

Senior Newbie





« Reply #2 - Posted 2007-10-29 11:32:53 »

It's 4000 triangles for the background and 4000 triangles for the foreground!

I tried the netbeans profiler and found out that I spent almost 40 % of the time in the rendering method in "self time". I guessed that this high number reflects the large amount of array operations I did for filling up the vertex arrays. So I implemented a update method that only changes the parts of the vertex array that actually need an update. That doubled the framerate instantly, but at the moment there is only one tile that needs an update so the framerate will drop again the more tiles change on the map(for a visibility algorithm for example).

Thx cylab you were right!
Do you got more tips on performance?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Online Riven
« League of Dukes »

JGO Overlord


Medals: 742
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #3 - Posted 2007-10-29 12:26:35 »

Quote
Do you got more tips on performance?

Don't do infinite loops.




Anyway, you can see a major speedup when using interleaved vertex-arrays, with optimal type-ordering (VCT).
If there are large parts of the geometry static over time, switch to VBOs, for another incredible speedup.
If you change the whole VBO every frame, it will be exactly as fast as a VA. So switch to VBOs anyway.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (4 views)
2014-07-23 21:16:32

Riven (6 views)
2014-07-23 21:07:15

Riven (6 views)
2014-07-23 20:56:16

ctomni231 (40 views)
2014-07-18 06:55:21

Zero Volt (36 views)
2014-07-17 23:47:54

danieldean (30 views)
2014-07-17 23:41:23

MustardPeter (32 views)
2014-07-16 23:30:00

Cero (47 views)
2014-07-16 00:42:17

Riven (48 views)
2014-07-14 18:02:53

OpenGLShaders (38 views)
2014-07-14 16:23:47
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!