Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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 ... 5
1  Game Development / Newbie & Debugging Questions / Re: Libgdx crashing? on: 2013-05-17 21:29:57
I'm working on a top down tile based mining game, based off of the game Lego Rock Raiders. I'm only running it on PC. Here's a pastebin for the error file. http://pastebin.java-gaming.org/7da697f8c54
2  Game Development / Newbie & Debugging Questions / Libgdx crashing? on: 2013-05-17 16:55:33
I'm working with libgdx and I'm getting an error message that looks just like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x76039c7f, pid=3372, tid=588
#
# JRE version: 7.0_07-b11
# Java VM: Java HotSpot(TM) Client VM (23.3-b01 mixed mode, sharing windows-x86 )
# Problematic frame:
# C  [msvcrt.dll+0x9c7f]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\Trevor\Dropbox\Coding\workspace\LRR\hs_err_pid3372.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
AL lib: alc_cleanup: 1 device not closed

It happens after 25 seconds almost every time. I'm rather confident that it's not an error on my side, but I'd like to know what's going on.
3  Game Development / Game Mechanics / Re: Libgdx 2D lights [Solved] on: 2013-05-15 21:30:30
As I said that I was really only looking for a method to make an alpha mask, I've finally found something suitable. However, it seems as though it is not efficient at all. This is what I've got.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
      Pixmap lightMesh = new Pixmap(width, height, Pixmap.Format.RGBA8888);
      Blending blending = Pixmap.getBlending();
      lightMesh.setColor(0f, 0f, 0f, 0f);
      Pixmap.setBlending(Blending.None);

      int newX = Math.round(x);
      int newY = Math.round(y);

      lightMesh.fillCircle(newX, newY, radius);
      Pixmap.setBlending(blending);
      lightMesh.setColor(Color.BLACK);
4  Game Development / Game Mechanics / Re: Libgdx 2D lights on: 2013-05-14 22:37:25
Well, I guess I'm not so much looking for lighting as I am for creating an alpha mask. That seems like a more reasonable approach to what I'm doing.
5  Game Development / Game Mechanics / Libgdx 2D lights on: 2013-05-14 16:31:37
I'm attempting to figure out how I can add lights to my current game, it's top down 2d and there need to be multiple instances of the lights that are moving. I'll focus on making them dynamic at another date. But, I have no idea how i would do this with libgdx. Any further details can be provided at request. Any help or suggestions is greatly appreciated.
6  Games Center / WIP games, tools & toy projects / Re: Game "Colors" on: 2013-05-07 12:48:43
Right there with you, ra4king. They're not working for me either.
7  Games Center / WIP games, tools & toy projects / Re: Pseudo Voxel Expriements on: 2013-05-02 00:24:10
Ok, sci-fi theme.... You've got me.
8  Game Development / Game Play & Game Design / Re: Running several games based on the same code on: 2013-05-01 23:51:31
I personally would only use shared/same code on methods that I know will be constant, like math. Anything with different methods like that I would code specifically for that project.
9  Discussions / General Discussions / Re: New feature: filtering boards and topics from recent posts listing on: 2013-04-02 03:06:57
Does this also filter them from your "show new replies to your powers" page?
10  Games Center / WIP games, tools & toy projects / Re: Pseudo Voxel Expriements on: 2013-03-31 03:11:53
I too am interested in how those shadows are made. This all looks pretty nifty.
11  Games Center / WIP games, tools & toy projects / Re: [WIP]Viking Supermarket Smash! on: 2013-03-26 21:54:50
Update!
The game is now done! Things added
  • A second swing style, overhead. You move slower, but get more stuff
  • Game Over screen
  • Controls were changed to x and c for the two swings
  • Option in the options menu to go for and endless level
