Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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 ... 7
1  Game Development / Game Mechanics / Pathfinding without a grid on a 2d plane on: 2014-10-23 19:27:12
I've been working on a little side project where it's just two endless armies fighting each other and I've begun adding buildings to it so that they can refill their ammo and such things. The issue I'm having is in having pathfinding AROUND the buildings. Right now the buildings stop the fighters in their tracks and the fighters can't find their way around. I don't have any sort of grid in place either. This is an example of what is happening:
2  Game Development / Newbie & Debugging Questions / Re: Programming an online top-down game for newbies - Questions on: 2014-10-20 17:53:17
I'd like to hear your honest opinion!
As beginner, don't do an online multiplayer game at all.
I had the same thought. When I see "newbie" and "online-multiplayer" in the same post, I see a recipe for disaster. This is not always the case, but I still hazard opening the can of worms labeled "multiplayer" as a first serious project.
3  Game Development / Newbie & Debugging Questions / Libgdx - Tiled Map object properties on: 2014-09-15 02:02:57
I'm having a bit of trouble with trying to iterate through the list of keys provided by Libgdx's MapObject class. As I'm trying to iterate through them, I only receive the data for the first item in the list. Here's what I've got.
1  
2  
3  
4  
5  
MapProperties p = o.getProperties();
while(p.getKeys().hasNext()){
   String s = p.getKeys().next();
   System.out.println(s);
}

All I'm getting is the name of the first key, x, over and over. Any help would be great.
4  Game Development / Game Mechanics / LIBGDX - Xbox360 Controller joystick conversion on: 2014-09-14 01:32:28
I'm working with Libgdx's controller library, trying to make a platformer. I want the joystick to behave like d-pad however. Specifically, I need to only recognize one direction at a time, and I need to recognize when the player lets go of the stick and it returns to the center position. Any insight to this would be much appreciated. Pardon the messy code. This is what I've got going so far:
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  
   public boolean axisMoved(Controller controllerN, int axisCode, float value) {
     
      if(Math.abs(value) > joystickDeadzone){
         switch(axisCode){
         case 0:
            if(value < 0){
               controller.keyDown(ControlMapXbox.upAxis);
            }
            if(value > 0){
               controller.keyDown(ControlMapXbox.downAxis);
            }
            break;
         case 1:
            if(value < 0){
               controller.keyDown(ControlMapXbox.leftAxis);
               
            }
            if(value > 0){
               controller.keyDown(ControlMapXbox.rightAxis);
            }
            break;
         case 2:
           
            break;
         case 3:
           
            break;
         case 4:
            if(value < 0){
               controller.keyDown(ControlMapXbox.rightTrigger);
            }
            break;
         }
      }
      return false;
   }
