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 (406)
games submitted by our members
Games in WIP (290)
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
1  Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen on: 2013-04-12 07:35:28
Thank you, that is how I solved it too currently. I just think it's not very sexy to have a function that loads(/generates) stuff inside the render() function.
2  Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen on: 2013-04-10 12:57:24
Yeah the problem is, that it isn't just textures or sounds or other resources that I need to load. I have a rather long (and bad) map-creation code and I just wanted to display a text like "loading" before creating the map.
3  Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen on: 2013-04-09 13:20:11
I get it and you're right, that is probably the best solution Cheesy
Although I still feel libGdx should implement a function like display.update(); Sad
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)
5  Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen on: 2013-04-09 13:03:58
Thanks but no Smiley
I can render a bitmap font just fine. I just can't render it (or anything for that matter) during create() Sad
6  Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen on: 2013-04-09 11:48:21
Stupid workaround is to render 1 frame that says "loading" in render() *then* load the rest of the stuff from create(), but it feels and looks so bad. sigh
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()?

8  Game Development / Newbie & Debugging Questions / Re: [libGdx] Loading screen on: 2013-04-09 10:36:58
I think so too, I just don't know the function Sad
Gdx.graphics.requestRendering()
sounded good, but doesn't do anything Smiley
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();

// map.init();


but this gets never shown. Is there a way to force this to be rendered? I'm probably missing a function here or something Smiley

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 Cheesy
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
11  Games Center / WIP games, tools & toy projects / Re: Droidz Defense! A New Tower Defense Game on: 2013-03-18 08:22:46
Ok just tried it.
I only ever build laser towers and upgraded them. That went quite well Cheesy
However, the towers seem to be able to shoot farther than their range indicates occasionally.
After wave 4 or 5 the game froze. Sad
12  Game Development / Newbie & Debugging Questions / Re: Where to start? on: 2013-03-15 08:00:16
http://docs.oracle.com/javase/tutorial/
13  Game Development / Networking & Multiplayer / Re: [Kryonet] Client disconnects after packet sent? on: 2013-03-13 18:40:59
If you send a packet each frame and you have like 1000 fps Kryo disconnects will happen, so make sure that you're not sending too many packets at once.
Other than that, I don't know, show some code maybe Smiley
14  Discussions / General Discussions / Re: I Switched to IDEA! on: 2013-03-09 18:54:30
Using IDEA for over 2 month now
Never going back to eclipse....probably Cheesy
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 Cheesy
Quote
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:
16  Game Development / Newbie & Debugging Questions / Re: Tile map collision on: 2013-03-08 08:04:35
Some code to look at would certainly help this Thread Smiley
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.
18  Game Development / Performance Tuning / Re: YAAST (Yet another AStar Thread) on: 2013-03-08 07:54:02
Just implemented the BitSet for testing, but it didn't improve the speed any further.
I can't really measure it exactly but it seems to be exactly the same speed as the boolean grid.
19  Game Development / Performance Tuning / Re: YAAST (Yet another AStar Thread) on: 2013-03-07 23:49:30
Thanks for everything, I'm gonna have a look at it Smiley
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?

Quote
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 Cheesy
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 Sad

A large path (from 500,500 to 300,300) still takes >10 seconds to calculate.
22  Game Development / Performance Tuning / Re: YAAST (Yet another AStar Thread) on: 2013-03-07 22:42:37
Nevermind that -.-
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 Sad
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? Sad
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 = Math.abs( startX - tarX  + startY - tarY );
       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 = getLowestFScore(open_list);
           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) { // tile left of current
               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) { // tile right of current
               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) { // tile top of current
               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) { // tile bot of current
               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);
            //open_list.remove(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 = Math.abs( startX - tarX  + startY - tarY );
       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;
        }
    }
}

25  Game Development / Newbie & Debugging Questions / Re: libGDX - It's so large? on: 2013-02-25 13:49:46
Nice. You entered the notch-millionaire-club yet? Cheesy
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 Cheesy).

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

27  Games Center / Showcase / Re: Space Spiders on: 2013-01-13 21:04:08
Well, that was fun Cheesy
Good job
28  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D - setFilter() on "blank" Image on: 2012-12-30 17:58:40
I don't know what you m- (must use libgdx for next project)  Grin Grin
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 Smiley
30  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Slick2D - setFilter() on "blank" Image on: 2012-12-30 17:00:35
Well, updating Slick fixed it -.-

Don't know why I was using an old version, thank you very much!
Pages: [1] 2
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (98 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (167 views)
2013-05-12 17:10:36

kutucuk (166 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
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

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.177 seconds with 20 queries.