Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (579)
games submitted by our members
Games in WIP (500)
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 / Newbie & Debugging Questions / Re: Hard to start a project. on: 2014-02-27 05:51:12
I'll pile on to what everyone else is saying.

Just start with what you can do, and do the best you can with that. If it turns out well, you can try to find someone to replace the art and music. Meanwhile, just hack together your own, even if it's bad, or find free stuff online. There is a significant amount of legitimately free resources, though if you use it in a game you release, you should double-check the licenses to make sure you don't have to pay or get permission or release the source code (unless of course you're ok with that!).
2  Game Development / Newbie & Debugging Questions / Re: Framerate cut in half when running by clicking jar vs command line or netbeans on: 2014-01-21 16:09:21
Lol.

It feels inappropriate to reply just to say that. This forum feels too official. Maybe something's wrong with me.
3  Game Development / Newbie & Debugging Questions / Re: Framerate cut in half when running by clicking jar vs command line or netbeans on: 2014-01-21 15:34:46
Thanks, Cas!

I'll have to remember that about distributing the JRE with the game. I'm guessing a bit of searching will reveal some solutions or at least instructions for the best ways to do that.

Unfortunately, I'm pretty sure my netbook's video drivers are as up to date as I can get them. Intel 945GM does not appear to be the hottest thing around. Which brings up the related question of how to use OpenGL extensions with LWJGL, but I'll search around a bit more before starting a thread about that. (Unless you already have a link handy. Tongue )

Btw, I think it's cool that you frequent these forums. I loved Revenge of the Titans (despite not being able to tell what upgrades would do ahead of time), and I can't help but wonder how you find/steal time to answer newbie questions.
4  Game Development / Newbie & Debugging Questions / Re: Framerate cut in half when running by clicking jar vs command line or netbeans on: 2014-01-21 15:26:02
Haha, thanks for the advice.

Hm... well, I'm a little blurry on how forwards compatibility works in Java. If I wrote something in Java 7, and someone had Java 6, would it always work, sometimes work depending on the features I used, or never work? (Or maybe I could bypass the whole issue by distributing the right JRE with the game... I think I've heard you can do that.)

If there's no reason to use Java 6, then I might as well follow your advice.

As a side note, it's my personal irrational goal to make sure the game can run on my netbook, which, despite coming with Windows 7 Starter, for some reason only supports OpenGL 1.4. Even though it was made in 2009. So I guess I have a lot of sympathy for people on old machines that just want to play a game that doesn't really look like it should need a new machine.
5  Game Development / Newbie & Debugging Questions / Re: Framerate cut in half when running by clicking jar vs command line or netbeans on: 2014-01-20 07:14:05
Looks like you guys are probably right!

If I search "java" in the start menu, it quickly comes up with Configure Java, About Java, and java.exe. If I open Configure Java, I'm seeing that I have Java 1.7.0_45 listed first in the User tab, with 1.6.0_31 second, and both are enabled. The System tab just has 1.7. All are located in Program Files (x86). So it looks like Windows is set up to use 32bit JREs.

If I instead open About Java, it tells me 1.7.0_45-b18. Presumably the same JRE that is listed first in Configure Java.

However, in control panel (Win7) -> Java, it lists only 1.6.0_26 in both User and System tabs, located in Program Files. So, that would indicate Windows is set up to use a 64bit Java 1.6 JRE.

In Control Panel -> Programs and Features, it looks like I have the following installed:
Java 7 Update 45
Java 6 Update 26 (64bit)
Java 6 Update 31
Java SE Dev Kit 6 Update 26 (64-bit)
Java SE Dev Kit 7 (64bit)

The NetBeans project is set to use JDK 1.6 as the platform. Under Tools -> Java Platforms, I have JDK 1.6.0_26 as the default, followed by JDK 1.7.0. I did pick 1.6 intentionally, because I assumed developing for Java 6 would have a broader install base than Java 7, and it would let me get a better idea of how it would run on less up-to-date systems even if that wasn't true. I don't know if that's really the case.

If I check java -version in command prompt, I see:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20,1-b02, mixed mode)

I guess what's going on is that command prompt and NetBeans are set to use 64bit Java 6, while double-clicking jars is set to use 32bit Java 7. Does that look like the case to you guys?

