Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (856)
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 2205 times)
0 Members and 1 Guest are viewing this topic.
Offline thalador

Junior Devvie

Projects: 1

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


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..

Offline cylab

JGO Kernel

Medals: 188

« Reply #1 - Posted 2007-10-29 08: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

Junior Devvie

Projects: 1

« Reply #2 - Posted 2007-10-29 10: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
Offline Riven

« JGO Overlord »

Medals: 1357
Projects: 4
Exp: 16 years

Hand over your head.

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

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  

hadezbladez (703 views)
2018-11-16 13:46:03

hadezbladez (347 views)
2018-11-16 13:41:33

hadezbladez (688 views)
2018-11-16 13:35:35

hadezbladez (171 views)
2018-11-16 13:32:03

EgonOlsen (2362 views)
2018-06-10 19:43:48

EgonOlsen (2474 views)
2018-06-10 19:43:44

EgonOlsen (1463 views)
2018-06-10 19:43:20

DesertCoockie (2128 views)
2018-05-13 18:23:11

nelsongames (1904 views)
2018-04-24 18:15:36

nelsongames (2572 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!