Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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 / Artificial Intelligence / Re: AI path finding on non tile based game? on: 2014-03-25 10:05:34
Hi, FewCode, are you still working on this? I have a working solution for almost exactly this situation.

I don't use tiles. I use nodes which are generally located around the corners of the walls. I found this to work nicely and avoid the issue your image shows with the odd paths.

I assume by now you are familiar with implementing the A* algorithm, given that image and the content of your last posts.

Basically, in my system, the world has positive space (can be traveled through, like your gray areas) and negative space (can not be traveled through, like your walls).
The nodes are generated as follows:
  • For each positive space, generate nodes near the corners, and on the inside of the positive space.
  • For each negative space, generate nodes near the corners, and on the outside of the negative space.
  • If a node ends up being too close to any negative space (or in it), ignore it during the pathfinding process, or delete it. (the closeness is an issue if you don't allow your characters to intersect negative spaces at all)
  • Generate a beginning node for the character's current position, and a destination node for the destination.

I use rectangles for negative and positive spaces, but I think as long as the spaces are convex polygons (such as a rectangle), the system stays reasonably simple.

On a side note, my characters are strictly not permitted to intersect any negative space, which brings up an issue of how far away nodes should be from the corners (vertices) of positive and negative spaces. I have a policy in place that addresses this, but this may be irrelevant for you, so I'll refrain from describing it in this post.

Let me know if you have any questions or interest in knowing more about the solution I use. By the way, I am curious if you allow your characters to rotate and translate freely, given your system is not tile-based.

2  Discussions / Miscellaneous Topics / Re: Excellent Reddit Post on /r/gamedev On Staying With Your Projects on: 2013-11-25 05:18:38
 
Quote
It's all about getting time management and not getting distracted spending days on something that wont add significantly to the game.

This is one of the most important lines from his development blog.
3  Games Center / WIP games, tools & toy projects / Re: UX2Engine - 2D Game Engine on: 2013-11-08 05:10:07
Quote
I also like the java2D support even though it is basically useless.

It's fine for having a debug renderer while you do main logic development, waiting to do the real renderer last. To each his own, I guess.

I like those sprites! I'm sure the game engine is great, too  Smiley
4  Java Game APIs & Engines / Engines, Libraries and Tools / Your opinions on Java Topology Suite, JavaGeom, and GeoRegression? on: 2013-10-04 05:27:57
What's your opinion of such 2D geometry libraries as Java Topology Suite, JavaGeom, and GeoRegression for performance-oriented games?
Which one performed the best for you?

Years ago, I made a floating point Polygon class that wraps Path2D. I made methods similar to those in java.awt.Polygon. I'm mostly happy with it, but the profiler tells me it ain't that fast, even though I use the Separating Axis Theorem and fail-fast bounding box checks for intersects(), and object pooling to a fair extent. I suspect Java standard library object methods perform heap allocations liberally under the covers, but I haven't had time to investigate if this is true.

Is using standard Java library objects for geometry processing the worst choice for performance?

5  Java Game APIs & Engines / Java 2D / Re: Basic 2D math problem on: 2012-02-17 11:14:14
For panning, it's easy. Take the pixel's position in the rectangle which draws the image, then subtract the x and y offsets for panning.

For example, if panning x is 25 (moved to the right) and panning y is -10 (moved up), and you click in the rectangle which draws the image on point [2, 85], then you clicked on [ 2 - 25, 85 - (-10) ] or [-23, 95] in the original image.

For zoom, it gets more complicated. I am at work now, but when I get a chance will post my method.
6  Game Development / Newbie & Debugging Questions / Re: How to make a menu??? on: 2012-01-30 05:19:29
I'm not familiar with the mega man game, so I have no advice on how to make that menu.

However, with a "demo", like ReBirth said, you make the game have states.

One state would be the menu--it listens for user input, and if no input is received in a certain time limit, the state changes to the play demo state.

play demo state: plays the game normally, but with a script or AI or something to control the player's character. If any user input or timeout, change state to menu state.

Of course, this all implies there are two states for game play: normal, where the user controls the character, and demo, where the computer controls the character. So, you can use the same code for gameplay and demo states, but have player/computer control character controlled by what state the program is in.
7  Java Game APIs & Engines / Tools Discussion / Re: Proguard GUI - don't obfuscate 1 class on: 2012-01-30 05:04:17
Uh, what software are you using?

[edit: oops, reading fail--Proguard GUI it is]
8  Discussions / Miscellaneous Topics / Re: reuse & economics on: 2011-12-12 09:47:02
Quote
...the xkcd comic says, "you will never find a programming language that frees you from the burden of clarifying your own ideas."

This made me smile and exclaim a bit, too. It has a lot of truth to it. I'm spending a lot of time on coding my game to follow a design that is not available on any shelf. Some of my peers question my choice of Java, and the flat out truth is: Java ain't holding me back--I am. It's my ideas and how well I can specify them in code. The language/libraries aren't the enemy. The enemy is me! (Wow, I sound a bit disturbed)  Smiley

However, I did find myself rolling code for Separating Axis Theorem inspired polygon intersection detection, Monotone Chain (forgot its name exactly) to get a poly from a cloud of points, point of intersection of 2 line segments, and other stuff. Either these functions are not provided by the Java standard library, or had some issues which were unacceptable. One of the big reasons I went with Java for my game is I was impressed with the functionality of the java.awt.geom package (at first), then found out I had to write a lot of my own stuff for things they didn't include.

Why wouldn't there be a floating point 2D polygon class with all the goodies? I had to make my own on top of Path2D, plus extra methods awt.Polygon didn't have.

So, yeah, in my experience, I can sympathize with Cox each time I need to hunt for algorithms on Google or roll my own, but, yeah, as Sproingie said, only trivial (read for games: boring) software can be made from purely using what's out there. Buy the Unreal Engine, and you can make a handsome clone of Unreal... put some creativity and your own home-made code in, and you could have a hot new game!
9  Discussions / General Discussions / Re: Still hardly any games, why entity systems suck, and why 4k is good on: 2011-11-17 13:25:05
Cas,

Quote
What's the point in saying, "don't bother with Java! Problem solved!" to people using java-gaming.org as a resource? It's ridiculous.

That's absolutely true, it's ridiculous.

I realize there are benefits if more programmers build games with Java: we, as a collective, learn more through the shared experiences of our members. Also, it sends a message to those that could augment our palette of software tools and provide new platforms--the message being Java is a good technology and deserves to be improved, refined, and ubiquitous. This direction helps not only Java, but all of us that use it.

Now that I've done so much legwork, I could make a simple game in Java as quickly as I could in Flash. The thing is, I am not interested in making Chess or Mario Bros.

I hope programmers will come to JGO as I did and get up to speed such that Java is as an attractive an option, if not more, than Flash.
I'm not going to bash Flash  Cheesy It does what it does well. I used to make cartoons in Flash. At the time, I thought ActionScript was lame, but making animation and graphics, adding sounds and effects, all in one place was tremendous.

That's why the Flash guys can do it so quickly. They can't practically do wizardry with AI and diverse data acrobatics nor take advantage of the powerful functionality of libraries such as Java has. However, they can whip up graphics, animations, and pop in sounds and music ridiculously easily. They're constrained to some basic math and logic that govern a relatively rich video and audio experience. Fast and fast.

I sure as hell wouldn't want to do a 2D GTA, Rage or The Sims in Flash though.

 Grin Okay, I'll STFU now about Flash. For the record, Java is great and can do anything Flash can. There are reasons I chose Java over C/C++/Python/Flash/etc. for my game creation needs.

Jack_E, make games for your friends  Cool You'll get feedback, and they may even help you think of cool things that could be in the game you didn't. I love getting intoxicated with my friends and writing down the most outlandish features and things I could put into my game. Some of them even make it in!
10  Discussions / General Discussions / Re: Still hardly any games, why entity systems suck, and why 4k is good on: 2011-11-17 10:05:13
Sorry to disagree, but regardless of what this site is called and how much I like Java, it's a means to an end, and it's not suitable for every possible destination.

There is no shame in using or recommending other languages for purposes they are better suited for. I mean, why force square pegs into round holes? Square peg zealotry?

Java's great and quite versatile, don't get me wrong, but you don't need the modular hydraulic pump when a straw will do fine.  Wink
11  Discussions / General Discussions / Re: Things I'd like to see in the language on: 2011-11-17 05:07:08
Stack allocated objects for use only in current scope (not the JVM maybe doing escape analysis). I did a contortion act with static, pooled, reusable objects in frequently-called methods in a library I wrote. Heap friendly, but unsafe for multiple threads, unless synchronized, which ruins performance gains.

Multiple inheritance. I've heard the arguments before, but, sometimes, mixing in multiple interfaces just has me writing duplicate code.
Maybe allow multiple inheritance if no two parent classes have concrete public/protected methods with the same signature?
12  Discussions / General Discussions / Re: Still hardly any games, why entity systems suck, and why 4k is good on: 2011-11-17 02:53:40
Dear Cas,

First of all, thanks for writing a post that stirs me enough to repsond. This is the second part of the post I had made yesterday.

I guess there are different types of people who come to JGO. I speculate that, in the vast minority, there are those who write Java games and release them, and perhaps make a bit of coin. Then there's the majority.

Most of us won't make a game or finish. This is not news to you, of course, but I feel some discussion about this is good.
Perhaps a large slice of the JGO majority doesn't have a clear idea about what game they want to make. So, why would they be trying to make a game, or at least talk about doing so? Games are cool, man. They want to program something... anything... and a "game" would be fun. Later, they find out, whoa, a game turns out to be not trivial, especially when you need to learn to rotate images in place, put objects in a map created from a file, etc. in Java's way.

Most people aren't persistent. A home cooked meal would have been most satisfying, but, eh, fast food was just around the corner and what's a little indigestion, anyways?

The other slice of the JGO majority have a clear and mature idea about a game they want to make. So, where's their games?
I don't know  Tongue
Mine is enduring code re-writes to better satisfy my vision. I'm thoroughly testing and fixing features.
I'd rather release it later and good, than early and compromised to the point of being a disappointment.

This is JGO. We all know (or should) that coding is necessary to climb the mountain towards a completed game. Some things we find out along the way are:
- wow, it's time-consuming and difficult, so I will quietly abort
- wow, I have a non-trivial game idea, and, yes, I will need to engineer some code solutions to make it come to life
- my wife and friends hate me now, why can't they just wait until the game is done, then they will love it, and by extension, me, and I will be redeemed  Kiss

I read some of the earlier replies... amused to see some people want the game and secretly resent the coding, others love to whip and tame the code and don't think much about a completed game. Unfortunately, I am kind of both: I enjoy firing up Netbeans after work and on the weekends and I design what the game will be on paper when my brain bears such fruit.

Final point, and thanks for reading so far...
I have to sort of eat my words about Flash games. If you have a game idea simple enough to do in Flash, then do it in Flash. Don't use Java, don't use even C. Flash will get you to your goal more quickly and painlessly. It would be the right tool for the job. You wouldn't use a modular hydraulic pump to drink when a straw would do, right?

You do need the modular hydraulic pump sometimes, though. I am making a not simple game, and Java has been flexible enough to meet virtually all of my game's needs. I sure as hell would not use Java to make a pinball game, though... I would have quit halfway through the Java2D tutorial  persecutioncomplex
13  Discussions / General Discussions / Re: Still hardly any games, why entity systems suck, and why 4k is good on: 2011-11-16 09:59:12
Cas,

No, Java gaming never really took off. It was never supposed to, if you look at what Sun/Oracle has been doing with Java. OpenGL support had to be created by the community, rather than enabled by the JVM. I guess they didn't want to have headaches with drivers which they can't control. There's other issues as well, but my point is the Java creators/stewards had an idea of what Java should be, and it isn't really for games. More like business apps or whatever. All that said, we can make pretty cool games with Java.

From the perspective of a game player, there is no concern for what language/tools were employed. The experience is all that matters, including deployment. If the game is compelling enough, players will manually install JVMs and learn command line syntax; they tweak .ini files for Elder Scrolls, right? The game must be compelling, or at least popular enough to overcome the hurdle of somewhat-involved deployment. The task for us is to make games compelling and many of them. Oh, and on Flash games, which instantly get played in your browser... they still get played, despite they're mostly so simple and sort of lame. Easy as lighting up a cigarette, and about as rewarding, too.

(Quitting time at work, got to meet someone soon, will finish this post later if I remember)
14  Discussions / General Discussions / Re: Finishing is hard. on: 2011-10-04 15:03:30
theagentd,

I don't mean to hijack this thread, but, to elaborate, when you're in jail, your mind is your only playground.

I wasn't in jail for computer-related crime, just possession of a laughably small amount of a derivative of a certain popular plant.

We were not allowed to keep anything written while incarcerated after release because the authorities believed we would create and maintain criminal contacts with former cellmates. I had no access to a computer, but used paper and pen to map out rendering algorithms and geometry processing procedures. I had so much time, I even debugged them in my head.

Seriously, look at all of us. Jail, parenthood, employment, poverty, social pressure to be mere consumers, math ineptitude... we persevere!

It's what we do!  Cool
15  Discussions / General Discussions / Re: Using GWT to go from Java to Java Script on: 2011-10-04 06:07:59
 Cheesy Very cute, Kev.

I did a project at work with GWT, CRUD app.. I was surprised you can do animations and stuff with GWT. It's pretty cool if you don't mind getting your hands dirty and testing a bunch of features.

How much of this is running client-side and how much server-side? I guess you just load media assets from the server in the beginning and the game basically runs totally client-side?
16  Game Development / Game Mechanics / Re: Lighting and generating random objects. on: 2011-10-04 05:57:10
Quote
Additionally, I want to be able to create random objects

There is more than one way to do this.

If all the Weapon children classes have default constructors, you could... (warning: quick, dirty, untested code example)

make a white list of Weapons that could be spawned in a treasure chest:
1  
final Class[] classesOfWeaponsThatCouldSpawnInA_TreasureChest = { Axe.class, Longsword.class, Quaterstaff.class };


Then, when the environment loads, for each treasure chest:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
import java.lang.reflect.*;

// the following code should be called for each treasure chest

final int capacityOfChest = 3; // this should probably be defined in treasure chest's class definition

// randomly choose how many Weapons to spawn in this treaure chest
final int numberOfWeaponsToSpawn = (int)Math.rint( Math.random() * (double)capacityOfChest );

for( int i = 0; i < numberOfWeaponsToSpawn; ++i )
{
    // randomly choose which kind of Weapon to spawn
   final int classIndex = (int)( Math.random() * (double)classesOfWeaponsThatCouldSpawnInA_TreasureChest.length );

    Class weaponClassToSpawn = classesOfWeaponsThatCouldSpawnInA_TreasureChest[ classIndex ];

    // cast to Weapon because newInstance() returns type Object, and we assume addItem() requires Item or subclass instance
   treaureChestInstance.addItem( (Weapon)weaponClassToSpawn.getConstructor().newInstance() );
}
17  Discussions / General Discussions / Re: Finishing is hard. on: 2011-10-04 05:24:49
Quote
The thing is, this shit is my dream, and I don't give a f**k if it's irrational, and am not doing it for anything other than satisfying myself

This is all that matters. Why are you so apologetic? Being bull-headed and driven is the only way to success in this adventure. You're enjoying what you do, but too concerned with the results. You said it yourself--you enjoy working on this stuff. Always design with the goal in mind, but don't get fixated on how much/how well it's done at any given time. Why? It will always get better. You will make it better--that's what you do! The only failure is giving up.

Who's telling this to you? Another early 30's guy who has ideas for a game he wants to make, doesn't give a shit if it's popular or commercially viable and has gone through lots of re-writes, re-designs, etc. and will go through more, without a doubt.

I write software for casino machines in the day, mostly using C++, and, in my free time work on a game in Java. The same game I have been working on as a free time project for the last 6 years. I've been affected by changing jobs, being in jail (smuggled out algorithms on paper, heh), design flaws that became apparent after months of development and temporary burnout, but I'm still doing this damned thing, even if it kills me.

We are so lucky to have such powerful machines, free development languages/tools, and the internet. The top tier game developers are so mired in marketing, recycling the same damn games year after year, paranoid about recouping their costs. Hollywood syndrome. It's up to us independents to make new, interesting and unique game experiences!
18  Java Game APIs & Engines / JOGL Development / Re: What's wrong with this .PNG loader? (32 bit with alpha) on: 2006-01-28 07:54:17
Thanks, Schabby!  Smiley

Yes, disabling GL_TEXTURE_2D before rendering polygons without textures made such polygons remain visible.  Smiley

Also, I used the texture maker code which forces the img.getType() == BufferedImage.TYPE_4BYTE_ABGR branch.
Why img.getType() isn't detecting the right image type is a different issue.

Thanks for the heads up on com.sun.opengl.util.texture package. I assume this requires JSR-231 JOGL? I will experiment with it later.
19  Java Game APIs & Engines / JOGL Development / What's wrong with this .PNG loader? (32 bit with alpha) on: 2006-01-27 07:25:52
So, I am using this code from a JOGL piece from NeHe's site to load a 32 bit .PNG file with alpha:

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  
public static void makeRGBTexture(GL gl, GLU glu, [i]BufferedImage img[/i], int target, boolean mipmapped)
       {
                      ByteBuffer dest = null;
                      switch (img.getType())
                      {
                                case BufferedImage.TYPE_3BYTE_BGR:
                                case BufferedImage.TYPE_4BYTE_ABGR:
                                case BufferedImage.TYPE_CUSTOM:
                                {
                                  byte[] data = ((DataBufferByte) img.getRaster().getDataBuffer()).getData();
                                  dest = ByteBuffer.allocateDirect(data.length);
                                  dest.order(ByteOrder.nativeOrder());
                                  dest.put(data, 0, data.length);
                                  break;
                                }
                                case BufferedImage.TYPE_INT_RGB:
                                {
                                  int[] data = ((DataBufferInt) img.getRaster().getDataBuffer()).getData();
                                  dest = ByteBuffer.allocateDirect(data.length * BufferUtils.SIZEOF_INT);
                                  dest.order(ByteOrder.nativeOrder());
                                  dest.asIntBuffer().put(data, 0, data.length);
                                  break;
                                }
                                default:
                                  throw new RuntimeException("Unsupported image type " + img.getType());
                      }
                                                                 
                      if(img.getType() == BufferedImage.TYPE_4BYTE_ABGR)                                                                              
                      {
                              if (mipmapped)
                              {
                                glu.gluBuild2DMipmaps(target, GL.GL_RGBA, img.getWidth(), img.getHeight(), GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, dest);
                              }
                              else
                              {
                                gl.glTexImage2D(target, 0, GL.GL_RGBA, img.getWidth(), img.getHeight(), 0, GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, dest);
                              }
                      }
                      else // texture map has no alpha
                     {
                              if (mipmapped)
                              {
                                glu.gluBuild2DMipmaps(target, GL.GL_RGB8, img.getWidth(), img.getHeight(), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest);
                              }
                              else
                              {
                                gl.glTexImage2D(target, 0, GL.GL_RGB, img.getWidth(), img.getHeight(), 0, GL.GL_RGB, GL.GL_UNSIGNED_BYTE, dest);
                              }
                      }
       }


The problem is that a texture mapped surface (with blending enabled) [glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE)] is blended okay, but the colors are completely wrong.

If I set this part

1  
if(img.getType() == BufferedImage.TYPE_4BYTE_ABGR)


to

1  
if( true )


forcing the img.getType() == BufferedImage.TYPE_4BYTE_ABGR code to run, the texture mapped surface looks correct, but other polygons with alpha blending and no texture mapping are invisible. It's weird.  Huh

So do you see something wrong with the code, which is not specifically a .PNG loader, but a texture maker with the BufferedImage img full of a .PNG file's contents?
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.

TehJavaDev (18 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (70 views)
2014-08-11 02:49:23

BurntPizza (46 views)
2014-08-09 21:09:32

BurntPizza (37 views)
2014-08-08 02:01:56
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

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!