...how do I straighten Windows out? It has two separate Java Control Panels, one accessible from Windows Control Panel (the 64bit Java 6), one accessible from the start menu (the 32bit Java 7 and Java 6).

And what should I expect users to have if it's this messy on mine?! Thanks for your help in at least steering me in the right direction so far.
6  Game Development / Newbie & Debugging Questions / Framerate cut in half when running by clicking jar vs command line or netbeans on: 2014-01-16 10:40:27
The framerate on my game drops from 16-19 to 10 when I run it from a jar by double-clicking. Running it from the same jar by command prompt or from the project itself in the IDE gives me the higher framerate.

I'm using LWJGL, but I've found posts about this problem both elsewhere and here by people not using OpenGL. No solutions that I noticed though.

Any ideas?
7  Java Game APIs & Engines / OpenGL Development / Re: Texture binding not updating current texture on: 2013-12-30 17:21:21
I'm loading from two different libraries because slick lets me get them from the hard drive, but I needed to also be able to create them from BufferedImages that have had their pixel date manipulated at runtime, so I coded a version to do that.

Update:
Ok, tried your suggestion. I found TextureImpl.unbind() and TextureImpl.bindNone(), and both seem to work to get my texture out of the way and allow the slick textures to bind, so long as I call one and then bind the slick texture before glBegin(). Looks like it does the reverse as well. So, thanks! That seems to have fixed it. Odd though, as I'd made my own TextureRgba as an implementer of slick's Texture. Looking at the docs for the TextureImpl class you pointed out, maybe I should subclass that instead. Or maybe that will break things again. Suppose I'll have to try it.
8  Java Game APIs & Engines / OpenGL Development / [Solved, mostly] Texture binding not updating current texture on: 2013-12-30 15:36:17
UPDATE: Actually, if I try to render the norm TextureRgba, I get the equivalent problem. It looks like once I use texRgbaLoad(), it ignores Texture.bind() and only pays attention to glBindTexture(). I can swap out the return TextureRgba.loadTexture() in texRgbaLoad() with return null, and I don't get this problem. So it's definitely something in my TextureRgba.loadTexture() method. It's not the return new TextureRgba() line at the end, as commenting that out doesn't fix it. However, if I comment out both that line and the glBindTexture() in the same method and the glTexImage2D() line, the problem does go away. But of course, then I can't use the custom texture loading that TextureRgba.loadTexture() accomplishes. If I try to render the norm TextureRgba, it draws the door texture instead, scaled to the dimensions of norm.

