Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (756)
Games in Android Showcase (229)
games submitted by our members
Games in WIP (842)
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  Game Development / Game Mechanics / Re: Faster tile drawing. on: 2013-05-13 15:26:07
Well, i have a 3 dimensional array (layers*width*height) witch contains 4 layers of tiles (each tiles holds 4 variables : an array of Strings "propeties", a boolean "animated", int speed [of the animation], and a array of tileSprite ID's [i.e. 4,5,6] ). The render funtion loops throught the array and draws the tileSprites based on the tile's current id (the tiles dont have any kind of time counter, the id is chosen by some simple algorithm). The tiles have also a function : returnWithNextID() witch returns the tile with it's next id, if it has any (useful if you have for example 2 states of a door tile, opened and closed).

Here is the render function:

public void render(int x,int y,int startTileX,int startTileY,int width,int height,int layer,Graphics g){
      int twidth = getTileWidth();
      int theight = getTileHeight();
      long time = System.currentTimeMillis();
      Tile tile;
      int frame;
      //Reminder: to use this function call ImageBag.tileSheet.startUse(); before calling it and ImageBag.tileSheet.endUse(); after calling it.
      for(int tx = startTileX; tx < startTileX+width && x < layers[0].length;tx++){
         for(int ty = startTileY; ty < startTileY+height && y < layers[0][0].length;ty++){
            tile = getTile(tx,ty,layer);
               frame = (int)(  (time/(100*tile.speed))%tile.getAllTheIds().length);
               ImageBag.tiles[tile.getAllTheIds()[frame]].drawEmbedded(x+((tx-startTileX)*twidth), y+((ty-startTileY)*theight),Tile.WIDTH,Tile.HEIGHT);
               ImageBag.tiles[tile.getId()].drawEmbedded(x+((tx-startTileX)*twidth), y+((ty-startTileY)*theight),Tile.WIDTH,Tile.HEIGHT);


PS: In the Map.class there is also a 2d array of booleans for collision detection (solid|passable).
2  Game Development / Game Mechanics / Re: Faster tile drawing. on: 2013-05-12 14:19:10
That's on big ass post xd Well i think i get what you mean, but there is one small problem, some tiles are animated, some are not.And as for lighting, yes it's possible because all i do is draw a map of (smaller thus more) colored tiles (mostly black) with different opacities. I started reading on the smapling stuff but i still dont know how to do it properly. Could you please show me how to do it explain it to me Cheesy ? It would help me A LOT.

- Alex

3  Game Development / Game Mechanics / Re: Faster tile drawing. on: 2013-05-12 09:36:23
Whoa, thanks for the replies! Unfortunately i didn't gain any fps by changing things to what davedes said (changed renderer to Vertex Array Renderer, started using spritesheets) but that doesn't bother me now because of the article davedes posted xd (thanks!). Oh and Jimmit, the game is not on Android Cheesy


PS: After looking at LibGDX, i think i will switch to it in the next project.
4  Game Development / Game Mechanics / Faster tile drawing. on: 2013-05-11 22:15:49
Hello Cheesy Im programming a dungeon crawler in Slick2D and i have stumbled upon a big wall X.X Yes, it's the FPS.
I am currently drawing (the visible part of) 4 tile layers + 1 lighting layer (there are also other things like gui & entity systems). I have a stable 90-120 FPS but considering the amount of logic that still needs to be added (AI,NPC'S,pets,combat system,buff system,spell system, particle effects etc. etc.) i need something around 500.
Now i have seen THIS AWESOME article Cheesy but unfortunately my graphics card doesn't support OpenGL 3.0 :C (everything is working besides the texture loading - OpenGL 3.0 ). Now my question is Is there any way to achieve the same performance-boost with OpenGL 2.0? If there is, could you please explain? Im kinda newbie to OpenGL.

5  Game Development / Game Mechanics / Re: Entity knockback on: 2013-04-21 09:11:53
Whoa i didn't expect code! Thanks  Grin ! I think i will add knockbackTimer an knockbackTo to the Velocity component and do the logic in some system. Thanks again  Grin !

PS : r is radians , right? Or degrees?
6  Game Development / Game Mechanics / Entity knockback on: 2013-04-20 17:54:34
Hi, can someone please tell me how to add knock-back? My entities have x,y,velocityX and velocityY variables, and i have just no idea how to add it. I can like add 5 to velocityX for example, but how do i decrease it? And if the entity has bumped into something and it's velocity is set to 0, how do i make it so that it stops decreasing?Maybe add separate fields, but that destroys the purpose of one velocity vector, doesn't it? Please help me :c

PS: Using Artemis.
Pages: [1]
DesertCoockie (59 views)
2018-05-13 18:23:11

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

nelsongames (78 views)
2018-04-24 18:14:32

ivj94 (763 views)
2018-03-24 14:47:39

ivj94 (95 views)
2018-03-24 14:46:31

ivj94 (647 views)
2018-03-24 14:43:53

Solater (108 views)
2018-03-17 05:04:08

nelsongames (189 views)
2018-03-05 17:56:34

Gornova (430 views)
2018-03-02 22:15:33

buddyBro (1090 views)
2018-02-28 16:59:18
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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!