Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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 ... 12
1  Discussions / General Discussions / Re: New feature: topic labels [solved] on: 2014-05-07 06:10:10
This is awesome.
2  Game Development / Game Mechanics / Re: Collision detection and correction (Again, Javascript, not Java) on: 2014-05-06 14:02:11
I really only need collision detection and correction. I'm already using pixi.js for rendering, 'cause it has support for Spine, and I'm using howler.js for sound.

And my collision detection works like a charm, there's never a time that it doesn't detect a collision, only times where it makes the char act weird, e.g. letting it get back up on a platform even though it shouldn't be able to, or cling to walls.
3  Game Development / Game Mechanics / Collision detection and correction (Again, Javascript, not Java) on: 2014-05-06 10:50:37
Hey folks,

This is Javascript <--- For those that doesn't read the title all the way through

So I've got a working method for detecting collisions and it's working pretty good(tm), though the position correction causes weird artifacts, such as:

 - When falling near a wall, you can "walk" towards it, and thus cling to it
 - Walking over an edge and quickly walking the other direction brings you back on top of the platform(sometimes with a little jump).

Here's the code for collision detection:
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  
var CollisionManager = {};

/**
 * Axis-Aligned Bounding Box collision test
 * @returns {Boolean} Whether there was a collision or not
 */

CollisionManager.boolAABB = function(a, b) {
    if(Math.abs(a.position.x - b.position.x) >= (Math.abs(a.width) + Math.abs(b.width)) / 2) {
        return false;
    }
    if(Math.abs(a.position.y - b.position.y) >= (Math.abs(a.height) + Math.abs(b.height)) / 2) {
        return false;
    }

    return true;
};

/**
 * Axis-Aligned Bounding Box collision test
 * @returns {Boolean|null} The direction of the collision or undefined if no collision
 */

CollisionManager.AABB = function(a, b) {
    if(!CollisionManager.boolAABB(a, b)) {
        return;
    }

    // x and y distances from the center
    var xd = Math.abs(a.position.x - b.position.x);
    var yd = Math.abs(a.position.y - b.position.y);

    // The minimum width to be seperated
    var cw = (Math.abs(a.width) + Math.abs(b.width)) / 2;
    var ch = (Math.abs(a.height) + Math.abs(b.height)) / 2;

    // Amount of overlap
    var ox = Math.abs(xd - cw);
    var oy = Math.abs(yd - ch);

    // Direction of the collision
    var dir = new Vec2D(a.x, a.y);
    dir = dir.sub(b);
    dir = dir.normalize();

    if(ox > oy) {
        return new Vec2D(0, dir.y * oy);
    } else if(ox < oy) {
        return new Vec2D(dir.x * ox, 0);
    }

    return new Vec2D(dir.x * ox, dir.y * oy);
};


So, if there is a collision, it'll give me the direction and distance to move my object to get out of the collision.

Here's the code that tries to move my player:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
function tryToMove(d) { // d the velocity vector, divided into steps
    move(d);
    for(var i = 0; i < adventure.entities.length; i++) {
        var entity = adventure.entities[i];
        if(entity.isPassable === true) {
            continue;
        }

        var dv = CollisionManager.AABB(_this, entity);
        if(dv !== undefined) {
            entity.hit(dv);
            move(dv); // Move back out of the collision
        }
    }
}


And the bit that cuts the velocity vector and calls tryToMove():
1  
2  
3  
4  
5  
6  
var steps = Math.max(Math.abs(this.velocity.x), Math.abs(this.velocity.y));
var distance = this.velocity.div(steps);

for(var i = 0; i < steps; i++) {
    tryToMove(distance);
}


Sooo, any thoughts on how to fix the above issues?

Cheers! Smiley
4  Discussions / General Discussions / Re: The Differences between Java and JavaScript. on: 2014-04-29 14:58:39
Now I hope people don't say "Java is the same as JavaScript" anymore. Have a nice day.

I doubt that there's anyone on this forum that would ever mistake the two languages? Though I know plenty of non-tech people that uses the names interchangeably when they talk about either language and correcting those people doesn't really work since they'll just shrug and say "Yeah, that's what I meant" and not really pay any attention to what you actually said. Smiley (At least that's my experience.)
5  Discussions / Miscellaneous Topics / What programs are there for making music? on: 2014-04-20 11:01:19
Hey guys,