I'm having a weird problem. If I load a Texture using slick's TextureLoader.getTexture(), all is well. However, if I afterwards load a different texture using a custom loader designed to create them from BufferedImages, I can no longer draw the one I loaded from slick unless I specifically use glBindTexture(GL_TEXTURE_2D, texvar.getTextureID()). Simply using texvar.bind() no longer seems to have any effect. Instead, it just draws the one I loaded earlier with my custom loader, but scaling to the dimensions of the texvar texture.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
public class GLTest {

private Texture door;
private int texW;
private int texH;
private int w = 1280;
private int h = 1024;
public GLTest() {
    //make display

    door = loadTexture("normal-example");
    TextureRgba foo = texRgbaLoad();

    //lwjgl setup, loop begins
   while(!Display.isCloseRequested()) {
    glClear(GL_COLOR_BUFFER_BIT);
    door.bind();
    glEnable(GL_TEXTURE_2D);
    glBegin(GL_QUADS);
        renderTexture(door, 100, 200);
    glEnd();
    //rest of loop
   }

    //relevant methods
   private TextureRgba texRgbaLoad() {
        BufferedImage img; int imgw = 0, imgh = 0; int[] rgba;
        int[] colors;
        try {
            img = ImageIO.read(new File(GameBase.assetsDir + "normal-example.png"));
            imgw = img.getWidth(); imgh = img.getHeight();
            rgba = new int[imgw * imgh];
            colors = img.getRGB(0, 0, imgw, imgh, null, 0, imgw);
            for(int y = 0; y < imgh; y++) {
                for(int x = 0; x < imgw; x++) {
                    Color c = new Color(colors[y*imgw + x]);
                    rgba[y*imgw + x] = c.getRGB();
                }
            }
            return TextureRgba.loadTexture(rgba, imgw, imgh);
        } catch(IOException ex) {
            Logger.getLogger(GLTest.class.getName()).log(Level.SEVERE, null, ex);
            return null;
        }
    }
   
    private Texture loadTexture(String key) {
        try {
            System.out.println("loading: assets/" + key + ".png");
            return TextureLoader.getTexture("PNG", new FileInputStream(new File("assets/" + key + ".png")));
        } catch(FileNotFoundException ex) {
            Logger.getLogger(GLTest.class.getName()).log(Level.SEVERE, null, ex);
        } catch(IOException ex) {
                Logger.getLogger(GLTest.class.getName()).log(Level.SEVERE, null, ex);
            }
        return null;
    }
   
    private void renderTexture(Texture t, float x, float y) {
        int tw = t.getTextureWidth();
        int th = t.getTextureHeight();
        glTexCoord2f(0,0);
        glVertex2f(x, y);
        glTexCoord2f(1,0);
        glVertex2f(x+tw, y);
        glTexCoord2f(1, 1);
        glVertex2f(x+tw, y+th);
        glTexCoord2f(0, 1);
        glVertex2f(x, y+th);
    }
   
    public static void main(String[] args) {
        new GLTest();
    }
   
}

Note that this code never actually does anything with the custom foo texture. All it does is load it. If I put that one line, TextureRgba foo = texRgbaLoad();, before door = loadTexture("door"); instead of after it, or if I just comment it out, everything works fine. Here is the TextureRgba.loadTexture() code, in another class, in another package:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
    private TextureRgba(int id, int imgWidth, int imgHeight, int texWidth, int texHeight) {
        this.id = id;
        this.imgWidth = imgWidth;
        this.imgHeight = imgHeight;
        this.texWidth = texWidth;
        this.texHeight = texHeight;
    }
    public static TextureRgba loadTexture(int[] rgba, int sourceW, int sourceH) {
        int textureID = glGenTextures();
       
        //determine texture dimensions
       //put the pixels from the provided rgba array into a ByteBuffer named buffer and flip it
       
        //"Bind the texture handle to the context"
       glBindTexture(GL_TEXTURE_2D, textureID);
       
        //"Set the scaling filtering"
       //specifies how it is handled when minified and magnified
       glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
       
        //"Send the buffer to OpenGL"
       //makes the texture
       glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, texW, texH, 0,
                GL_RGBA, GL_UNSIGNED_BYTE, buffer);
       
        return new TextureRgba(textureID, sourceW, sourceH, texW, texH);
    }


Anyone got any ideas? I guess I could work around it by using the glBindTexture() instead of the Texture.bind(), or by extending the Texture class to override its bind() method to use glBindTexture()... but it's always nice to figure out what I'm doing wrong in the first place.

Thanks in advance for any insight.
9  Game Development / Game Play & Game Design / Re: RPG stats on: 2013-12-25 12:54:24
I've had troubles to come up with list of more than about 5 or 6 stats, so that each stat isn't overlapping with another one. Since you like games with many stats, maybe you can give me a few suggestions of sets with more than 6 stats, which all are meaningful and not overlapping or influencing each other?

This is a pretty late reply, but it looks like you're a regular member, so you'll see it eventually!

I actually think 5 or 6 is a pretty good number for basic, core attributes for a character. D&D is the classic example, with Strength, Dexterity, Constitution, Intelligence, Wisdom, and Charisma. In my own tabletop RPG, I use Strength, Endurance, Dexterity, Agility, Magical Aptitude, and Aura.

The trick is combining these in different ways to get other numbers. For example, you can throw in skill ratings with various weapons and combine those with a dex stat to get different accuracy stats for your different armament options. You can then combine those same weapon skill ratings with agility to get dodge stats. (And I do this in my game, of course.) Really, you need a couple small groups of intuitive stats that interact in various ways to influence what you can do in the game. In these examples, you just have a handful of physical stats to measure what the character is and a handful of skill stats to measure what they're good at, and they work together to create the final result, which is the number you would actually look at for a given task.

