Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (707)
Games in Android Showcase (208)
games submitted by our members
Games in WIP (781)
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 ... 9
1  Game Development / Newbie & Debugging Questions / Re: How to set up an LWJGL project on: 2017-01-17 08:55:02
You've already got the answer, but I'd just like to expand on it a bit for clarity.

After some investigation I have found that I need to point the project to the location of the native files using the "Djava.library.path" argument in the "Run Configuration" screen. I have tried setting this argument to my project's "lib" folder containing the library JAR files, but this did not work.

The java.library.path is what you use when you are working directly with native shared libraries (such as glfw3.dll on Windows, or on Linux/*BSD, or glfw3.dylib on OS X) directly. It is *not* for jar files.

I also noticed that the LWJGL Wiki provides the following information:

"The LWJGL native shared libraries do NOT need to be extracted from their .jar files. The SharedLibraryLoader that is included with LWJGL does it automatically at runtime."

..but I do not know how to use the SharedLibraryLoader, or what it really is for that matter..

You don't have to worry about SharedLibraryLoader. Read again what you quoted: "LWJGL native shared libraries do NOT need to be extracted from their .jar files" and "LWJGL does it automatically at runtime."

The native libraries you need are bundled up with the LWJGL distribution in jar files. At runtime, LWJGL extracts them from the jars and loads them into your process. LWJGL is using Java resource streams to load the jar files and extract the libraries (via its SharedLibraryLoader class, which again, you don't have to worry about), so like any other bundled resource jars, they need to be on the classpath.
2  Discussions / Miscellaneous Topics / Re: Looking for simple but complete open-source game on: 2016-11-23 02:44:27
Your machine probably only has the crappy Microsoft GDI Renderer as unique OpenGL driver

Actually, and this has been true for quite sometime now the, default OpenGL implementation is built on top of Direct3D. Still a crappy implementation, but not as bad as the old days.
3  Game Development / Newbie & Debugging Questions / Re: [LWJGL] 3 - Working with contexts on: 2016-10-27 13:28:07
What you say does dictate 2 contexts then, yes? One for showing and one for operating on. What is the appropriate procedure for that? Kill first window and make new window?

You can conceptualize an OpenGL context as a data structure deep in the OS/driver layer that maintains information about the currently available OpenGL capabilities. When you create a window through GLFW, it uses the system APIs to set up the OpenGL context, specifying which version of OpenGL is desired, how big the depth buffer should be (if any), whether to allow deprecated functions, and so on. If it helps, think of it as an interface, GLContext, with multiple implementations, one of which is created and associated with your window (conceptually it's the same, anyway). That context is associated with your window and only your window and will remain associated with that window until it is destroyed. There is only ever one OpenGL context per window.

EDIT: I should add that this is what allows OpenGL to draw to your window. Without an OpenGL context, a window is rendered to using whatever the default mechanism is on the host system, be it GDI, Direct3D, Metal, or whatever. The concept of the context is the mechanism that allows the OpenGL API a means of integration with a variety of window managers across multiple systems. The details of creating and managing the context are system-specific, but the principles behind it remain the same.

From the driver's perspective, only one OpenGL context can be "active" on a thread at any given time. So when you call glfwMakeCurrent, you are making your context the active context for the current thread. That means that all OpenGL calls on that thread will be through that particular context. If you have two windows, you can draw to them on the same thread first calling glfwMakeCurrent on one window's context, then on the other's. Moreover, a single context should never be active from multiple threads at the same time. If your context is active in thread1 and you want to draw through it in thread2, then you need to first disable it in thread1.
4  Game Development / Newbie & Debugging Questions / Re: Point changing for some reason on: 2016-09-28 04:28:06
I can't count the number of times I've seen this discussion in different forums, complete with the line that's bound to confuse any newcomer (references in Java are passed by value). It's a confusing and roundabout way of saying that Java classes are 'reference types', built-in types are 'value types', and function arguments are 'passed by value'. The nature of the types needs to be distinguished from the nature of how the instances are handed off in function calls.
5  Game Development / Game Mechanics / Re: Storing a 2d topdown map as integer or float matrix on: 2016-06-13 03:45:50
Collision detection should happen in world coordinates. It's up to you to decide if you want to allow multiple entities per tile or not.

Look, you aren't going to learn every detail you need about implementing tile maps from people answering your questions in forum posts. I suggest you hit google up for some tile map tutorials. There are a great many of them out there. Read as many as you need to until you understand the principles behind them (whether they use Java or C or something else) and can adapt them to your own project. Then, when you actually encounter specific problems during the implementation, come here and ask for help.
6  Game Development / Game Mechanics / Re: Storing a 2d topdown map as integer or float matrix on: 2016-06-12 17:03:27
An entity's *position* is never between two tiles. It is either in a tile, or it isn't. Graphically it can be, of course. You have to decide what a position represents for your entity sprites. Is it the top left corner or bottom row? The center pixel? Some arbitrary point that is set in a tool and loaded from a file? Working with a corner or a center pixel is probably easiest.

It doesn't make much sense to use world coordinates for A*. The map data is an array, you need to deal with elements of that array for your algorithm, so you use array indices. Convert the world coordinates of the entity to an array index to get the starting tile, convert the world coordinates of the destination to an array index to get the target tile, and run your A*.
7  Game Development / Game Mechanics / Re: Storing a 2d topdown map as integer or float matrix on: 2016-06-12 14:11:01
What you use to store the tile data has no bearing on how you represent screen and world coordinates. You can work in three coordinate systems with your tile map. Assuming as an example a 10x10 map of 32x32 tiles:

* world coordinates extend from (0,0) to (319, 319)
* tile coordiantes (inside an individual tile) extend from (0,0) to (31,31)
* array coordinates, representing the index into the tile array. Assuming a one dimensional array, these extend from [0 .. 99].

Given world coordinates, you can work out which index to look for in the array like so:

int x = worldX / tileWidth;
int y = worldY / tileHeight;

Then you can pick your tile in a one dimensional array like:
tiles[x + (y * mapWidth)];

Or in a 2D array with:


To get from world coordinates to tile coordinates:

auto tileX = worldX % tileWidth;
auto tileY = worldY % tileHeight;

Store your entity coordinates as world coordinates, not array coordinates. Then you can move as many pixels as you need.
8  Java Game APIs & Engines / OpenGL Development / Re: Mutithreaded LWJGL - Works... Sometimes on: 2016-05-01 11:19:35
I was primarily using the Countdown latch to wait for the threads to finish closing before closing the main one, but it seems like the executor service does this for me...

If the main thread deals with the window/input events what will happen if I add a glfw key callback to the child threads? Will they still be called back, or do I have to track which window is focused myself?

I recommend you look at the GLFW documentation. For each function, it gives you all the relevant info you need on thread safety. For example, from the docs for glfwCreateWindow:
This function may not be called from a callback.
Thread Safety
This function may only be called from the main thread.
9  Discussions / Miscellaneous Topics / Re: The "impressiveness" of games on: 2016-04-12 14:47:56
There's always a core audience that prioritize fun, for some definition of "fun", over eye candy. The penultimate example is perhaps the loyal Dwarf Fortress player base. Players are so passionate about that game they donate money. If game making is what you're after, make the games you want to play and then do what you can to connect with like-minded players. They're out there if you can find them (and you follow through with the implementation).

There's only so much time in a day, so many days in a year, and so many years in a life. Decide what it is you want to pursue and put your energy into it. Otherwise you're just treading water and wasting time.
10  Game Development / Newbie & Debugging Questions / Re: 24bit vs 32bit ColorModel performance on: 2016-03-09 06:37:26
I've read around and people say that 32 bit is faster because the processors are able to handle 32 bit numbers faster than 24 bit ones,

That's a bit of a misleading way to look at it, though. It's not 24-bit vs 32-bit *numbers* you should be thinking about, but data types. And unless there is some darkened corner of Java I'm oblivious to, there's no 24-bit data types to worry about. If the color values weren't stored in 32-bit integers, then they'd have to be separated into 3 8-bit values or 1 16-bit and 1 8-bit (which would just be weird). A 24-bit RGB in a 32-bit data type (int) is just an RGBA value whos alpha component is ignored.

The argument holds true to some extent for lesser bit depths, though. A 16-bit color value would be more efficiently manipulated in the native word size (32-bit or 64-bit) than as a short.

and also I read that not using the 8 bits at the end of the 24 bits (because modern registers are 32 bit) is a waste of memory.

Which in practice is really no concern. It's not like you have much of a choice for 24-bit color values, though. Either you use a tightly-packed array of bytes where each byte represents one component of an RGB triplet, or you use an array of ints where each int represents a full 24-bit color value with 8-bits unused. There are performance vs. memory implications for both approaches, but I don't see that either would be statistically relevant in any but the most extreme circumstances (such as a heavily resource constrained system -- in which case, what the hell are you running a JVM for in the first place?). If I were implementing a graphics package myself, I'd would certainly use int to represent 24-bit color values unless I knew the more common use case would be in implementing individual color components rather than full color values.
11  Game Development / Game Mechanics / Re: Updated translate? (Extended Convo) on: 2015-07-17 02:49:08
You really need to get a grasp on the fundamentals of what is going on when you call glLoadIdentity and glTranslatef. Here's a link that might help get you there:

Google "OpenGL modelview matrix" for more stuff. Understanding how this works is rather important in putting your own renderer together.
12  Discussions / General Discussions / Re: English proof-reading service? on: 2015-07-07 01:36:36
I've been teaching English in Korea for years and do proof-reading on the side. Doctoral dissertations, business papers, medical journal articles... a wide range of stuff. If you're interested, PM me with some info on what it is you need reviewed (word count, particularly) so I can get an idea of how long it would take me to do it. If it's relatively short, I'd be happy to do it for free, but anything that's going to take a chunk of time I'll have to charge you for. I have very little free time these days. I charge reasonable rates though (which is why my students and their friends prefer to pay me to review their stuff rather than a professional service).
13  Discussions / General Discussions / Re: Contacted by a publisher to be a technical reviewer on: 2015-05-12 06:41:32
KevinWorkman seems to have misunderstood what a technical reviewer is Smiley

Several years ago I coauthored "Learn to Tango with D" for APress and am currently working on a D book for PACKT. A few points from my experience.

* The primary role of a technical reviewer is to look over the preliminary draft of each chapter and comment on any coding errors, erroneous descriptions, or any other mistakes related to the technology being covered. They're also free to make suggestions on how to improve the text.

* The author may make recommendations for technical reviewers. I gave PACKT a short list of six guys I know from the D community who are highly knowledgeable in different areas. I don't know how many people they contacted, but currently I have four technical reviewers, all of them from my shortlist. These guys are professionals who know their stuff.

* AFAIK, it's typical for the publisher to offer books and discounts on purchases of their books. It's not just PACKT -- APress did the same. It may be possible to negotiate a cash payment, but don't hold your breath.

* In working as a technical reviewer, you are then on the publisher's contact list. That could lead to further, potentially paying, offers in the future. I've read on blogs how some tech book authors got book offers after having worked as a TR.
14  Discussions / General Discussions / Re: What's your day job? on: 2015-02-18 14:08:14
I've been teaching English in Seoul, Korea in a variety of forms for 21 years (which I suppose makes me incompetent at English). These days I run my own hot dog shop in central Seoul, teach a handful of one-on-one private English lessons at a nice hourly rate, and divide the rest of my time between hacking away on throw-away games & web apps and watching VOD movies with my wife.
15  Game Development / Game Play & Game Design / Re: How to be a more creative writer? on: 2015-02-09 14:35:29
The only way to become a better writer is to write, write, write. Write short stories. Participate in NaNoWriMo. Learn about the different approaches used to craft a story, such as the Hero's Journey (aka the Monomyth). I mention that one specifically because I think it's a great method to use for crafting a story for an RPG.

Ultimately, you have to expend effort to improve at something, no matter what it is. We work our way through Pong and Asteroids clones and text-based adventures and voxel engines to reach the Holy Grail, the games we really want to make, because we can't make the games we really want to make until we know everything we need to know to make them. Writing is the same, whether your goal is to write a novel or the story for a deep RPG. Until you've got the experience under your belt to craft that story without making novice mistakes, you aren't going to achieve your Holy Grail.

Toward the end of killing two birds with one stone, I would advise the following approach. Put your big text-based RPG on the back burner for a bit. Instead, do a little bit of research about how to write short stories, then write two or three. Keep them small and simple. Pick the one you like best and adapt it to a text-based game. Then do it again. And again. Write two or three stories on each iteration -- never just one. Assuming you keep the scope of both the stories and the games small enough, then by the end of the year you'll have several stories and a handful of complete text games under your belt. Then you'll be better equipped for a bigger one.
16  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.
17  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.
18  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.
19  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.
20  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.
21  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.
22  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > Now on Steam! < 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
23  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.
24  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.
25  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.
26  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.
27  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.
28  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.
29  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.
30  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.
Pages: [1] 2 3 ... 9
Galdo (403 views)
2017-01-12 13:44:09

Archive (558 views)
2017-01-02 05:31:41

0AndrewShepherd0 (1031 views)
2016-12-16 03:58:39

0AndrewShepherd0 (955 views)
2016-12-15 21:50:57

Lunch (1087 views)
2016-12-06 16:01:40

ral0r2 (1320 views)
2016-11-23 16:08:26

ClaasJG (1416 views)
2016-11-10 17:36:32

CoffeeChemist (1407 views)
2016-11-05 00:46:53

jay4842 (1492 views)
2016-11-01 19:04:52

theagentd (1250 views)
2016-10-24 17:51:53
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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!