What programs are there for making music? As we all know, games without music and sounds aren't exactly awesome, so I'd like to find a program in which I can compose(Read, my gf will be doing this, after laughing at my poor attempts) some background music for my bachelor project.

Also, what programs to use for making sound effects?

Cheers! Smiley
6  Discussions / Miscellaneous Topics / Re: We need more website like www.staggeringbeauty.com on: 2014-04-20 10:54:13
That's just plain .... Stupid? My only reaction to it was "Meh..." even after the "Shake vigorously". Heck, I even tried shaking for a good 30 seconds to see if anything new came up, but nope.
7  Discussions / General Discussions / Re: What hosting do you use for your websites? on: 2014-04-12 21:38:00
I'm using dreamhost.com. Haven't had any issues with them. Smiley
8  Game Development / Game Mechanics / Re: Sidescroller jumping/collision (Not Java, but Javascript) on: 2014-04-03 07:16:05
I find that I have to do the horizontal move, check for a horizontal collision, then do the vertical movement and check for vertical collision. I'm not sure you can do both at the same time and get the desired result. I can see you're trying to achieve that, but try doing it as 2 totally separate operations and see if that helps.

Changed to do this, even if it burns my soul a little, seeing as it's now 2n instead of just n in runtime. But it works, and it'll have to do for now. Smiley

Edit: nvm, must learn to read title.

It's always a good idea to actually read stuff Tongue

Just so you know, Javascript is VERY different from Java.

I'm well aware, as I'm writing in both languages. However this is the only forum I am on, that has anything to do with gaming, and seeing as collision detection is a general term, then I deemed it was okay to post it here(Someone correct me if I'm wrong) and I did write in the title that it was Javascript problem and not Java. Smiley


snip ....
Looks like lots of good stuff, I'll have to take a closer look at it later! Smiley
9  Game Development / Newbie & Debugging Questions / Re: Why a NaN variable is not equal to Double.NaN? on: 2014-04-02 10:56:55
Personally I think it makes perfect sense that NaN != NaN. Smiley All we know about "NaN" is that is that it's not a number, nothing more, hence we don't know if they're equal. ^_^
10  Game Development / Newbie & Debugging Questions / Re: LWJGL resize and delta on: 2014-04-02 08:17:04
I'd just pause the game when the window is being resized, and resume once the resize is complete. ^_^
11  Game Development / Game Mechanics / Sidescroller jumping/collision (Not Java, but Javascript) on: 2014-04-02 08:05:41
'ello guys,

So I have a question about some jumping and collision stuff in a sidescroller, so here goes:

I'm making a sidescroller for my bachelor project(A game for helping kids learn sequences of numders, such as 3,6,9 ... 27, 30)

What I'm doing is exactly this(Couldn't figure out a neat way of writing this, without pasting my _HORRIBLE_ code)

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  
Player.prototype.update = function(entities) {
   if(Keyboard.isPressed(Keyboard.D)) {
      this.velocity.x = 10;
   } else if(Keyboard.isPressed(Keyboard.A)) {
      this.velocity.x = -10;
   } else {
      this.velocity.x = 0;
   }

   if(!this.isJumping && Keyboard.isPressed(Keyboard.SPACE)) {
      this.isJumping = true;
      this.velocity.y = -this.jumpSpeed;
   }

   var move = (Math.abs(this.velocity.x) > Math.abs(this.velocity.y)) ? Math.abs(this.velocity.x) : Math.abs(this.velocity.y);

   for(var i = 0; i < move; i++) {
      var lastX = this.x,
         lastY = this.y;

      var nx = this.x + (this.velocity.x / move),
         ny = this.y + (this.velocity.y / move);

      var colX = false,
         colY = false;

      for(var x = 0; x < entities.length; x++) {
         if(entities[x].passable) {
            continue;
         }

         this.setX(nx);
         this.setY(ny);

         if(this.intersects(entities[x])) {

            this.setY(lastY);
            if(this.intersects(entities[x])) {
               nx = lastX;
               colX = true;
            }

            this.setX(nx);
            this.setY(ny);
            if(this.intersects(entities[x])) {
               ny = lastY;
               colY = true;
            }
         }
      }

      if(this.velocity.y > 0 && colY && !colX) {
         this.isJumping = false;
      }

      this.sprite.position.x = this.x;
      this.sprite.position.y = this.y;
   }

   if(this.velocity.y < this.grav) {
      this.velocity.y += this.grav;
   }
};