If you do ever use lots of different groups of stats, I'd suggest keeping the numbers in their own separate scales. So maybe one group of stats would typically be values from 10-20, while another group would be in the hundreds. On one hand, this could make things more confusing, but on the other, it communicates to the player that they're not comparable -- they're not looking at an overwhelming list of equally important things, but at a few different categories that do different things, where the numbers only need to be weighed against other numbers in the same group.

Of course, the more numbers you have, the easier it is to confuse people. So, your mileage may vary.
10  Game Development / Game Play & Game Design / Re: RPG stats on: 2013-12-05 16:22:23
My preference is for more stats. But that's because I like customizing things, which is what more stats typically enable. I think each stat should provide some meaningful option to the player. That could mean that different stats favor different playstyles, or it could mean that specific ones are useful in specific tactical situations. Generally speaking, more stats encourages more strategic, planned play, and fewer stats encourages more action-oriented play, at least in my experience.
11  Game Development / Newbie & Debugging Questions / Re: Final Score Screen Effect Libgdx on: 2013-11-28 18:15:11
You can either subtract the score each frame and add what you subtracted to the grand total (so, each frame you're transferring score from the countdown score to the player's total score) and then render the results, or you can just show the score minus: the amount of time passed times the amount to subtract per unit of time passed, and then transfer the score at the end.

You can treat it as subtracting from the score every frame and showing the result, or you can treat it as showing a countdown animation every frame. Either way will work. My point is that you don't have to confine yourself to thinking, "I have to change the score every frame!" You just have to change what the player sees every frame.
12  Game Development / Newbie & Debugging Questions / Re: Hello, and OpenGL? on: 2013-11-28 16:09:39
There we go. Looks like imageshack worked (and apparently I had an account there?). Odd that it stretches the image unless it is exactly 80x80 though. And that there are no instructions I can see. Tongue But it works! Thanks.
13  Game Development / Newbie & Debugging Questions / Re: Final Score Screen Effect Libgdx on: 2013-11-28 15:48:32
If you want it to take a certain amount of time, no matter what the score, a timer might be appropriate. (I've never used one -- just checking the current time via the System.getMilliseconds or System.getNanos methods (not their exact names).) If you want the speed at which it counts down to be constant, say 10,000 per second, so that it will take longer to count down big numbers than small numbers, I don't see why you'd need a timer. Even if you want it to take a certain amount of time, regardless of score, you don't need one. You just need to know when you started counting down and what time it is when you're ready to show the numbers. Remember, you don't need to actually change the score numbers. It's just an effect. You're just changing what the player sees. Whether you want to use a timer or not is up to you.

As for audio, that's also up to you, man. It's a matter of preference.
14  Game Development / Newbie & Debugging Questions / Re: Hello, and OpenGL? on: 2013-11-28 15:41:48
Quote
You'll find a lot of applications, especially games, contain certain amounts of hackery. It's not necessarily a bad thing so long as you understand the ramifications of your hacks. ... As for threads, give this one a try, and browse through the Java2D section.
Ah, yes, that was the thread I was referring to, since people argued vigorously over whether it was a dangerous hack. I think I'll take a look at the Java2D section.

By the way, how do forum avatars work here? Every time I tried to add one, it didn't work. Would that be because I tried using Google Drive, Picasa, Dropbox, and Facebook to upload it, and it can't handle those links? Or are there specific requirements for the images I'm missing?
15  Game Development / Newbie & Debugging Questions / Re: Hello, and OpenGL? on: 2013-11-28 02:54:13
Oh, wow. I forgot LWJGL's license was so short. Thanks for the link, and for both of you responding. I've looked at it before, and I guess I really was just being paranoid. I think I remember some games (Revenge of the Titans, maybe?) just having the LWJGL notice as a screen in their installer. If that's all I have to worry about, maybe I should stop doing things the hard way. Tongue

philfrei, I did see that audio thread the other day. Confusions like the one in that thread over whether the game aside from the assets themselves would have to be freed to use CC audio are a big reason I've been hesitant to stray outside the bounds of Java SE, but I suppose I really have nothing much to lose with some of the more permissive licenses.

OpenGL is pretty universal, right? If I moved my rendering over to LWJGL, would I be shutting out older computers, people with integrated graphics cards, etc? Would I be opening myself up to a whole new world of support nightmares with graphics driver bugs and finnickiness?

I've seen a thread or two about different ways of doing per-pixel manipulation of images without OpenGL, and it sounds like the fast ways are kind of hacky. So, for something like dynamic lighting with Sprite Lamp normal maps, where I have to change the color of each pixel in an image, is there a thread that discusses the best ways to do this? I've got the code to do it right now, but like I said in my OP my framerate dropped from 174 to 7.

Should I be posting these questions in their own threads? Or somewhere else? Sorry, got this gush of text and questions spewing forth...
16  Game Development / Newbie & Debugging Questions / Re: Final Score Screen Effect Libgdx on: 2013-11-27 16:23:17
The score numbers rolling down to 0? Yeah, that shouldn't be too bad. I'm not very knowledgeable about graphics or libgdx, but I can tell you the basic logic.

1. Figure out the scores, along with how fast you want them to go down. Let's say you're dealing with scores in the tens of thousands and want them to go down at 10,000 per second. That rate should be saved in a variable.
2. Display the scores. Note the time these are drawn to the screen.
3. Every time you get another chance to draw another frame to the screen, for the score currently being counted down:
1  
2  
3  
4  
5  
//set the score we'll display to be subtracted based on the amount of seconds that have passed * the amount we want to count down per second
currentScore = startingScore - (millisecondTimeRightNow - millisecondTimeOfStep2) / 1000 * rate
//check if we're done counting this score down, and if so, show 0 and add that score to the player's total score
if(currentScore < 0) { currentScore = 0; noMoreLooping = true; playerScore += startingScore }
//draw playerScore, currentScore, and any other scores you aren't currently counting down

4. When you've counted down the last score, you're done. Wait for the player to press a key or something.

Edit: And for the love of all that is good, don't make it count down too slow. Otherwise, impatient players like me will get bored after the first couple times and keep tapping buttons or keys in vain, hoping to skip to the end of the countdown. (Or just make it skip to the end by setting all the countdown scores to 0 and updating the player's score when you press a certain key.) It's still a cool effect though.
Edit edit: Note that my syntax is wrong in a couple places at least. My code is just for an example of the logic. It won't work just copy-pasted. Tongue
17  Game Development / Newbie & Debugging Questions / Hello, and OpenGL? on: 2013-11-27 15:33:53
Hello! I'm a newbie as far as video game development goes, and I suppose to Java as well. Maybe intermediate. I've been programming in a couple of classes and in spare time since 200...5? -ish? So, I understand a lot of basic programming concepts and thought processes, but not a lot of the lower-level science and engineering, and most of my experience is in Java. I leave it to you to label my skill level.

