Show Posts
|
|
Pages: [1] 2 3 ... 5
|
|
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:# 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); |
|
|
|
|
|
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.
|
|
|
|
|
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); } |
|
|
|
|
|
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();
} |
|
|
|
|
|
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.zipEdit: Any comments and criticisms are welcome.
|
|
|
|
|
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); point.x -= origin.x; point.y -= origin.y;
double xnew = point.x * c - point.y * s; double ynew = point.x * s + point.y * c;
Vector2D TranslatedPoint = new Vector2D(0,0); TranslatedPoint.x = xnew + origin.x; TranslatedPoint.y = ynew + origin.y;
return TranslatedPoint; } |
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|