Show Posts
|
|
Pages: [1] 2
|
|
4
|
Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen
|
on: 2013-04-09 13:08:31
|
|
I could do that, but then I'd have to have that code in the render() function of libGdx, which does work, sure, but it looks a bit strange in my opinion to have a "load-something" function as part of the render()-function of libgdx.
I might just be picky here tho, and this is the way to go about it seeing as libGdx doesn't provide a function to just present the screen or update the display (as lwjgl does)
|
|
|
|
|
7
|
Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen
|
on: 2013-04-09 10:50:54
|
|
Thank you, but I don't really want to use the AssetManager, as I do not care about asynchronous loading or reference counting. I have my own class for texture keeping, which probably wasn't very smart but whatever.
Is there no other way to update the display in libGdx during create()?
|
|
|
|
|
9
|
Game Development / Newbie & Debugging Questions / [libGdx] Loading screen
|
on: 2013-04-09 10:25:47
|
Hey, how do I render something during create() in libGdx? I have a rather long map generation process and all I want to show (for now) is basically a BitmapFont that says "loading", so in create() I 1 2 3 4 5 6 7
| bmf = new BitmapFont(); sb = new SpriteBatch(); sb.begin(); bmf.draw(sb, "Loading", 100, 100); sb.end();
|
but this gets never shown. Is there a way to force this to be rendered? I'm probably missing a function here or something  Thanks in advance
|
|
|
|
|
10
|
Games Center / WIP games, tools & toy projects / Re: Droidz Defense! A New Tower Defense Game
|
on: 2013-03-18 23:52:14
|
Well...for one, make the other towers...more attractive...somehow. You'd probably have to add different mobs that can resist the laser tower better or something  As for 'in-range-detection' you could just check if the center pixel of the mob-sprite is in the radius of the tower, that'd probably make it look better. Tower-AI wise you might want to add something like "attack closest" or "attack furthest" because always attacking whatever 'hits' first in your loop makes it kinda strange if you place the towers just in time, if you know what I mean. Anyway, not bad for a first game and I'm drunk and off to bed
|
|
|
|
|
15
|
Game Development / Newbie & Debugging Questions / Re: wtf @ Eclipse error
|
on: 2013-03-08 08:12:31
|
Huh ... mhh.... Not sure how it even compiles when the error sais Vector2d is not accessible. Hmm look what I googled  There's another solution that also works. I found it on this forum:
Go to the Build Path settings in the project properties. Remove the JRE System Library Add it back; Select "Add Library" and select the JRE System Library. The default worked for me. This works because you have multiple classes in different jar files. Removing and re-adding the jre lib will make the right classes be first. If you want a fundamental solution make sure you exclude the jar files with the same classes.
Maybe that helps? :confused:
|
|
|
|
|
17
|
Game Development / Newbie & Debugging Questions / Re: wtf @ Eclipse error
|
on: 2013-03-08 08:04:09
|
Alternative possibility: maybe another library you use also uses a vecmath.jar library, but of a different version?
That should be it. Sounds like there are different versions of vecmath around on your machine. One in your machine java extension dir and the other maybe floating around somewhere in your classpath.
|
|
|
|
|
20
|
Game Development / Performance Tuning / Re: YAAST (Yet another AStar Thread)
|
on: 2013-03-07 23:10:37
|
The implementation of PriorityQueue is pretty lame and easily 100x slower than it could be if it were optimised for your case.
Sorry, I don't understand it. What do you mean by that? and the closed list should be a boolean grid (preferably made with packed integers so they're bits, not booleans).
That just made it like 100x faster, thank you 
|
|
|
|
|
21
|
Game Development / Performance Tuning / Re: YAAST (Yet another AStar Thread)
|
on: 2013-03-07 22:48:43
|
You're right about the over-exploration thing. Using Manhattan distance there is now 0 over exploration. I replaced all the isInList-stuff with closed_list.contains(next), but it did not speed up the code by much  A large path (from 500,500 to 300,300) still takes >10 seconds to calculate.
|
|
|
|
|
23
|
Game Development / Performance Tuning / Re: YAAST (Yet another AStar Thread)
|
on: 2013-03-07 21:31:28
|
Here is some kind of debugging screenshot  One of the @ is the start position The target is far to the top left (out of the screen) Every tile that contains an 'X' is in the closed_list I'm a little bit confused here, should the code even be checking the bottom right tiles of the screen? There's like 0 possibility that the path goes that way (unless there would be an obstacle, but there are none). Somehow the tiles on the right and bottom have to be ruled out? Heuristic problem? I'm not sure anymore 
|
|
|
|
|
24
|
Game Development / Performance Tuning / YAAST (Yet another AStar Thread)
|
on: 2013-03-07 16:57:11
|
Hey, my AStar implementation is sooo slow, maybe someone could look over it and give some hints?  It works basically OK for small paths, but when I calculate a path on my Map from say 500,500 to 400,400 (with no obstacles in between) it takes like 12 seconds, which is far too long. Using a PriorityQueue is my latest test, but didn't greatly (at all?) improve performance, unfortunately. Semi-long wall of code incoming -> 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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
| public class PathFind { private World world;
public Node thePath; public Node oneStep;
public PriorityQueue<Node> open_list = new PriorityQueue<Node>(); public PriorityQueue<Node> closed_list = new PriorityQueue<Node>();
public long timeDelta;
public PathFind(World world) { this.world = world; thePath = new Node(); oneStep = new Node(); }
public void calculatePath(int startX, int startY, int tarX, int tarY) { timeDelta = System.nanoTime(); open_list.clear(); closed_list.clear(); Node n = new Node(); n.posX = startX; n.posY = startY; n.parent = null; n.g = 1; n.h = (int)Math.sqrt( Math.abs(Math.pow(startX-tarX,2)) + Math.abs(Math.pow(startY-tarY,2))); n.f = n.g + n.h; open_list.add(n); while( !open_list.isEmpty()) { Node current = open_list.poll(); if( isInList(current, closed_list)) continue; if( current.posX == tarX && current.posY == tarY) { thePath = current; while( current.parent.parent != null ) { current = current.parent; } oneStep = current; break; } if( world.getWorldDataAt(current.posX-1, current.posY).walkAble == true) { Node next = new Node(); next.posX = current.posX-1; next.posY = current.posY; next.parent = current; calculateCost(next, next.posX, next.posY, tarX, tarY); if( !isInList(next, closed_list)) open_list.add(next); } if( world.getWorldDataAt(current.posX+1, current.posY).walkAble == true) { Node next = new Node(); next.posX = current.posX+1; next.posY = current.posY; next.parent = current; calculateCost(next, next.posX, next.posY, tarX, tarY); if( !isInList(next, closed_list)) open_list.add(next); } if( world.getWorldDataAt(current.posX, current.posY-1).walkAble == true) { Node next = new Node(); next.posX = current.posX; next.posY = current.posY-1; next.parent = current; calculateCost(next, next.posX, next.posY, tarX, tarY); if( !isInList(next, closed_list)) open_list.add(next); } if( world.getWorldDataAt(current.posX, current.posY+1).walkAble == true) { Node next = new Node(); next.posX = current.posX; next.posY = current.posY+1; next.parent = current; calculateCost(next, next.posX, next.posY, tarX, tarY); if( !isInList(next, closed_list)) open_list.add(next); } closed_list.add(current); } timeDelta = System.nanoTime() - timeDelta; }
private boolean isInList(Node next, PriorityQueue<Node> closed_list) { for( Node n : closed_list ) { if( n.posX == next.posX && n.posY == next.posY ) return true; } return false; }
private Node getLowestFScore(PriorityQueue<Node> open_list) { Node lowest = open_list.peek(); for( Node n : open_list ) { if( lowest.f > n.f ) lowest = n; if( lowest.f == n.f ) if( lowest.g > n.g ) lowest = n; } return lowest; }
public void calculateCost(Node n, int startX, int startY, int tarX, int tarY) { n.g = n.parent.g + 1; n.h = (int)Math.sqrt( Math.abs(Math.pow(startX-tarX,2)) + Math.abs(Math.pow(startY-tarY,2))); n.f = n.g + n.h; }
public class Node implements Comparable<Node>{ public int posX; public int posY; public int f; public int g; public int h; public Node parent;
@Override public int compareTo(Node o) { if( f > o.f ) return 1; if( f < o.f ) return -1; else return 0; } } } |
|
|
|
|
|
26
|
Game Development / Newbie & Debugging Questions / [Derailed Thread :)] libGDX - It's so large?
|
on: 2013-02-25 11:44:58
|
Hi, I really want to use libGDX for my next project. I'm not even sure what it's gonna be yet, but just fiddling around with libGDX I must say the output is rather large. Just a blank, white screen that's not doing anything. I have to distribute all the GDX and lwjgl-backend stuff and natives with it, it comes around to ~5 MB. A little less if I delete some of the not needed natives (linux  ). Anyway, do you guys think it's okay to have a, let's say, really cheap pacman clone that has ~20 kb of graphics have a download of about 5-10 MB? It just makes me a little sad but I guess everything <100 MB is okay nowadays? I just want to hear some opinions on this
|
|
|
|
|
29
|
Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D - setFilter() on "blank" Image
|
on: 2012-12-30 17:20:00
|
I'm confused. The Minimap get's initialized once and filled with the corresponding pixels. The only rendering draw call is 1 2 3
| int posX = gameContainer.getWidth() - (int)mapScale*miniMap.getWidth(); miniMap.setFilter(Image.FILTER_NEAREST); miniMap.draw(posX, 0, mapScale); |
The only update that occurs is the player position on the minimap, which is a red dot currently. I only draw that pixel on top of the current graphics context, not the minimap itself, that way I do not need to reinitialize the minimap. Thanks for the links, but the game runs at >1k fps. So I don't think performance is a problem, yet. Might come in handy later tho 
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|