I wanted to join this forum because it's one of the two places I've frequently found answers while Googling for my own questions, because it only seemed right that as a person trying to make a game in Java I should join a Java game dev forum, and because I have questions. So, thanks for having me (so far!).

My question right now is, what risks (in terms of licensing, cross-platform compatibility, and system requirements) and learning curves am I in for if I switch to OpenGL rather than throwing BufferedImages onto an AWT Canvas and a BufferStrategy with Graphics2D?

Background: I'm trying to make a pseudo-isometric, 2d, tactical RPG. It is intended to be a commercial release, however long it takes us to get there. I'm developing in Java 6 SE, with nothing extra at the moment because licenses scare me, and I honestly don't know how distributing it would work once I go beyond the built-in stuff. I'd really love it to run at no work for the user on Windows XP and onward, recent versions of Mac OS X, and the more popular Linux distributions. I'd love for it to run at at least 30fps on my 1.6GHz netbook. So, I'm casting a pretty broad net. The OpenGL question is being pressed because our Illustrious Art Director is very interested in using Sprite Lamp for dynamic lighting. I got the game to process a normal map (this one) to light a blank, grey square that covers maybe 2/3 of the game window, but this dropped the fps from 174 to 7 on my mid-range machine.

If anyone is interested in giving advice or suggestions on OpenGL or alternate routes (I could post my normal mapping code), or just a link to a topic I've missed where this has been covered before, I'd appreciate the help.

Thanks, and hope that question wasn't too demanding for a newcomer!
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.

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

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

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

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

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

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

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

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

trollwarrior1 (193 views)
2014-04-04 12:06:45

CJLetsGame (200 views)
2014-04-01 02:16:10
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!