5  Game Development / Newbie & Debugging Questions / Re: making an inventory work. on: 2014-08-18 17:47:52
Here's some quick code I wrote up. No time to try it so tell me if it doesn't work.
This is just a mockup of what I would suggest for the "MyButton" class. (Although, I don't recommend naming it that.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
public class MyButton extends JButton{

   public Item i;

   public MyButton(....., Item i){ // The "......." is whatever arguments you're already passing to create the JButton, if any.
      super(....);
      this.i = i;
   }
   public Item getItem(){
      return i;
   }
}


Here's where your button press would be handled.
1  
2  
3  
4  
5  
6  
7  
8  
public void actionPerformed(ActionEvent e){
   Object o = e.getSource();
   if(o instanceof MyButton){
      MyButton b = (MyButton)o;
      b.getItem().doAction(player);
   }
   
}
6  Game Development / Game Mechanics / Re: [LibGDX] Edges on 3D models on: 2014-08-18 12:00:02
I don't have much experience with 3d, but am I going to see much of a performance drop from using shaders?
7  Game Development / Game Mechanics / [LibGDX] Edges on 3D models on: 2014-08-18 03:13:03
I'm starting to work with 3d and I have an aesthetic that I'm trying to reach. I want to be able to have my models show with extra emphasis on the edges of the models, like in Cel Shading, but without the toonish lighting. I haven't been able to find very much info on this or if this is even possible with LibGDX. If anyone has some insight on this, it would be much appreciated.
8  Game Development / Newbie & Debugging Questions / Re: making an inventory work. on: 2014-08-15 14:40:07
I would make an extension of whatever button class you are using that has an Item variable in it. When you generate all of your buttons, add the item object to the constructor of the button. Then, when you process the actionevent, you can cast the source of the event to your new button class. From your source, you can access the item variable you had stored in it.
9  Game Development / Newbie & Debugging Questions / Re: making an inventory work. on: 2014-08-15 11:40:29
If I were to approach this, I would have to agree with you up until you start throwing actionlisteners in. I'm not sure if this is best practice, but I would have all the "Items" extend one abstract class. In the abstract class, I would have an abstract method called something like "doAction(Player player, Environment env)". Then, you can have each item class have its own instruction, without throwing all the instructions into one class. Of course, the issue with this is that you have to create a new class for every item.
10  Game Development / Game Mechanics / Re: Plane physics on: 2014-08-11 13:59:46
@opiop65
That's a much better way at explaining it that what I had. Thank you.
11  Game Development / Game Mechanics / Re: Plane physics on: 2014-08-11 12:34:48
No, by definition, the wing would not be generating any lift. Lift is defined as , "Upward-acting force on an aircraft wing or airfoil." If the plane is still moving forward when it stalls and begins to fall, that is due to the momentum that the plane has from it's previous movement. Now, assuming the wind speed is 0, you just have the force of the wind moving at the horizontal speed of the plane colliding with the top of the wing, slowing its horizontal speed. I hope that makes sense to you.
12  Discussions / General Discussions / Re: What? Your game isn't a pixelated retro masterpiece? on: 2014-07-18 14:41:16
I use pixel art for my work primarily because I just flat out suck at drawing. Nobody I know is any good with animation, and I find that I can do my best art when I don't need such a finite control on the art and pixels are great to hide that. I'll admit it, I won't call my games "Retro" or "8-bit", because I'm not using the same constraints that they had to abide by and attempt to work around back then. I'd personally rather have a minimalistic look to my games, which I believe can also be provided by pixels.
13  Games Center / Featured Games / Re: [Slick2d] Retro-Pixel Castles > OFFICIAL WEBSITE LAUNCHED! < on: 2014-07-15 20:32:24
Just downloaded it to try it out. First thoughts, I'm digging all the art. Second thoughts, "Oh, I can only use the map editor". Third Thoughts, "Umm.. It crashes whenever I get to the loading map screen."
14  Game Development / Newbie & Debugging Questions / Re: Libgdx sound lag? [solved] on: 2014-07-14 12:01:51
Yeah, the clip ran perfectly fine on PC. I know I didn't do anything special for it because I downloaded it from freesound and didn't even look at the sample rate until there was an issue.
15  Game Development / Newbie & Debugging Questions / Re: Libgdx sound lag? [solved] on: 2014-07-14 02:53:01
Success has been had! I lowered the sample rate on the clip from about 96k to 44.1k. It plays perfectly fine now!
16  Game Development / Newbie & Debugging Questions / Re: Libgdx sound lag? on: 2014-07-12 01:50:33
Well I'm fairly certain that the issue is NOT with the phone lacking power. It's a newer Samsung Galaxy S4, and I've also run it on a couple of other newer phones as well.
17  Game Development / Newbie & Debugging Questions / Re: Libgdx sound lag? on: 2014-07-11 12:25:14
Well, here's my Audio.java class. It's not the greatest, but hey, I'm open for suggestions.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
package com.toasted;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import com.badlogic.gdx.files.FileHandle;

public class Audio {
   public static Sound beep0 = newSound("blip.wav");
   public static Sound swing = newSound("swing.wav");
   public static Sound crumble = newSound("crumble.wav");
   public static Sound laser = newSound("laser.wav");
   public static Sound vaporize = newSound("vaporize.wav");
   public static Sound thump = newSound("thump.ogg");
   public static Sound siren = newSound("siren.ogg");
   public static Sound wood = newSound("wood.ogg");
   public static Sound chain = newSound("chain.ogg");
   
   public static Sound whiteSedan = newSound("whiteSedan.ogg");
   public static Sound cleanUp = newSound("cleanUp.ogg");
   public static Sound carl = newSound("carl.ogg");
   public static Sound thankYou = newSound("thankyou.ogg");
   public static Sound dairy = newSound("dairy.ogg");
   public static Sound special = newSound("special.ogg");
   public static Sound cashews = newSound("cashews.ogg");
   
   public static final float cleanUpRuntime = 2.0F;
   public static final float whiteSedanRuntime = 5.0F;
   public static final float carlRuntime = 7.5F;
   public static final float thankYouRuntime = 7.75F;
   public static final float dairyRuntime = 5.75F;
   public static final float specialRuntime = 7.0F;
   public static final float cashewsRuntime = 6.0F;
         
   public static Music gameLoop = Gdx.audio.newMusic(Gdx.files.internal("sound/musicLoop.ogg"));
   public static Music rageMusic = Gdx.audio.newMusic(Gdx.files.internal("sound/rage.ogg"));
   
   public final static float SWING_VOL = .5F;
   public final static float VOL = 1.0F;
   public static boolean enabled = true;
   
   public void pauseAll(){
      beep0.pause();
      swing.pause();
      crumble.pause();
      laser.pause();
      vaporize.pause();
      thump.pause();
      siren.pause();
      wood.pause();
      whiteSedan.pause();
      cleanUp.pause();
      chain.pause();
     
      gameLoop.pause();
      rageMusic.pause();
   }
   
   public static void play(Sound s){
      if(enabled)
         s.play(VOL);
   }
   public static void loop(Sound s){
      if(enabled)
         s.loop(VOL);
   }
   public static void loop(Sound s, float vol){
      if(enabled)
         s.loop(vol);
   }
   public static void play(Music m){
      if(enabled)
         m.play();
   }

   
   public static void playRandomPitch(Sound sound, float vol){
      if(!enabled) return;
      float pitch = Global.r.nextFloat();
      sound.play(vol, (pitch * 1.0F) + 1.0F, 0);
   }
   
   private static Sound newSound(String filename){
      return Gdx.audio.newSound(Gdx.files.internal("sound/"+filename));
   }
}

And this is where I believe I'm seeing my problem.
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  
for(int i = 0;i < products.size();i++){
         Product p = products.get(i);
         if(p.position.x < player.position.x && player.position.x - p.position.x > 32){
            products.remove(p);
         }
         if(!p.exists()){
            //shatter
            for(int j = 0;j < 5;j++){
               particles.add(new Particle(p.position, new Vec2D(Global.getRandomInt(1, 10), 0), 2.0F, true, Art.frag(p.item)));
            }
            productCounter[p.ID]++;
            products.remove(p);
            Global.score += (int)Global.multiplier * Product.points[p.ID];
            if(p.sliced) {
               rage += 1 * (Global.crown ? 1.5F : 1F);
               Audio.playRandomPitch(Audio.crumble, .25F);
            }else{
               switch(rageType){
               case lazerVision:
                  Audio.play(Audio.vaporize);
                  break;
               }
            }
            if(rage > 100){
               rage = 100;
            }
         }
      }
18  Game Development / Newbie & Debugging Questions / Re: Libgdx sound lag? on: 2014-07-10 16:04:01
Well, yeah I guess it would just be running slowly. There's not any noticable latency between when the sound is supposed to play and when the sound actually plays. Sorry for the misnomer there.
19  Game Development / Newbie & Debugging Questions / Re: Libgdx sound lag? on: 2014-07-10 15:05:05
I just checked the format on that sound, and ironically, it's one a wav. I'll try converting it over to OGG later. Also, I'm not having any performance trouble on PC, only android.
20  Game Development / Newbie & Debugging Questions / Libgdx sound lag? [solved] on: 2014-07-10 13:55:25
I've been working the kinks out of my game that I've been working on ON an OFF for quite some time and now I'm reaching the end. I've noticed that, while the game runs perfectly fine on my POS PC, I am getting lag whenever I play it on android. The point of this game is to destroy products on shelves, and when they are destroyed, they play a crumble sound with a randomized pitch. Something like 5 or 6 products are all destroyed at the same time. At first, I thought this issue was from all the particles I spawn when the products are destroyed, but I quickly learned that when I disabled in-game sound, I had no more lag. I was wondering if anyone else has had this kind of trouble with sound and libgdx. If necessary, I'll post some code later. Thanks in advance.
21  Game Development / Newbie & Debugging Questions / Re: Collision detection with tiling, fall problems? on: 2014-07-10 12:21:19
Currently, you are getting the the collisions based on two different tiles, when your character is only less than one tile wide.
1  
2  
3  
4  
5  
// Find the tile the robot spans.
int t = player.getY1() / BLOCK_SIZE; // Top tile coordinate.
int b = (player.getY2() / BLOCK_SIZE); // Bottom tile coordinate.
int l = player.getX1() / BLOCK_SIZE; // Left tile coordinate.
int r = player.getX2() / BLOCK_SIZE; // Right tile coordinate.


if the width of the player is less that the tile width, I would only check the center of the player with collision with the ground. So maybe add another variable to your tiles to make it:

1  
2  
3  
4  
5  
6  
// Find the tile the robot spans.
int t = player.getY1() / BLOCK_SIZE; // Top tile coordinate.
int b = (player.getY2() / BLOCK_SIZE); // Bottom tile coordinate.
int l = player.getX1() / BLOCK_SIZE; // Left tile coordinate.
int r = player.getX2() / BLOCK_SIZE; // Right tile coordinate.
int m = ((player.getX2() + player.getX1()) / 2 ) /  BLOCK_SIZE; // The NEW middle tile coordinate

And then change your fall code so that it uses that variable instead:
1  
2  
3  
if(!blocks[b][m].isSolid()) { 
   player.fall(1);
}


With these changes, you may see slight overlap of the character on the wall that he just falls over, but he should be able to move out of it. Just looking at your collisions code, it looks like walls will be troublesome for you as you can't quite get very close to them.

Edit: changed a minus to a plus.
22  Game Development / Newbie & Debugging Questions / Re: Should I move to LibGDX? on: 2014-07-07 19:05:08
I highly suggest LibGDX. It's a great library with plenty of features, tools, and documentation. That being said, don't switch engines on the game midway through the project. I've made that mistake before and rewriting everything to use the new graphics APIs is a heavy chore that pretty much requires redoing the entire framework of the logic of your game. Try using LibGDX on your next project, and sticking with Slick to finish the one you're on.
23  Game Development / Game Mechanics / Re: RPG Dialogue Boxes on: 2014-06-13 15:53:20
This is how I handle text wrapping in my Font.java class.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public String[] split(String fLine, float maxWidthInPixels, float scale){
      String[] lines = new String[10];
      int lineArrayIndex = 0;
      float curWidth = 0;
      int lastSpaceIndex = 0;
      int startIndex = 0;
      for(int i = 0;i < fLine.length();i++){
         String temp = fLine.substring(i, i + 1);// letter
         if(temp.equals(" ")) lastSpaceIndex = i + 1; // the + 1 accounts for the space, so that the space isn't place at the beginning of the next line.
         curWidth += getLength(temp) * scale;
         
         if(curWidth >= maxWidthInPixels){
            i = lastSpaceIndex;
            lines[lineArrayIndex] = fLine.substring(startIndex, lastSpaceIndex);
            startIndex = lastSpaceIndex;
            curWidth = 0;
            lineArrayIndex ++;
           
         }
      }
      lines[lineArrayIndex] = fLine.substring(startIndex, fLine.length());
      return lines;
   }
24  Discussions / Miscellaneous Topics / Re: What do you develop your games on? on: 2014-05-11 01:48:11
I'm working with my 2009 Dell 15" Inspiron Laptop.
Specs:
Windows 7 Home Premium
2.1Ghz Intel Core 2 Duo
4Gb RAM
320Gb 5400rpm HDD
and the crappiest graphics man can create.
25  Java Game APIs & Engines / Engines, Libraries and Tools / Re: libdgx 3d Texture Issues on: 2014-04-17 22:32:12
Image hosting changed to imgur. You should be able to see them now. Sorry about that.
26  Java Game APIs & Engines / Engines, Libraries and Tools / libdgx 3d Texture Issues on: 2014-04-17 22:21:48
I'm trying to get myself started on 3d with libgdx. However, my textures seem to be giving me some problems. I have the model all textured and done in blender as shown:

But when I load it into libgdx, I come up with this:


If anyone has some insight as to what I might be doing wrong, that would be great.
Also, if you want to read the code I'm using, I'm following Xoppa's tutorial as shown here:
http://blog.xoppa.com/loading-models-using-libgdx/
27  Game Development / Game Mechanics / Re: Passing a variable vs. Storing that variable on: 2014-02-14 03:38:49
Ok, thanks. I was only citing Notch's code because it was one example that I could think of.
28  Game Development / Game Mechanics / Passing a variable vs. Storing that variable on: 2014-02-14 02:03:44
Just as a general question I was wondering which method would be the best practice. Passing the variable containing the game world in the update function during every update of an entity, or, upon creation of the entity, store it as a variable in the entity class. I've used the second method before and it worked just fine. If I recall correctly minecraft uses the former of the two. What is your opinion on which is better?
29  Game Development / Newbie & Debugging Questions / the left hand side of the assignment must be a variable? on: 2013-09-16 02:17:42
I'm having a bit of trouble with one function in my problem and it's giving me the answer that I've put as the title. I'm pretty dang sure I haven't done anything wrong, but it's still throwing the error.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
public class Line {
   public Vec2D p1, p2;
   public Line(Vec2D p1, Vec2D p2){
      this.p1 = p1;
      this.p2 = p2;
   }
   public boolean intersects(Line l){
      if( ( ((p1.x - p2.x)(l.p1.y - l.p2.y)) - ((p1.y + p2.y)(l.p1.x - l.p2.x)) ) == 0) return false; // here's where the error is
      return true;
   }
}

Any ideas?

EDIT: wow I feel stupid. I've been in calc class too long and forgot to put the * symbols in.. DISREGARD THIS THREAD
30  Game Development / Newbie & Debugging Questions / Re: Need advice regarding java libriaries on: 2013-09-14 12:24:06
For my first games, I've been using Java's built in library, Java2d. It works perfectly fine for most of the stuff I do. It's just not terribly efficient though.
Pages: [1] 2 3 ... 7
 

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

The first screenshot will be displayed as a thumbnail.

theagentd (20 views)
2014-10-25 15:46:29

Longarmx (53 views)
2014-10-17 03:59:02

Norakomi (47 views)
2014-10-16 15:22:06

Norakomi (35 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (69 views)
2014-10-14 00:35:47

TehJavaDev (61 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (46 views)
2014-10-11 23:10:45
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

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