Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (670)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / OpenGL Development / Re: Sprites and Tiles on: 2013-12-12 18:20:37
By algorithm I meant to invent it myself. Thanks for your method:)
2  Java Game APIs & Engines / OpenGL Development / Re: Sprites and Tiles on: 2013-12-11 15:33:12
Thanks for your answer.
One texture for all terrain and one for characters.
Anyway,  it may be tricky but I think it is possible to code algorithm to render terrain with gaps for characters, then render all characters and then finish rendering terrain, only with two texture swaps.
But as you said may be it is even not necessary. If I meet performance issues then I'll think about optimization.

Guys thanks for answers!
3  Java Game APIs & Engines / OpenGL Development / Re: Sprites and Tiles on: 2013-12-11 09:58:03
tree is an example, it may be any object, tree, rock, house, wall etc all these object belong to terrain and are on another tileset.

10-20 times are from characters on the screen, some characters must be behind objects, some in front. For example Townsmen game, or any other strategy game, there are may be many units.

4  Java Game APIs & Engines / OpenGL Development / Re: Sprites and Tiles on: 2013-12-11 04:06:11
Why would you need to change the texture 10-20 times per frame?

While rendering terrain if there is a tree that must be in front of mob or player, I must switch texture to draw player and then switch again to that tree(so player will be behind it), If I don't the player will be standing on  a tree. In worst cases I suppose I'll need to do this 10-20 times.
5  Java Game APIs & Engines / OpenGL Development / Re: Sprites and Tiles on: 2013-12-10 15:52:00
You can't bind both.

Can I ask why you don't just have one large spritesheet?

But if each spritesheet is big. For example one for environment, others for characters, one spritesheet for each different character with all angles of view and animation on it.
Just wanted to ask is it ok to change texture 10-20 times per frame?
6  Java Game APIs & Engines / OpenGL Development / Re: Sprites and Tiles on: 2013-12-10 06:51:07
You can render in whatever order you want, but from what it looks like, you would want to sort your renders by y value, so that the player can be rendered before the rock if it's below it. Otherwise the player will be partially behind the rock, despite being meant to be in front of it. Also, I don't understand what you mean by interact, any environmental interactions should be handled through collision, which you'd have to write yourself, rendering only puts things on the screen.

That said, things will be drawn to the screen in the order that they are rendered, so if you say, draw the ground after the player, the player will be invisible, because the ground will be in front of him, so you want to render your top most elements last, such as GUI. In your case, I would look into setting up an array of sprites to hold which texture they each need to render from, so that you can sort them all by their y position, then render them with their proper textures, in an order that works.

Thanks for the reply. I know about rendering order. You misunderstood me.
Trees rocks etc belong to one big texture, and players belong to another. Seems like I must bind texture with rocks trees etc to draw tree, then I have to bind spritesheet to draw player and then again I have to bind first texture do draw rock. Seems like not very optimal.

May be I should bind both textures and use different shaders to draw player and trees with rocks?
7  Java Game APIs & Engines / OpenGL Development / Sprites and Tiles on: 2013-12-10 05:43:40
Hi everybody!
Many tutorials say that we must not bind textures too often, that's why we have all these spritesheets and tilesets.
Suppose I have a tileset with water, grass, trees, houses etc. And spritesheet with players.
I have a question about rendering.
Firstly I draw water layer, then ground, and then objects(trees, rocks houses). I'm very new to this, I suppose players must be on the same layer with objects to interact with them, am I right?
Look at the situation

We have many trees, rocks and players on different positions, so while rendering we have to rebind textures(tileset and spritesheet with characters) every time depending on what I'm rendering now(tree or player), because like on the picture while player on this position tree must be behind him and rock in front of him. Is there any good practices to do this task optimally?
Pages: [1]
IanParcs (36 views)
2016-04-18 14:18:53

KaiHH (36 views)
2016-04-18 08:35:41

KaiHH (67 views)
2016-04-15 12:43:58

theagentd (67 views)
2016-04-14 02:16:17

theagentd (74 views)
2016-04-14 02:15:43

IanParcs (67 views)
2016-04-12 03:51:16

IanParcs (37 views)
2016-04-12 03:50:03

IanParcs (33 views)
2016-04-12 03:49:54

IanParcs (30 views)
2016-04-12 03:49:52

IanParcs (38 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30 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!