Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (468)
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 / Tools Discussion / Doing a mix of 3d and 2d on: 2010-06-13 19:34:33
Currently myself and a friend are developing both a game design document and a class diagram for an online rpg that will run in applet. We are mainly aiming at a 2d game with an isometric view angle. For the ground/terrain, we don't want it to look flat and boring, but more or less actually have hills and such. I know a lot can be done with shading and proper drawing to show depth and slopes. Im wondering if perhaps using a 3d mesh is the way to go, and we can just do some simple 2d sprites that run over top. Is this a bad idea?

If we go down that route, I'm thinking using the lwjgl is probably the way to go. JME2 would be nice, but I think since it's primary focus is full 3d, that might not work so well. I do like slick as well, but obviously that wouldnt support the 3d terrain.

Any thoughts or suggestions on that methodology, and the tools we're thinking of?
2  Game Development / Game Play & Game Design / Re: Tile an image across a given x,y,height,width - slick2d on: 2010-06-11 00:46:37
Was working on it a bit last night, and I found that since the texture coords took the image and stretched it across, I ended up with the same problem. So i put together a method to essentially tile it, but I don't feel like it's very efficient or perfect.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
for(int i = 0; i < levels.size(); i++) {
         ArrayList<Sprite> tempGrounds = levels.get(i).getGrounds();
         for(int g = 0; g < tempGrounds.size(); g++) {
            Sprite ground = tempGrounds.get(g);
            Image groundGraphic = ground.getGraphic();
            int gWidth = groundGraphic.getWidth();
            int gHeight = groundGraphic.getHeight();
            int xTimes = (int)ground.getSizeX() / gWidth;
            int yTimes = (int)ground.getSizeY() / gHeight;
            if(xTimes <= 0) {
               xTimes = 1;
            }
            if(yTimes <= 0) {
               yTimes = 1;
            }
            for(int x = 0; x < xTimes; x++) {
               for(int y = 0; y < yTimes; y++) {
                  groundGraphic.draw(ground.getX() + (gWidth * x), ground.getY() + (gHeight * y), gWidth, gHeight);
               }
            }            
         }
      }


Due to the fact im dividing intergers, I know there will be a loss of accuracy, and therefore rendered images will actually be in some cases shorter than the actual block. I think this has a bigger problem of leading to a lot of computation when more and more gets added as a process.
3  Game Development / Game Play & Game Design / Re: Tile an image across a given x,y,height,width - slick2d on: 2010-06-10 01:56:40
Thanks a lot, that really gave me a clear picture of how the textcoords work. It's still not perfect. I may want to modify my image so it has the sprites in the quadrants evenly. Make it more of a spritesheet.
4  Game Development / Game Play & Game Design / Re: Tile an image across a given x,y,height,width - slick2d on: 2010-06-10 00:29:21
Hmm, think i might crack open my book on opengl and read a bit about texture mapping, as this is starting to go over my head. I have tried messing around with the values. With 0,3 i see the image tiled 3 times across the rectangular area. Switching it to 0, 1 has it once. Now if i switch it to 0.5f, 1, I just see the character image once, not the one for my ground at all. This image just has a stickman, and then to the right of it, the ground.
5  Game Development / Game Play & Game Design / Tile an image across a given x,y,height,width - slick2d on: 2010-06-09 04:23:11
Been trying to figure this out. I have an ArrayList of my own Sprite class. The sprite class simply contains x, y, width, height, and a type Image from Slick. In my gameplaystate, I loop through the arraylist that contains all the ground sprites. I just have one in there for now. To pull in my ground image, i have it in the same .png as my player sprite. I just use the getSubImage() method to separate it. The problem is, when im using GL11 code to tile out the image, it has both the ground and character images in the tile, even though im referring to the subbed image. I might just be using it wrong, or perhaps there's a better way with slick methods to accomplish this. Here's my loop to draw out the ground objects:

Quote
public void drawSurfaces() {
      for(int i = 0; i < levels.size(); i++) {
         ArrayList<Sprite> tempGrounds = levels.get(i).getGrounds();
         for(int g = 0; g < tempGrounds.size(); g++) {
            Sprite ground = tempGrounds.get(g);
            ground.getGraphic().bind();
            // ground.getGraphic().draw(ground.getX(), ground.getY(), ground.getSizeX(), ground.getSizeY());
            float x = ground.getX();
            float y = ground.getY();
            float rightX = ground.getRightX();
            float bottomY = ground.getBottomY();
            // draw the pattern
            GL11.glBegin(GL11.GL_QUADS);
            GL11.glTexCoord2f(0, 0);
            GL11.glVertex2f(x, y);
            GL11.glTexCoord2f(3, 0);
            GL11.glVertex2f(rightX, y);
            GL11.glTexCoord2f(3, 3);
            GL11.glVertex2f(rightX, bottomY);
            GL11.glTexCoord2f(0, 3);
            GL11.glVertex2f(x, bottomY);
            GL11.glEnd();
         }
      }
   }

ground.getGraphic().draw(ground.getX(), ground.getY(), ground.getSizeX(), ground.getSizeY()); will draw out the correct image, but it stretches it. While my current ground image is just a single colour, learning to tile now will be better. Plus the stretched image doesn't look as good.
6  Java Game APIs & Engines / Tools Discussion / Re: having issues with slick2d AngelCodeFont on: 2010-06-04 22:55:38
Ahhhh. Yeah i see i have several png files in the resources folder. Do I need to include them all or something to have access to all the characters I require?

Just had to clear the glyph cache. I'm good Smiley.
7  Java Game APIs & Engines / Tools Discussion / Re: having issues with slick2d AngelCodeFont on: 2010-06-03 13:21:37
The clarify, the words Next and Score are part of the image used for the backround. That polygon of light gray in the score box is supposed to be a number. I'll review my font file as well as you suggested, I don't think I selected any effects, but there may be some by default or something.
8  Java Game APIs & Engines / Tools Discussion / having issues with slick2d AngelCodeFont on: 2010-06-03 01:59:35
I followed the on the slick website to create a tetris clone. The code was a bit off and needed some adjustments. To render the players score, it uses the TrueTypeFont class, which is now depricated. After google searching, I found a suggestion to use the AngelCodeFont, and to create a font file using a tool called Hiero. I created the file, and setup the code, however my text seems to render quite funny or not at all. By funny, I mean it almost looks as if it's too big, and is cut off for where i placed it. I used 12px Arial font, and no luck. Here's a screen of what I am experiencing:

http://www.flickr.com/photos/37406878@N05/4664717994/

Any suggestions? Here's how im using the AngelCodeFont class:
Quote
public void init(GameContainer gc, StateBasedGame sbg)
         throws SlickException {
/* other code */
      font = new AngelCodeFont("resources/Arial10.fnt", gameHUD);
/* more code */
}

public void render(GameContainer gc, StateBasedGame sbg, Graphics g)
      throws SlickException {
/* other code */
           font.drawString(600, 80, String.valueOf(score));
}
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.

theagentd (6 views)
2014-04-24 23:00:44

xsi3rr4x (83 views)
2014-04-15 18:08:23

BurntPizza (75 views)
2014-04-15 03:46:01

UprightPath (86 views)
2014-04-14 17:39:50

UprightPath (69 views)
2014-04-14 17:35:47

Porlus (86 views)
2014-04-14 15:48:38

tom_mai78101 (109 views)
2014-04-10 04:04:31

BurntPizza (169 views)
2014-04-08 23:06:04

tom_mai78101 (265 views)
2014-04-05 13:34:39

trollwarrior1 (216 views)
2014-04-04 12:06:45
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!