This sorta kinda works, except that you're able to "cling" to walls, because .. Well, I'm not perfectly sure, tbh, but I'm assuming that it's somehow finding that it doesn't collide with the wall on the side, but it collides with the wall piece below it.

(I'm aware that the code isn't exactly epic, but it's currently just for trying to get it do behave as it should, cleanup comes later, if there's time for it)

Any clever tips would be most appreciated! Smiley
12  Discussions / General Discussions / Re: JGO Kickstarter on: 2014-04-01 07:32:10
Well, considering it's the 1st of april around here... Tongue

I can't even manage to locate where to click to part with my money! :/

Ooh, found it. Just involved scrolling and _actually_ paying attention to the sidebar. ^_^
13  Discussions / Miscellaneous Topics / Re: Advice on dealing with internet trolls? on: 2014-03-27 09:43:15
Humiliate them.
Not sure if trolling?

Good luck with humiliating someone anonymous on the internet. Only thing to do about it is to ignore them silently and if their posts break the rules of the given forum, delete them and ban the user.
14  Games Center / Contests / Re: Sudoku solver on: 2014-03-15 12:22:00
Heh, looks like this is the same same as http://projecteuler.net/problem=96 Smiley For which I never finished my own solver, because I wanted to implement all sorts of clever methods. Tongue

Maybe today is the day I get my act together and finish it.
15  Game Development / Artificial Intelligence / Re: AI Challenge: '2048' on: 2014-03-14 11:18:53
Alright, here's my result:



16  Discussions / General Discussions / Re: JGO's 16 most prone to prose (in order of probable-rhymes) on: 2014-02-24 13:23:55
Many people are surprised to discover that I have hand-crafted every smiley, on the end of every post I've ever made on the internet, since 1993 or so - it's not a sig!

Cas Smiley

I remember a post on here, where you mistyped the smiley! Tongue
17  Game Development / Newbie & Debugging Questions / Re: Double Buffering Clarification on: 2014-02-12 08:36:41
It's not only Java that uses double buffering. But yes, it's to prevent the screen from flickering, when updating the image. Smiley
18  Discussions / Miscellaneous Topics / Re: How to cheapen the Java brand! on: 2013-10-28 10:59:54
Licence? No. So I've probably given away my soul a few times and everything I own. However, every other install screen and checkbox, yes, including change logs for the apps I use and there's a good chance I'll stop using an app if they present no change log over their updates(I'm not looking for super detailed change logs, just something stating the nature of the update. e.g. bug fixes, added something, removed herobrine, etc.). Documentation is for documenting features and special cases, I check it if I need it. However, I've yet to try a click-and-install where I needed the documentation to be able to figure out if I should check one box or another.

I'll agree that it's not very nice of the Java people to stuff those checkboxes in there and having them checked by default. But isn't the least a user could do, to check what's written on those screens? What else is the point of the screens, if not to provide information and choices?

Besides, it's not like it's something that's hidden away somewhere, it's written in a big bold font, all on it's own screen.

You're almost arguing that people have a right to sue others, because they cut themselves on a knife, and no where did it read that the knife was sharp.
19  Discussions / Miscellaneous Topics / Re: How to cheapen the Java brand! on: 2013-10-28 10:15:54
I never said it was. But people should learn to pay attention to what they're doing and learn to think for themselves. Remove the warning labels from things and let the world sort itself out.

Edit:

Besides, the least a user could do, is read the screens presented to them when they install software.
20  Discussions / Miscellaneous Topics / Re: How to cheapen the Java brand! on: 2013-10-28 10:06:59
Do you want to make it look cheap, nasty and disreputable? Why not push useless browser toolbars and change people's default search engine if they are being just a little inattentive?

