Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (549)
Games in Android Showcase (135)
games submitted by our members
Games in WIP (593)
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] 2 3 ... 8
1  Game Development / Newbie & Debugging Questions / Re: Using enum, how does this work? on: 2015-01-03 03:48:48
Um, I think I might have been misunderstood.
I mean something like
/** Types of foobangs. */
public enum FB_TYPE {
 /** special type for all types combined */

This is the code that has me confused. So, that ALL works for all the three previous or what? Does FB_TYPE.ALL == FB_TYPE.GREEN result in a true or a false?

It looks like you're thinking of bitflags, but have it all garbled up.

In C, it's a common idiom to use the bitwise OR operator to munge several enum values together, then test them with the bitwise AND. You can then declare a single enum value that ORs everything together for you. Like this:

enum MyFlags {
    NONE = 0,
    GREEN = 0x01,
    WRINKLED = 0x02,
    SWEET = 0x04,
    ANOTHER = 0x08,

A comparison with ALL will only return true if it is actually compared with ALL. You can't get true from ALL == GREEN, for example. To test, you have to use AND: if( val & GREEN ) == GREEN)...

AFAIK, the way to do this in Java is either to give your enum a constructor that takes an int parameter (since the values can't be sequential - you have to use sequential powers-of-two) or to use an EnumSet. But I don't know of any magic wildcard enum trick.
2  Discussions / Miscellaneous Topics / Re: How alive is the forum? on: 2014-12-29 10:09:46
I love the activity level here. I've been dropping by nearly every day for years. Clicking 'Show unread posts since last visit' typically shows me nearly two, sometimes three, full pages of post. It's easy to scan through and look for anything interesting without wondering if I'm missing anything. And the folks 'round here are friendly.
3  Game Development / Newbie & Debugging Questions / Re: LWJGL3 no GLFW package? on: 2014-12-06 09:05:30
Is there any way to have multiple windows in multiple threads?

Yes. The restriction on keeping event handling in the main thread comes from GLFW (if you haven't already, it's a good idea to familiarize yourself with the GLFW reference documentation). Some functions may only be called from the main thread and some may not be called from callbacks. That does not preclude using multiple windows in multiple threads. A rendering context can be made current on any thread, regardless of where the window was created. Once you're familiar with what can and can't be called from where, it's fairly easy to set something up.

I didn't write this and haven't tested it myself, but this is an example of using multiple windows in multiple threads with GLFW in C. From there, it's not hard to work out how to push events onto per-thread cues to handle as you see fit. GLFW also has an API for querying the device state per window (glfwGetKey, glfwGetMouseButton, etc). I haven't looked closely enough at LWJGL3 yet to know if they expose that or not, but if they do those functions appear to be callable from threads other than main.
4  Discussions / Miscellaneous Topics / Re: Rad Tools / Molly Rocket's Casey Muratori does game programming stunt in C on: 2014-11-17 11:48:19
/r/programming is also a good place. Usually, links I see people post here and other forums show up there first.
5  Discussions / Miscellaneous Topics / Re: The C family, should I dig deeper? on: 2014-11-14 05:26:48
Yes, learn C! I've been using it for years and despite my attraction to other languages like Java and D, I still whip up projects in C now and again to keep sharp. I've never really been able to get into C++, no matter how often I try -- I find myself dropping back to C every time.

Aside from learning what it's like a bit closer to the metal, it will also teach you to be more context-aware when you write your code. You don't have safety nets like bounds checks and GC and RAII and all these other nice memory-safety features of modern languages. You'll learn to be careful after you get tired of tracking down segfaults and access violations. However, it is *extremely* easy to write broken code in C that will never be caught during development, but will explode in the wild when someone discovers a security hole in your app. Because of that, you can only pick up so much learning how to program defensively in a passive way -- you have to actively focus on it to really be safe.

For example, you have to really remember to validate input parameters, do your own bounds checking (usually in asserts), make sure you don't allocate memory without also adding a statement in the appropriate place to free it, and so on. One small oversight and BOOM! Even after nearly two decades of C and despite all of the defensive measures I've adopted over the years, I still catch myself with a hard to find bug because I overlooked an off-by-1 error or some such and wound up stomping memory somewhere.

C can be tedious, unsafe, and often less productive than many other languages, but I will always love it.
6  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > Now on Steam! < on: 2014-11-07 12:53:40
Personally if it was me I would be doing something like release, update patch.

Indev v9.2.11 etc.

That's fine when your target audience is primarily other developers, but for the general public something without so many dots is much much more comprehensible.
7  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > GREENLIT! WOooOOOoooOooOoo! < on: 2014-10-10 07:54:59
Congratulations! I rarely throw money at games on Kickstarter or vote on Greenlight, but you've got a fantastic thing going here and I had to do both. I've seen a number of projects take root in several development communities over the years, but I can't recall ever being as eager to see one succeed as I am about this one. It's been a lot of fun watching your progress. Keep up the good work Smiley
8  Discussions / Miscellaneous Topics / Re: What other programming languages do you use & why? on: 2014-09-06 02:44:59
Regarding D, I always wondered to myself, who needs D when you can have an AOT compiler for Java?

For me, D fits in a space nicely snuggled between C++ and Java and resolves several of my gripes about both languages (and, of course, introduces a completely new set of gripes). It also has a few niceties that the other two don't which add up to be a very big deal. I'm not going evangelize it or anything, here, but I'll say that I personally feel more comfortable and have more fun programming in D than any language I've ever used.

That said, anyone deeply entrenched in Java or C++ who doesn't have the same issues I had with either language likely won't find it interesting. There are enough similarities that it's incredibly tempting to try to program like you do in the language you're most familiar with, but when you try to do so it's different enough to make the experience frustrating for anyone unwilling to adapt. Most D users I've spoken to will tell you that once you get over that hump it's a great deal of fun.
9  Discussions / Miscellaneous Topics / Re: What other programming languages do you use & why? on: 2014-09-05 15:29:42
These days most anything new I start is in D. For the past 10 years, I've been maintaining some bindings that are useful for game development (the current incarnation is DerelictOrg). I used to code heavily in both C and Java (and got paid for it for a while), but these days I only do little one-off projects with them now and again just so I don't go stale. I still enjoy them, but my involvement in the D community rather focuses my attention that way (I've been a regular lurker here for ages upon ages, though). I'm itching to do something with libgdx if I can ever make time for it.

I've used a very small handful of other languages now and again for more than just toying around, but have no time for them anymore. That said, I'm very interested in Dart and have been steadily ramping up my knowledge of its ins and outs. I have an idea for a project I'd like to do with it, but, again, time is the ever-present monkey on my back. Someone seems to keep shorting me, in ever greater increments, on my daily 24-hour allotment with each passing year.
10  Discussions / Miscellaneous Topics / Re: So many indie games in development, how many really are completed? on: 2014-09-02 08:30:55
As I see it, there's a fine line between "indie developer" and "not-quite-yet indie developer" (or, perhaps more accurately, "hobbyists who want to sell a game"). The former group includes individuals and teams who have actually released a game. If you just focus on them,  I suspect the numbers will look different.
11  Game Development / Newbie & Debugging Questions / Re: creating grid based ascii graphics for a rogue like on: 2014-05-29 13:23:34
There's also AsciiPanel. It's not a full-featured as something like libtcod, but has that old time terminal feel.
12  Discussions / Miscellaneous Topics / Re: Getting back in touch with reality on: 2014-05-28 10:41:38
A few years back, after I realized how much weight I had gained and how unhealthy my lifestyle was, I decided to never again put myself in the position where I *need* a break. Instead, when I'm not at work I stay active by walking where I need to go as often as I can (easy to do when you live in a metropolis like Seoul), exercise (ride my bike, go hiking, hit the gym), meet friends, run errands, make time for chilling with my wife, and fit my programming time into what's left. Not only am I in much better shape, but I feel more productive when I'm on the keyboard. As it turns out, once I made the changes and adapted to my new lifestyle, I actually have more time for coding than I expected to.
13  Game Development / Newbie & Debugging Questions / Re: [LWJGL] How to properly load images and use them in a JAR on: 2014-05-11 00:30:56
When loading resources (via getResource/getResourceAsStream), the resource is loaded via the ClassLoader. For the default implementation, this means the files need to be on the classpath. Whether you are running from within the IDE or from without is irrelevant -- the classpath is all that matters. Here are two things to keep in mind for this to work both inside and outside of Eclipse.

1)  Inside Eclipse, your project's 'bin' subdirectory is already on the classpath, so that's where you want your resources. An easy way to do this is to create the resource folder as a package inside Eclipse (via "New Package"). Then you can import your images into the package.

2) Outside Eclipse, make sure the jar containing your resources is in the same place as the jars containing your classes (if they aren't all in the same jar).

Given the folder (package) 'res' and the file 'res/foo.png', then getResourceAsStream("res/foo.png") should work in both cases.
14  Discussions / General Discussions / Re: Size of games written in Java. on: 2014-05-07 12:55:28
You can write games bigger than Baldur's Gate and Diablo. Write a sandbox RPG like the Elder Scrolls games, if you want. Java isn't going to prevent you from doing any of that as long as you can bring your skill set up to the challenge.
15  Discussions / General Discussions / Re: Size of games written in Java. on: 2014-05-07 12:06:10
To get right to the point,
I want to know if it's possible to write complete full-sized rpgs like Baldur's Gate and Diablo/Diablo 2 with Java.


On an unrelated note, the forum is telling me that 90% of my post consists of quotes, so I either have to remove quotes (which is rather silly in this case, since I only have one -- the question I'm answering) or write something interesting before the post will be accepted. Since my answer really needs no more information other than a simple "yes", I'm putting filler here so that the post will be accepted. I really don't understand this. Never seen such a thing on any forum in all my years of trawling the net.
16  Game Development / Newbie & Debugging Questions / Re: [IP Addresses] What IP do I use for a server? on: 2014-04-30 06:04:20
Any cheap VPS. A few bucks a year will do.

I can say many, many good things about Linode. The best being that every so often they upgrade your plan -- one or more of more bandwidth, more memory, more disk -- without increasing the price. Recently, they upgraded memory, bandwidth and converted the hard drives to SSD in a smooth and painless process. The support is top-notch also. Digital Ocean seems to be their biggest competitor right now (after Slicehost got gobbled up by Rackspace, they are no longer in the same league). They have cheaper plans and I haven't heard much bad about them, but Linode just rocks. I couldn't imagine going anywhere else for a VPS.
17  Discussions / General Discussions / Re: is finished on: 2014-04-28 05:03:00
Anyone that's been around here for awhile should know I'm a "patterns concerned harmful" kinda guy.  Why on earth do pattern-heads have to take existing techniques (usually reducing them down to a special case) and tag the word pattern at the end without bring anything new to the table?  Why I ask?

He actually talked about that in the introduction. IIRC, the GoF talked about it as well. Patterns are intended to establish a common vocabulary for people to discuss software architecture. Instead of giving a long winded description of how someone might implement something, you can just advise them to "use a flyweight implementation." I makes it much easier to hash out ideas, describe projects you've worked on, and so on. In practice, many have come to view them as cookie-cutter recipes, but that was never the intent at all.
18  Game Development / Newbie & Debugging Questions / Re: Sprite Based 3D in Java? on: 2014-03-24 09:18:12
This technique is called raycasting. Hit Google up for raycasting tutorials and you can find a lot of stuff out there. Plus, it you can find it (out of print for a while now), the book "Gardens of Imagination" by Christopher Lampton is a really good treatment of the topic. He shows a few different approaches to it.

IMO, raycasting can be a fun and interesting thing to learn, but I wouldn't spend too much time on it. Even if you're looking to make a game with that sort of retro feel to it, it's probably better to use a simple shader-based renderer with cubed geometry for the world and billboard sprites for the entities. With a little bit of matrix manipulation and the right texture filtering, you can probably get nice looking view that brings the old games to mind but looks much better than an actual raycast engine.
19  Discussions / General Discussions / Re: Family problems because of programming? on: 2014-03-10 08:23:37
I first took an interest in programming in the early 80s, when I was 9 or 10 years old. At the time, my parents didn't think I could be serious about it (I wanted to program games, of course) so couldn't really justify the expense of a new computer. We weren't very well off at all and computers were a significant expense back then. So I had no support whatsoever. I had a few opportunities now and again to bang out some very short Basic programs (at Sears or Radio Shack, or my uncle's house), but never any chance to do anything beyond that. It took a while, but that eventually killed my interest and I moved on to other things. I didn't get my first computer until I was almost 29. That rekindled the flame and I jumped into Java 1.1 right away.

I say this because I wish I only had the problem that my father thought it wasn't a manly thing to do! With computers and access to information as ubiquitous as they are these days, more young people in the industrialized world have amazing opportunities to learn things that were well beyond reach for a majority of kids in my generation. There are still a lot of place in the world where they don't, but that is shrinking every year. Whatever your father thinks of programming, at least he isn't trying to prevent you from doing it.

That said, I did have issues with my wife for a while. When we first got married, it took quite a bit of time and effort to find a balance between my programming pursuits, work and family life. Somewhere along the way, things worked out and it stopped being a major issue, but there can still be times when I'm sitting in front of the screen at 1 am and torn between getting to the root of some bug and going to bed. So I don't think conflict between programming and family ever really goes away completely -- it just changes form. As a hobby, it's really, really time consuming and demands a great deal of focus and attention, so there's always bound to be conflict of some sort.
20  Discussions / Miscellaneous Topics / Re: C++ standard library is really lacking - good or bad? on: 2014-02-27 15:27:11
For pure learning experience there's nothing really to be gained by learning C++ if you know java...they're pretty much the same.  If that's the case you should choose a language that'll teaching something new about programming.

I disagree. I think differently and design differently in both languages. Certain common C++ idioms are just not applicable in Java (and the other way, too). I think understanding both languages in enough detail to clearly appreciate the differences between them is a valuable undertaking.
21  Discussions / Miscellaneous Topics / Re: C++ standard library is really lacking - good or bad? on: 2014-02-27 04:31:12
Here are some ideas on string trimming in C++.

There's also the C++, Rust & Go rival, the D language ->
Like Dart, it also implements classes & GC very Java like!   Grin  

I've been involved with and using D in one form or another for 10 years, almost exclusively for the past couple. It's usually my first choice for any new code I write. It's hard for me to even touch C++ anymore, though I still have a soft spot for Java (I have a Java project I'm working on sporadically that I hope to finish eventually).
22  Discussions / Miscellaneous Topics / Re: Optimal size of a blog post? on: 2014-02-04 11:08:19
I'd say it depends on A) target audience and B) what you want to say and C) why you want to say it. If you can say everything you want in a way that is engaging and informative for your target audience and manage to achieve your goal in C, then you've found the optimal length.
23  Discussions / General Discussions / Re: From super skinny to normal weight, anyone ? on: 2014-01-10 04:14:39
For someone with no experience in the gym, it's a good idea to start out with a trainer. Hire a personal trainer for two or three times a week for a few months if you can afford it, consult with the on-duty trainer(s) at your gym if you can't. Much better to hire someone, as they can give you their full attention each hour and guide you every step of the way.

This is actually rather important if you want results. You could workout by yourself for a year and see very little difference, otherwise. Form is the most fundamentally important thing a trainer will teach you. Every exercise has a proper form of execution to achieve maximum result, or even any result at all in some cases. There are a number of other factors to consider as well, such as number of sets & reps for each exercise, which exercises are right for you, weight progression between sets, diet, and so much more (not to mention safety).

I know people who have gone from zero to hero without a trainer, but in my experience most people without one go nowhere. Another important factor a personal trainer can help you with is motivation. That's the key to everything. Exercise is a lifestyle. Once you get the body shape you want, you have to continue to work to keep it. Someone who has never made that commitment has a very big step to take to get there. It takes a great deal of self-discipline to do so without a trainer.

I worked with a trainer for six months when I first started out. And I'm glad I did. She taught me everything I needed to know to continue on by myself.
24  Java Game APIs & Engines / OpenGL Development / Re: Back to openGL on: 2013-12-26 05:43:03
I don't really see them as states (The VAOs). They just seem like I'm making some buffers and telling OpenGL "Hey these are by buffers and this is where they are at". Where are with a VBO I actually have to bind them and declare a usage.

Traditionally, state in OpenGL has been global. And when I say "state", I'm talking about active textures, active buffers and so on. You can only have one VBO set as each active target, like GL_ARRAY_BUFFER and GL_ELEMENT_BUFFER, at any given time. So when using multiple buffers, you change the state for each target every time you need to render a different buffer. That means multiple calls to change state, which can become expensive.

VAOs allow you to make multiple state changes with one call. You associate a number of related VBOs (such as a vertex buffer and an index buffer) and their state with a VAO, then when its time to render you only activate the VAO. That way, you don't need to make multiple calls to set up the state of each VBO target. The best way to understand it is to avoid thinking of a VAO as an object (vertex array object is a horribly confusing name). Think of it more as a marker, or in index into an array of states.

It is possible to create a buffer that is a object and not primitive?
So I could do something like
class Vertex
    float x, y; z;
    float c1, c2, c3;

In C or C++, you could do this. The memory layout of a struct (or C++ class) declared like your Vertex class would be the same as that of an array of six floats. So you could use an array of Vertex objects and call glVertexAttribPointer to set up the offsets for each attribute. Then you would wind up with what they call "interleaved buffers". In Java, you could declare a vertex class like this, but because of the nature of the OpenGL bindings like LWJGL, you still would have to fill a ByteBuffer with the individual values. You wouldn't be able to pass the object directly to OpenGL.
25  Discussions / General Discussions / Re: Did you ever cut corners to solve a problem? on: 2013-12-09 03:45:09
I used the GOTO function, which isn't at all recommended, and can cause some issues in large programs.

Actually, not really. The evil reputation goto has comes from the old days when you could use it to jump to any point at all in the program. That tremendously increases the cost of maintenance, because any time you edit a section of code you need to be extra careful about updating or removing any gotos if you need to. This was especially true in languages like BASIC and FORTRAN, where you used line numbers to branch around:

10 PRINT "Hello World"
20 GOTO 10

In C and C++, this is no longer an issue. The goto statement (it's not a function) is restricted to the current function scope. You can't jump to arbitrary locations in the program. And, you have to use named labels, so modifying code doesn't modify the point you jump to as it does when line numbers are the target. A common idiom in C, where there are no exceptions, is to use goto for error handling in cases where it makes sense. For example, imagine this totally contrived hypothetical function:

foo* create_foo( int x ) {
    foo* foo = create_foo();
    if( !foo ) goto FAILURE;

    if( !do_something_with_foo( foo ))
        goto FAILURE;

    if( !do_something_else_with_foo( foo ))
        goto FAILURE;

    return foo;

    log_error( "Failed to create foo." );
    if( foo ) deallocate_foo( foo );
    return 0;

I've done a lot of C over the years and have used this idiom often, particularly in resource loaders. It's a very useful, and very safe, idiom. The evil reputation, which was rooted in real issues, does not apply in modern languages, but still lingers. Much like the Java performance myth.

That said, using goto for loops certainly is considered abuse!
26  Game Development / Newbie & Debugging Questions / Re: LWJGL game works fine in eclipse, but doesn't when exported on: 2013-12-08 09:48:41
Hmm.. I didn't exactly understand what you said. I just started LWJGL programming day before yesterday, so I don't know much.

This has nothing to do with LWJGL. It's about loading resources in Java.

What is resourceAPI?

I'm talking about the getResourceAsStream method and it's companion getResource.

Can you link me to a tutorial about it?

Ask Google. This is basic Java stuff here, so there should be a plethora of information about it out there. I don't know what's good and what's not, though, these days.

And by class path, what do you mean?

This is where the JVM looks to find the Java classes needed to run your program. Again, basic Java knowledge that a good java tutorial or book can tell you about. Ask Google.

Did this, and now it doesn't work even in eclipse.

You need to configure things properly for it to work in eclipse.

I strongly suggest you go out and read up on class paths and how to load Java resources, else all the advice you get here is just going to keep leading to issues you don't know how to solve. A couple of good tutorials should help you figure it all out.
27  Game Development / Newbie & Debugging Questions / Re: LWJGL game works fine in eclipse, but doesn't when exported on: 2013-12-08 09:07:07
Bundle your resources in a jar file, put that on the class path along with the other jars you use, then use the resource API to get at them rather than loading directly from the file system. They don't actually have to be in a jar, but it simplifies distribution. Search these forums for getResourceAsStream and you should find a number of posts about it. Or look to Google, where you can also find advice on how to set things up in Eclipse so that this approach works the same way in the IDE and out.

With your current approach, you're trying to load relative to the current working directory. In the IDE, that's easy. Outside, it can be literally anything. Going through the resourceAPI can mask all that.
28  Game Development / Newbie & Debugging Questions / Re: Need Advice - Learning OpenGl - This Book + LWJGL ? on: 2013-12-06 10:35:39
The 6th edition of the Superbible drops the framework from the 5th edition and jumps into shaders from the get go. There's still some helper code, but that's to be expected.

That said, I've never understood the criticism about the 5th edition. The author actually teaches OpenGL in workshops. With mondern GL, he found the most effective approach was to ease people into it by starting out teaching the principles through the framework then, once they "get it", moving on to the nitty gritty details. He took that approach in the 5th edition, which was the first version to drop the legacy stuff. All the complaints about the 5th edition completely ignore the fact that he goes into the details on shaders and such starting in chapter 6. It's as if they looked at the first two or three chapters, got frustrated with seeing framework code everywhere, and went to the internet to bitch about it. Then people who've never even read it are out there saying that it teaches the author's framework and not OpenGL, which is completely untrue. And so a pretty decent book gets relegated to the dustbin.

Anyway, the 6th edition seems to have satisfied most people. IMO, it's one of the better books out there to start from the beginning with.
29  Game Development / Networking & Multiplayer / Re: Looking for cheap server space on: 2013-11-09 05:49:32
Digital Ocean or Linode would be good options for virtual servers. I've used Linode in the past and love them. Their support is top notch, plus they have a plethora of resources on the site that can help you with maintenance. DO is rather new and has some cheaper plans. I've heard good things about them, though.
30  Discussions / General Discussions / Re: Your feeling on discovering that your game is uncannily similar to another game? on: 2013-08-07 11:36:36
Finding out about game X is actually an unforeseen blessing. I would try to get a copy of it and play the hell out of it for a few days. I'd note what works and what doesn't and see if I'm on the right track. I'd figure out how to improve upon it and incorporate those ideas into my game. There's no way I'd start over or give it up. I'd do my best to use it to enhance what I've got.
Pages: [1] 2 3 ... 8

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

The first screenshot will be displayed as a thumbnail.

Olo (8 views)
2015-01-25 18:44:22

Robo11 (19 views)
2015-01-25 06:14:26

basil_ (26 views)
2015-01-17 22:29:32

wxwsk8er (24 views)
2015-01-16 21:42:21

wxwsk8er (20 views)
2015-01-16 20:44:20

basil_ (25 views)
2015-01-14 09:46:59

basil_ (21 views)
2015-01-14 09:46:52

wxwsk8er (32 views)
2015-01-13 20:42:16

wxwsk8er (34 views)
2015-01-13 03:23:59

vctt (55 views)
2015-01-12 03:21:07
2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

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 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!