Use the download link in the first post to download.
12  Game Development / Shared Code / 2D Matrix Equivalent of ArrayList on: 2013-03-26 03:21:12
So I thought that it might be a good idea to try to make what is stated in the title.  It has an initial size of 1x1 and can expand as much as you like. I figured it to be more convenient that having "String[][] matrix = new String[1][1];" and having to provide dimensions from the get go. Anyway, the code is obviously not perfect, feel free to use it and tell me if I've done anything wrong or hideously impractical.

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  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
public class ExpandableMatrix<T> {
   private T[][] data;
   private boolean locked = false;
   @SuppressWarnings("unchecked")
   public ExpandableMatrix(){
      data = (T[][]) new Object[1][1];
   }
   public T get(int x,int y){
      try{
         return data[x][y];
      }catch(Exception e){
         return null;
      }
   }
   public void fill(T object){
      for(int x = 0; x < getWidth();x++){
         for(int y = 0; y < getHeight();y++){
            put(object, x,y);
         }
      }
   }
   public ExpandableMatrix<T> expand(int newWidth, int newHeight) {
      if(locked){
         new Exception("Matrix cannot be expanded, it is locked.").printStackTrace();
         return this;
      }
      T[][] newData = newMatrix(newWidth, newHeight);
     
      if(newWidth  < getWidth() || getHeight() > newHeight){

         try{
            this.data = getSection(0,0,newWidth, newHeight);
         }catch(Exception e){
            for(int x = 0; x < newWidth; x++){
               for(int y = 0; y < newHeight;y++){
                  newData[x][y] = get(x,y);
               }
            }
            this.data = newData;
         }
         return this;
      }

      for(int x = 0; x < data.length;x++){
         System.arraycopy(data[x],0, newData[x], 0, data[x].length);
      }
      this.data = newData;
      return this;
   }
   public void put(T object, int x, int y){
      if(x < 0 || y < 0)
         throw new IllegalArgumentException("X and Y must be positive");
      if(x > data.length  || y > data[0].length){
         expand(x,y);
      }
      data[x][y] = object;
   }
   @SuppressWarnings("unchecked")
   private T[][] newMatrix(int width, int height){
      return (T[][]) new Object[width][height];
   }
   
   public T[][] getSection(int x, int y, int width, int height){
      if(isValidPosition(x,y) || isValidPosition(x + width, y + height))
         throw new IllegalArgumentException("Unable to get section, section invalid");
     
      T[][] newData = newMatrix(width, height);
      for(int x1 = x;x1 < x + width; x1++){
         for(int y1 = y; y1 < y + height;y1++){
            newData[x1 - x][y1 - y] = get(x1,y1);
         }
      }
      return newData;
   }
   public boolean isValidPosition(int x, int y){
      return (x < 0 || x > data.length || y < 0 || y > data[0].length);
   }
   public void clear(){
      data = newMatrix(1,1);
   }
   public void lock(){
      locked = true;
   }
   public void remove(int x, int y){
      data[x][y] = null;
   }
   public T[][] asMatrix(){
      return data;
   }
   public int getWidth(){
      return data.length;
   }
   public int getHeight(){
      return data[0].length;
   }
}
13  Game Development / Game Mechanics / Re: Removing Projectiles on: 2013-03-25 11:49:32
It should probably look something like this.
1  
2  
3  
4  
5  
6  
7  
8  
for(int i = 0;i < projectiles.size();i++){
     Attack a = projectiles.get(i);
     if(a.exists){
          a.update(bg);
     } else {
          projectiles.remove(i);
     }
}
14  Java Game APIs & Engines / Java 2D / Re: Rotating images, fast? on: 2013-03-22 00:12:11
Ooh! ooh! I know this one! when you call g.rotate(....);,  you are providing the coordinates for the origin as the top right corner of the tower. You need to add half of the width to the x position and half of the height to the y position. So it would look like:
1  
g.rotate(this.rotation, this.pos.x + (this.actor.getImage(....).getWidth() / 2), this.pos.y + (this.actor.getImage(.....).getHeight() / 2)); 
15  Java Game APIs & Engines / Java 2D / Re: Rotating images, fast? on: 2013-03-19 22:48:31
I just rotate it by the amount i need, draw the image, and rotate it back.
Sorta like this.
1  
2  
3  
4  
5  
public void draw(Graphics2D g){
     g.rotate(theta, x, y);
     g.drawImage(x,y);
     g.rotate(-theta,x,y);
}
16  Java Game APIs & Engines / Java 2D / Re: Rotating images, fast? on: 2013-03-19 21:31:33
I personally don't use any AffineTransformOp, and it looks fine.
17  Games Center / WIP games, tools & toy projects / Re: [WIP]Viking Supermarket Smash! on: 2013-03-18 22:13:25
Update: Items are now infinite, and every level takes 2 minutes. Obstacle spawning has been fixed.
Planned features:
  • Different Swing styles
  • Tutorial section
  • more art
  • applet compatability