If people don't pay attention to what they install, then it's honestly their own fault. You're free to uncheck the "install Ask Toolbar" option, it's not in any way forced upon you, unless, of course you don't pay attention to what you install on your computer. But if that's the case, then I doubt that the tool bar will compromise your computer more than it already is.

21  Discussions / General Discussions / Re: Other Operating Systems on: 2013-10-07 10:50:04
I guess that iOS and Win7 beat them easily.

Not to nitpick, but iOS is the OS on iPhones and iPads, and you can't run javac on those. (At least not without jailbreaking)

Also, most people on here that talks about various OS's being shit, have more often than not, not used the OS they're referring to as shit(No, I'm not baiting for a flamewar, but I really honestly doubt that more than half of this forum has run all 3 systems as their main system for a longer period of time, let alone owned a newer Mac). :/ There's zero reason to use Linux, unless you need all the stuff that's offered there. (Which is, mostly offered for both OSX and Windows too)

I know plenty of people who, being hipsters, bought either a Mac or installed Linux, and didn't know how to use those systems. Best/worst example is the people that buy Macs, because they look pretty, and then install Windows on them for their main OS. xD

For the main question, most people I know, that use Linux as their main system use a Debian variant with KDE, they also use Debian for servers.

Cheers! Smiley
22  Games Center / WIP games, tools & toy projects / Re: Paint.JAVA - Attempt at cloning Paint.NET (with cross-platform support) on: 2013-09-29 21:15:59
@Heroes, well, just let it act as any normal windows, so it can be hidden beneath e.g. the window you're actually painting in. Smiley

Obviously it wont be as much of a problem, once the size of the window is "better", but it's still nice for people with small screens etc.

And since I can see that someone else broke your 111 medals, I'm going to throw mine in now.
23  Games Center / WIP games, tools & toy projects / Re: Paint.JAVA - Attempt at cloning Paint.NET (with cross-platform support) on: 2013-09-29 10:40:22
I'd give you a medal, but then you wouldn't have 111 medals and 11 projects. Sorry. xD

A suggestion, please make the color picker another size, preferably higher than it's wide, instead of how it is now. Also, please please make it not stick on top of all other windows, that's just annoying. xD

Other than that, it's looking good.

Cheers! Smiley
24  Discussions / General Discussions / Ray tracing, sample and shade functions [Solved] on: 2013-09-17 20:47:19
Hey folks,

So I'm taking a rendering course this semester and we were given a framework in C++ to create functions for ray tracing etc., and I'm at an end were I'm supposed to add in a sample and shade function.

I've tried to implement something, but it's just returning a darker version of the image that I'm rendering, and I haven't been given an image that shows how it's supposed to look.

So I'm hoping that you guys can help me out a bit:

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  
bool PointLight::sample(const float3& pos, float3& dir, float3& L) const
{
   // Compute output and return value given the following information.
   //
   // Input:  pos (the position of the geometry in the scene)
   //
   // Output: dir (the direction toward the light)
   //         L   (the radiance received from the direction dir)
   //
   // Return: true if not in shadow
   //
   // Relevant data fields that are available (see PointLight.h and Light.h):
   // shadows    (on/off flag for shadows)
   // tracer     (pointer to ray tracer)
   // light_pos  (position of the point light)
   // intensity  (intensity of the emitted light)
   //
   // Hint: Construct a shadow ray using the Ray datatype. Trace it using the
   //       pointer to the ray tracer.

   if(!shadows) {
      return true;
   }
   
   float3 normal = normalize(pos - light_pos);
   
   Ray ray(pos, normal, 0, 1e-10f);
   HitInfo hit;
   if(tracer->trace_to_closest(ray, hit)) {
   //   if(hit.position.x == light_pos.x && hit.position.y == light_pos.y
   //       && light_pos.z == light_pos.z) {
         float v = length(light_pos - pos);
         dir = normal;
         L = intensity / (v * v);
         return false;
   //   }
   }

   return true;
}


and

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  
float3 Lambertian::shade(const Ray& r, HitInfo& hit, bool emit) const
{
   float3 rho_d = get_diffuse(hit);
   float3 result = make_float3(0.0f);
   
   // Implement Lambertian reflection here.
   //
   // Input:  r          (the ray that hit the material)
   //         hit        (info about the ray-surface intersection)
   //         emit       (passed on to Emission::shade)
   //
   // Return: radiance reflected to where the ray was coming from
   //
   // Relevant data fields that are available (see Lambertian.h, HitInfo.h, and above):
   // lights             (vector of pointers to the lights in the scene)
   // hit.position       (position where the ray hit the material)
   // hit.shading_normal (surface normal where the ray hit the material)
   // rho_d              (difuse reflectance of the material)
   //
   // Hint: Call the sample function associated with each light in the scene.
   
   float3 dir, radiance;
   float3 diffuse = (rho_d / M_PIf);
   for(size_t i = 0; i < lights.size(); i++) {
      if(lights[i]->sample(hit.position, dir, radiance)) {
         result += diffuse * radiance * dot(hit.shading_normal, dir);
      }
   }
   
   return result + Emission::shade(r, hit, emit);
}


The code runs, but it doesn't seem to "work," or at least I'm not sure what kind of image I'm supposed to get out of it.

Any help/insight would be awesome! Smiley
25  Game Development / Newbie & Debugging Questions / Re: Complete Newbie on: 2013-09-17 11:14:59
I think the most used IDE's around here is either Eclipse or Netbeans, I myself use Eclipse and find that a useful IDE. As for the compiler, once you've installed the JDK, then you should have the java compiler. Both Eclipse and Netbeans has a "Compile" button, so you don't have to do the compiling from the terminal.

As for libraries, you can achieve your goal with the standard installation of Java, however there's plenty of libraries out there, that can help you, and it's easy to get a war going between them.

But before starting with libraries, get a feel for how Java is. Then if you insist on using a library, go for something like LWJGL or LibGDX.

Cheers. Smiley
26  Discussions / General Discussions / Re: New feature: crackdown on senseless posts on: 2013-06-28 07:33:44
Just the more reason not to be an ass-hat. xD
27  Discussions / Miscellaneous Topics / Re: Green!!! on: 2013-06-27 11:20:09
I'm in Denmark.



Tongue
28  Discussions / Miscellaneous Topics / Re: war files and WebSphere on: 2013-06-12 08:08:11
Problem solved. Turned out that I needed to compile for Java 1.5, instead of Java 1.6 or 1.7.

Thanks for the help though! Smiley
29  Discussions / Miscellaneous Topics / Re: war files and WebSphere on: 2013-06-12 07:44:39
It's working on localhost, through Glassfish. Smiley

And when I extract the war file I've generated, the class file is in the correct path and does have a size that's not 0b. Tongue
30  Discussions / Miscellaneous Topics / war files and WebSphere [Solved] on: 2013-06-12 05:40:26
Hey guys,

So I'm currently writing a school project that's all about writing a "bank app" on one of IBM mainframes. However, my .class files aren't imported into the WAR file, when I export the project in Eclipse, and when I add the class files manually, then I get funny exceptions.

So does anyone know anything about deploying web apps on WebSphere? (My jsp files run without any trouble. Just the .class files that doesn't work.

The funny exception:
1  
2  
Exception thrown by application class 'com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run():1526' 
  SRVE0202E: Servlet [test.TestMuffin]: test.TestMuffin was found, but is corrupted: SRVE0227E: Check that the class resides in the proper package directory. SRVE0228E: Check that the classname has been defined in the server using the proper case and fully qualified package. SRVE0229E: Check that the class was transferred to the filesystem using a binary transfer mode. SRVE0230E: Check that the class was compiled using the proper case (as defined in the class definition). SRVE0231E: Check that the class file was not renamed after it was compiled.


I have no idea of how it should've gotten corrupted. And for the rest of the "check blabla" it seems to not be the case.
Pages: [1] 2 3 ... 12
 

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

The first screenshot will be displayed as a thumbnail.

rwatson462 (37 views)
2014-12-15 09:26:44

Mr.CodeIt (31 views)
2014-12-14 19:50:38

BurntPizza (62 views)
2014-12-09 22:41:13

BurntPizza (99 views)
2014-12-08 04:46:31

JscottyBieshaar (60 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (77 views)
2014-11-29 21:32:03

toopeicgaming1999 (138 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (38 views)
2014-11-26 15:20:08
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

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

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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!