Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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
trollwarrior1
Exactly!
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
bliznatch,
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.

opiop65,
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]
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (36 views)
2014-12-15 09:26:44

Mr.CodeIt (29 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (98 views)
2014-12-08 04:46:31

JscottyBieshaar (58 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (76 views)
2014-11-29 21:32:03

toopeicgaming1999 (136 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (37 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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!