New Screenshot:
18  Game Development / Game Mechanics / Re: Best way to sort through giant lists? on: 2013-03-15 21:22:08
Instead, I've just decided to reduce to list size to 250 and whenever the size gets any smaller, it just adds some to fill in the gaps.
19  Game Development / Game Mechanics / Re: Best way to sort through giant lists? on: 2013-03-15 21:06:38
Lol, that was just some psuedocode. I didn't even catch the 'Rage'. Anyway, I don't think that there is any real way that I could get them into a grid system.
20  Game Development / Game Mechanics / Best way to sort through giant lists? on: 2013-03-15 20:52:45
I have a list of about 1000 entities that i need to go through on a regular basis and see which ones are in a certain range. However, looking through the list every time I need to get the new list seems a bit inefficient. Is there a better way to do this? This is somewhat of what I'm using now.
1  
2  
3  
4  
5  
6  
7  
8  
9  
public ArrayList<Entity> getEntitiesInRage(int range, Entity center){
     ArrayList<Entity> inRange = new ArrayList<Entity>();
     for(Entity e: fullList){
          if(e.getDistanceTo(center) >= range)
               inRange.add(e);
     }
     return inRange();

}
21  Games Center / WIP games, tools & toy projects / Re: Viking Supermarket Smash! on: 2013-03-14 20:29:50
Update: I added a rage bar that can be activated by pressing shift. You can fill said bar by hitting things off of the shelf. I believe I fixed the stuttering problem.
Use the same download link as before to re-download it.
22  Games Center / WIP games, tools & toy projects / Re: Viking Supermarket Smash! on: 2013-03-14 02:09:01
The screenshot? it works fine on my computer. It's hosted on imgur.
23  Games Center / WIP games, tools & toy projects / Viking Supermarket Smash! on: 2013-03-13 22:11:23
This is my first real official build of my current project, Viking Supermarket Smash. The name is courtesy of videogamena.me 's random name generator. The premise of the game is that you are a viking, Gurf, who is disgruntled at the supermarket for their high prices. Cause as much havoc as possible by knocking things off of the shelves! Watch out for shopping carts and wet floors. Use the space bar to jump and press enter to swing.


Download: https://www.dropbox.com/s/i5nrcfdbdzpg53d/VSS.zip

Edit: Any comments and criticisms are welcome.
24  Game Development / Newbie & Debugging Questions / Re: LibGDX - Rectangle collision detection in 2d? on: 2013-03-06 21:48:55
Yeah, this is the website I used for learning it. http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/ 
Basically it involves rotating each rectangle by the negative rotation of one and checking for if the vertices are inside the other rectangle.
25  Game Development / Newbie & Debugging Questions / Re: LibGDX - Rectangle collision detection in 2d? on: 2013-03-06 21:38:23
If the collision boxes are going to just be rectangles, I recommend looking into OBB (Oriented Bounding box) collisions and Separated Axis Theorem.
26  Game Development / Networking & Multiplayer / Re: [Kryonet] Client disconnects after packet sent? on: 2013-03-06 12:34:42
Yeah, everything is registered, there is no stack trace. The server just triggers the disconnected method for the client.I tried adding Log.TRACE(), but that didn't even give me any info either.
27  Discussions / Miscellaneous Topics / Re: Dota 2 giveaway ;) on: 2013-03-06 02:35:02
Even though this seems redundant, I'll throw my 5 copies into the mix as well. PM's will be accepted for requests.
28  Game Development / Networking & Multiplayer / [Kryonet] Client disconnects after packet sent? on: 2013-03-05 21:45:43
I'm working on my first real multiplayer setup and I'm using kryonet. The client will connect and all goes well, but when I try to go to  send a packet, it'll maybe send one or 2 and then disconnect. I followed all of the tutorial snippets on the kryonet page, but I'm at a  loss with this. Has anyone had this experience before and how have you fixed it?
29  Game Development / Game Mechanics / Re: Collision Detection on: 2013-03-02 16:38:44
What you're looking for is OBB (Oriented Bounding Box) Collisions. For collisions, I personally use a custom CollisionBox class that has 4 Vector2D's as the vertices. When I rotate the box around it's center, I rotate each point around that center point. If I were you, I would look into separated axis theorem.
30  Game Development / Game Mechanics / Re: Rotating A Point on: 2013-03-01 23:26:16
This is what I use to rotate points, only I use Vector2D, but it works the same way.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
   public static Vector2D rotate(Vector2D origin,Vector2D point, double theta){
      double s = Math.sin(theta);
      double c = Math.cos(theta);
      // get the deltaX and deltaY
     point.x -= origin.x;  
       point.y -= origin.y;  

       // rotate point  
        double xnew = point.x * c - point.y * s;  
       double ynew = point.x * s + point.y * c;

       // translate point back to global coords:
      Vector2D TranslatedPoint = new Vector2D(0,0);
       TranslatedPoint.x = xnew + origin.x;  
       TranslatedPoint.y = ynew + origin.y;

       return TranslatedPoint;
       
   }
Pages: [1] 2 3 ... 5
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
mrbenebob (4 views)
2013-06-19 14:55:23

BrassApparatus (12 views)
2013-06-19 08:52:37

NegativeZero (17 views)
2013-06-19 03:31:52

NegativeZero (19 views)
2013-06-19 03:24:09

Jesse_Attard (22 views)
2013-06-18 22:03:02

HeroesGraveDev (62 views)
2013-06-15 23:35:23

Vermeer (61 views)
2013-06-14 20:08:06

davedes (61 views)
2013-06-14 16:03:55

alaslipknot (56 views)
2013-06-13 07:56:31

Roquen (77 views)
2013-06-12 04:12:32
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
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!