Skip to main content
gamedev.net
🔒 Locked

tile engine

Started by Iftah 6 replies 950+ views
Original Post
Iftah
Iftah
hi :) im a complete openGL newbie but very exicted to finally attempt it. im trying to make a platform style game (tile based) i followed the article tiling in opengl (http://www.gamedev.net/reference/articles/article1256.asp) which basically loops x,y and draws quads but i have a feeling it is quite basic. my question: is there a smarter way to draw the tiles? display list? quad strip? unroll a loop? also, should i split all the tile bitmaps into many 32x32 textures or have one big texture and display part of the texture for each tile? i switched to orthogonal view and it improved some the performance. not that i have performance problems so far (the "game" is nothing but render 15x15 tiles) but profiling it at 60 fps shows the drawing takes a large percent of the time (full-screen is better but still lots of time rendering). something like 60-70% rendering 40-30% sleeping. i know games can settle for less than 60 fps but i think a simple platform game should be able to handle it. (i must admit i have an old pc, 1800mhz p4, 64mb weak graphics card). thanks in advance Iftah.
sssa
sssa
in my opinion,you can use VertexArray and DisplyList to speed up your program,
i am a beginner too.
Iftah
Iftah
thanks,
Ill look into the subject of vertex array

and let you know if there is an improvment
will take me a while though, exams season here :(

Iftah.
jeroenb
jeroenb
I'm currently developing a tile based game engine myself. I use a VBO (vertex buffer object) to store in the layers, ready for rendering. In the rendering loop I detect which tiles are visible and only send the indices for those tiles to the GPU.

But I would recommend you to use a basic version first, so you can learn the concepts (I did that too). Later you can optimise the engine. You can take a look at my engine: JEngine SSE
Crafter 2D: the open source 2D game framework ?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]
Iftah
Iftah
thank you jeroenb, your engine looks very cool!
exactly what i had in mind when i started my project :)

ill check VBO

Iftah.
jeroenb
jeroenb
I'll try to upload a clean project ready for development of a game in the upcomming days. For that I have to create some templates of the Lua scripts and directory structure. I will also add the editor with it, in which you can build the worlds and write your lua scripts.
Crafter 2D: the open source 2D game framework ?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]
sabhat
sabhat
About the texture part I think its faster to store as much as you can in one big texture and display the parts you want for each tile.
Heard that too many glBindTexture can slow your app down
jeroenb
jeroenb
That is true. Texture swaps take some considerable time. That's why I have put all tiles in one texture for every layer. It is even possible to use one tile bitmap on multiple layers. You just have to use other tiles :P.

I posted a template project on my website from which it should be fairly easy to create your own game. Please feel free to try it out and post bugs or idea's on my forums.
Crafter 2D: the open source 2D game framework ?Github: https://github.com/crafter2d/crafter2d
Twitter: [twitter]crafter_2d[/twitter]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.