Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 ... 20
1  Game Development / Artificial Intelligence / [SHARING] Genetic Algorithm - libGDX ( Based on Jeff Heaton's Book ) on: 2014-10-22 00:57:00
Traveling salesman Solver with Genetic Algorithm and Libgdx
Authors: André V Lopes and Robin Stumm

Using Mr Jeff Heaton Book, we used the code of the genetic algorithm chapter and changed the view to libGDX and made it more didactic for students. Its possible to see the algorithm running, save samples, make benchmarks and even run it in android devices!

Pictures






More information :
https://bitbucket.org/andrelopes1705/tsm-ga-solver/overview


Download Links :
https://bitbucket.org/andrelopes1705/tsm-ga-solver/downloads

PS: I will keep the binaries updated cosntantly. We have plans to improve this project.
If you wanna join us, please send a PM.

Feedback are appreciated.

Special thanks to my best German friend : Robin Smiley and Connor and Arthur and Jacob and Mr Jeff Heaton.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-10-16 12:34:29
Improved Traveling salesman Solver with Genetic Algorithm and Libgdx project


https://bitbucket.org/andrelopes1705/tsm-ga-solver
3  Game Development / Newbie & Debugging Questions / TextField 9Patch always red ( reddish?) on: 2014-10-11 15:52:47
Hi devs.
I have this method, and the textfield is drawn reddish, i tried several methods but nothing yet.

What am i doing wrong? I used 9Patch that comes in tool from android SDK.

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  
public static TextField create9PatchTextField(String text) {
        BitmapFont font = BitmapFontFactory.getLatin();

        TextureAtlas.AtlasRegion region = AssetAccessor.getAtlas().findRegion("GAMEDATA/HUD/TEXTFIELD/TEXTFIELD", 9);

        TextureRegion region2 = new TextureRegion(region);

        NinePatch np = new NinePatch(region2);
        np.setColor(Color.WHITE);
        np.setPadLeft(30);
        np.setPadRight(30);

        NinePatchDrawable ninePatchDrawable = new NinePatchDrawable(np);
        Color color = ninePatchDrawable.getPatch().getColor();
        //ninePatchDrawable.getPatch().setColor(new Color().set(Color.CLEAR));
        //ninePatchDrawable.getPatch().setColor(new Color().set(Color.WHITE));

        //Prints FF0000FF
        System.out.println("" + color);

        TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle(font, Color.WHITE, null, null, ninePatchDrawable);

        TextField textField = new TextField(text, textFieldStyle);

        return textField;
    }
4  Game Development / Newbie & Debugging Questions / Re: Unproject Batch #libgdx on: 2014-10-01 18:03:16
But i want to unproject it from the batch.

Should i unproject the camera from itself? and then stage.setProjectionMatrix(camera.combined)

?
5  Game Development / Newbie & Debugging Questions / Unproject Batch #libgdx on: 2014-10-01 17:41:00
Im trying to unproject from the batch... How can i do it?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
 
...
batch.setProjectionMatrix(orthoCamera.combined);

        batch.begin();
        player.render(batch);
        batch.flush();
        batch.end();

        //orthoCamera.projection.inv();
        //orthoCamera.view.inv();
        //orthoCamera.update(true);
       
        stage.getBatch().setProjectionMatrix(orthoCamera.combined);
        stage.draw();
...
6  Discussions / General Discussions / Re: Why are people jerks? on: 2014-09-30 03:11:18
https://www.youtube.com/watch?v=-W_hcLXKp5w

7  Game Development / Newbie & Debugging Questions / Re: How can i move a sprite / a tank in screen with rotation? on: 2014-09-29 17:44:57
I got it working.

1  
2  
3  
4  
5  
6  
public float calculateAngle(float xTank, float xClick, float yTank, float yClick) {

        atan = (float) Math.atan2(yClick - yTank, xClick - xTank);
        atan = (float) (atan - Math.PI / 2);
        return atan;
    }
8  Discussions / General Discussions / Re: Why are people jerks? on: 2014-09-29 16:48:11
It's easy to be angry at someone who is aggressive.
It's possible to be angry at someone who ignores you.
It's hard to be angry at someone who is being kind to you.

I agree but,
Thats what a normal person thinks.

Heres what a troll thinks :

TROLL!


They dont care, they just troll.No matter what.


"Trolls" are normal people just like everyone else. They don't constantly think about annoying people, they love and feel the same emotions "normal" people do. I don't understand why you think that just because people sometimes "troll" they are automatically abnormal and think differently than "normal" people do.

I refuse to start an argument with you Opiop Smiley
 Smiley

I think you are the nicest person ever.

9  Discussions / General Discussions / Re: Why are people jerks? on: 2014-09-29 16:28:20
It's easy to be angry at someone who is aggressive.
It's possible to be angry at someone who ignores you.
It's hard to be angry at someone who is being kind to you.

I agree but,
Thats what a normal person thinks.

Heres what a troll thinks :

TROLL!


They dont care, they just troll.No matter what.

10  Discussions / General Discussions / Re: Why are people jerks? on: 2014-09-29 03:39:48
To repeat my point: Agression on the internet survives from getting attention and more agression. If you don't like it at any point, just get out, nobody will notice, noboy will feel offended again.

EDIT: And if it is pointed at you, people will see it is spam, and will agree with you in case you ignore it.
EDIT2: Not everybody, but the average person.

Or you can insult them back and end like phil?
Huh, you got a point there.
11  Game Development / Newbie & Debugging Questions / Re: How can i move a sprite / a tank in screen with rotation? on: 2014-09-29 03:13:02
I tried this , same 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  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
package br.lopes.singleplayer.levels.Weapons;

import com.badlogic.gdx.math.MathUtils;

/**
 * André V Lopes
 */

public class Ballistic {

    private float atan;
    private float dx, dy;

    public Ballistic(float x0, float y0) {
        dx = x0;
        dy = y0;
    }

    public void calculateAngle(float xTank, float xClick, float yTank, float yClick) {

        if (xClick < xTank && yClick < yTank) {

            atan = MathUtils.PI + MathUtils.atan2((yClick - yTank), (xClick - xTank));

        } else if (xClick >= xTank && yClick >= yTank) {

            atan = MathUtils.atan2((yClick - yTank), (xClick - xTank));
        } else if (xClick < xTank && yClick >= yTank) {
            atan = MathUtils.PI - MathUtils.atan2((yClick - yTank), (xClick - xTank));

        } else if (xClick > xTank && yClick < yTank) {
            atan = (2 * MathUtils.PI) - MathUtils.atan2((yClick - yTank), (xClick - xTank));

        } else {
            atan = MathUtils.atan2((yClick - yTank), (xClick - xTank));
        }
    }

    public float getX(float velocity, float delta) {

        dx = (dx + MathUtils.sin(atan) * velocity);

        return dx;
    }

    public float getY(float velocity, float delta) {

        dy = (dy + MathUtils.cos(atan) * velocity);

        return dy;
    }

}
12  Game Development / Newbie & Debugging Questions / Re: Android Studio or that sexy LibGDX? on: 2014-09-29 03:07:40
Agree with jay.

DK Manager

The Android SDK separates tools, platforms, and other components into packages you can download using the SDK Manager. For example, when the SDK Tools are updated or a new version of the Android platform is released, you can use the SDK Manager to quickly download them to your environment.

You can launch the SDK Manager in one of the following ways:

From Eclipse (with ADT), select Window > Android SDK Manager.
From Android Studio, select Tools > Android > SDK Manager.
On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory.
On Mac or Linux, open a terminal and navigate to the tools/ directory in the Android SDK, then execute android sdk.
You can select which packages you want to download by toggling the checkboxes on the left, then click Install to install the selected packages.


Figure 1. The Android SDK Manager shows the SDK packages that are available, already installed, or for which an update is available.

There are several different packages available for the Android SDK. The table below describes most of the available packages and where they're located in your SDK directory once you download them.


SOURCE :
LINK : http://developer.android.com/tools/help/sdk-manager.html
13  Game Development / Newbie & Debugging Questions / Re: How can i move a sprite / a tank in screen with rotation? on: 2014-09-29 03:06:21
The angle is messed up.
Depending on which quadrant i fire, it will mess up the angle.

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  
package br.lopes.singleplayer.levels.Weapons;

import com.badlogic.gdx.math.MathUtils;

/**
 * André V Lopes
 */

public class Ballistic {

    private float atan;
    private float dx, dy;

    public Ballistic(float x0, float y0) {
        dx = x0;
        dy = y0;
    }

    public void calculateAngle(float xTank, float xClick, float yTank, float yClick) {

        atan = MathUtils.atan2((yClick - yTank), (xClick - xTank));
        //atan = atan - MathUtils.PI/2;
    }

    public float getX(float velocity, float delta) {

        dx = (dx + MathUtils.sin(atan) * velocity);

        return dx;
    }

    public float getY(float velocity, float delta) {

        dy = (dy + MathUtils.cos(atan) * velocity);

        return dy;
    }

}
14  Game Development / Newbie & Debugging Questions / Re: Android Studio or that sexy LibGDX? on: 2014-09-29 02:09:25
Blah screw it. I'll just manage 3 different source codes. LibGDX always seems to fail for me when I feel like giving it another shot.

You have to open the SDK manager and update/download the most recent SDK's through it.
If need help,sent pm and add me in skype.

PS : DermetFan is awesome.

15  Game Development / Newbie & Debugging Questions / Re: How can i move a sprite / a tank in screen with rotation? on: 2014-09-29 02:07:31
1  
2  
xVel = sin(theta) * speed; // Sometimes -sin(theta) * speed, depending on the coordinate system
yVel = cos(theta) * speed;


Sorry to bother again, but im trying to make a Ballistic class for bullets..
Not working properly, can you help me?
I think its the way i calculated the angle.

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  
package br.lopes.singleplayer.levels.Weapons;

import com.badlogic.gdx.math.MathUtils;

/**
 * André V Lopes
 */

public class Ballistic {

    private double atan;
    private float dx, dy;

    public Ballistic(float x0, float y0) {
        dx = x0;
        dy = y0;
    }

    public void calculateAngle(double xTank, double xClick, double yTank, double yClick) {

        if (xClick < xTank && yClick < yTank) {

            atan = Math.PI + (Math.atan((yTank - yClick) / (xTank - xClick)));

        } else if (xClick >= xTank && yClick >= yTank) {

            atan = Math.atan((yTank - yClick) / (xTank - xClick));
        } else if (xClick < xTank && yClick >= yTank) {
            atan = Math.PI - (Math.atan((yClick - yTank) / (xTank - xClick)));

        } else if (xClick > xTank && yClick < yTank) {
            atan = (2 * Math.PI) - (Math.atan((yClick - yTank) / (xTank - xClick)));

        } else {
            atan = 0;

        }

    }

    public float getX(float velocity, float delta) {

        dx = dx + MathUtils.sin((float) -atan) * velocity;

        return dx;
    }

    public float getY(float velocity, float delta) {

        dy = dy + MathUtils.cos((float) -atan) * velocity;

        return dy;
    }

}
16  Game Development / Newbie & Debugging Questions / Re: How can i move a sprite / a tank in screen with rotation? on: 2014-09-28 00:10:42
Working.What you guys think of it?

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  
 public void update() {

        float a = 1;

        a = sprite.getRotation() * MathUtils.degreesToRadians;

        if (pressingRight) {
            sprite.rotate(-5);
        }
        if (pressingLeft) {
            sprite.rotate(5);
        }

        if (pressingUp) {
            velocity.x += acceleration.x;
            velocity.y += acceleration.y;
        }

        if (pressingDown) {
            velocity.x -= (acceleration.x);
            velocity.y -= (acceleration.y);
        }

        //Friction
        if (!pressingUp && !pressingDown) {
            if (velocity.x > 0) {
                velocity.x -= acceleration.x;
                if (velocity.x < 0) {
                    velocity.x = 0;
                }
            }

            if (velocity.x < 0) {
                velocity.x += acceleration.x;
                if (velocity.x > 0) {
                    velocity.x = 0;
                }
            }

            //Y
            if (velocity.y > 0) {
                velocity.y -= acceleration.y;
                if (velocity.y < 0) {
                    velocity.y = 0;
                }

            }

            if (velocity.y < 0) {
                velocity.y += acceleration.y;
                if (velocity.y > 0) {
                    velocity.y = 0;
                }
            }

        }
        //End of Friction
       
       
        //Limit velocity.y
        if (velocity.y > topSpeed.y) {
            velocity.y = topSpeed.y;
        } else if (velocity.y < -topSpeed.y) {
            velocity.y = -topSpeed.y;
        }

        //Limit velocity.x
        if (velocity.x > topSpeed.x) {
            velocity.x = topSpeed.x;
        } else if (velocity.x < -topSpeed.x) {
            velocity.x = -topSpeed.x;
        }

        sprite.setX(getX() + MathUtils.sin(-a) * velocity.x);
        sprite.setY(getY() + MathUtils.cos(-a) * velocity.y);

    }
17  Game Development / Newbie & Debugging Questions / Re: How can i move a sprite / a tank in screen with rotation? on: 2014-09-27 23:33:06
Works fine Smiley
Thanks Heroes!

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  
public void update() {

        float a = 1;

        //Sprite.getRotation return : the rotation of the sprite in degrees
        a = sprite.getRotation() * MathUtils.degreesToRadians;

        //y = arctan * x + b
        if (pressingRight) {
            sprite.rotate(-5);
        }
        if (pressingLeft) {
            sprite.rotate(5);
        }

        if (pressingUp) {
            sprite.setX(getX() + MathUtils.sin(-a) * speed);
            sprite.setY(getY() + MathUtils.cos(-a) * speed);
        }

        if (pressingDown) {
            sprite.setX(getX() + MathUtils.sin(-a) * -speed);
            sprite.setY(getY() + MathUtils.cos(-a) * -speed);
        }

    }
18  Game Development / Newbie & Debugging Questions / [SOLVED]How can i move a sprite / a tank in screen with rotation? on: 2014-09-27 22:53:17
Hello guys. Im trying to make a tank move in angles in my screen.
Im forgot the math to do it.

The tank can rotate in the origin and by pressing W or S , the tank should go forward to that direction or backwards.

Help

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  
public void update() {
       
        float x = getX();
        float y = getY();
        float a = 1;
        float b = 1;
       
        //Sprite.getRotation return : the rotation of the sprite in degrees
        a = sprite.getRotation() * MathUtils.degreesToRadians;
       
        b = y - x * a;

        //y = arctan * x + b
        if (pressingRight) {
            sprite.rotate(-5);
        }
        if (pressingLeft) {
            sprite.rotate(5);
        }
       
        if (pressingUp) {
            sprite.setX(x + 3);
            sprite.setY(a * (getX() + 3) + b);
        }
       
        if (pressingDown) {
            sprite.setX(x - 3);
            sprite.setY(a * (getX() - 3) + b);
        }
       
    }
19  Discussions / Miscellaneous Topics / Re: I'm scared of Unity on: 2014-09-26 14:33:25

It seems awesome!Thanks for sharing that!!!!
20  Discussions / General Discussions / Re: Why are people jerks? on: 2014-09-26 04:53:03
I dont know if i feel sorry for him or not.
21  Discussions / General Discussions / Re: Should i allow everyone to see my game source code? on: 2014-09-26 03:58:06
are you talking about your thesis ?

anyway you can just release after you get your points.
if its for a thesis it doesnt matter, the actual code is not very important compared to the paper that you write

bottom line: no one cares.

Its a thesis.
Im not sure whats the best approach. I will check college teachers too.


22  Discussions / General Discussions / Re: Should i allow everyone to see my game source code? on: 2014-09-25 16:29:20
Oh my god.

Interpreting text?

Lets read it again.
"Im not posting here as KNOW IT ALL programmer thinking people are going to steal my code because im the best programmer of this forum."

What i mean for f**k it sakes, is that , i dont consider myself a top game developer.

Im learning.i wont say im the same as when i started here.I improved a lot thanks to the guidance of people in this forum and Dermet Fan.

Some people in the topic is interpreting me as i was going  : OH MY GOD IM SO GOOD, PEOPLE ARE STEALING CODEZ MINEZ, but i never meant that.

Theres a lot of folks here who knows way more than me.And so, sharing code is always a good idea to learn.






23  Discussions / General Discussions / Re: Should i allow everyone to see my game source code? on: 2014-09-25 16:11:50
Its about sharing knowledge.
Im not posting here as KNOW IT ALL programmer thinking people are going to steal my code because im the best programmer of this forum.
Actually, i would expect a lot of  comments and code change suggestions instead.
24  Discussions / General Discussions / Re: Should i allow everyone to see my game source code? on: 2014-09-25 15:52:46
The most likely scenario is that very few people will look at your code, so it really doesn't matter what you do with it. Harsh reality.

A slightly less likely scenario is that your project is of interest to niche academic researchers, and they'll probably want to see your code and probably send you obnoxious emails. I wrote a little Ant Colony Simulation a few years ago and I still get emails from "phd students" doing Ant Colony Optimization (plz sir, help my thesis sir, plzz help plz plz). Although if you're just putting it up on bitbucket, I'm not sure how they'll even find it (I don't really know what bitbucket is).

An even less likely scenario is that your game becomes popular enough to attract the attention of cloners. If it's that popular, you're going to get clones regardless of whether you release your source. However, if you can prove that somebody used your source (and it's not under a license that allows that), then you at least have some way to fight them for copyright infringement.

The point is, I don't really see a downside of releasing the source. Do you have a specific concern?

My concern would be someone to claim that its their project ( steal from me ), and i college bealive them and i dont graduate.

25  Discussions / General Discussions / Should i allow everyone to see my game source code? on: 2014-09-25 15:29:56
So i have my final college project to be presented in two months.

Its a game in libgdx.

Im wondering if i should let everyone see the code in bitbucket, i plan to put it on google play for free but since i didnt make any document / patent  yet, im unsure if i should.


Opinions?


26  Discussions / Community & Volunteer Projects / Re: Community Project - Migrate Matrix Api (java) To OpenCL ( JOCL ) on: 2014-09-22 02:32:19
Well i just checked aparapi seems to be real nice.

I guess i will stick with it.
If anyone want to join for this open source project, send PM.


https://bitbucket.org/andrelopes1705/corematrix/commits/all
27  Discussions / Miscellaneous Topics / Re: Whays the story behind your name on: 2014-09-22 01:06:08
Mine goes without saying.
28  Discussions / Community & Volunteer Projects / Re: Community Project - Migrate Matrix Api (java) To OpenCL ( JOCL ) on: 2014-09-22 00:57:14
Well im still looking for an API, nothing decided yet.
Aparapi might also be in the scope.
29  Discussions / General Discussions / Re: FlipFlop - Examn f(CLK) on: 2014-09-17 12:46:18


Please, can Anyone  can explain this to me?
30  Discussions / General Discussions / Re: Microsoft to buy Mojang for $2 billion? on: 2014-09-15 15:04:56
 You seem a bit depressed to me.

I just hope microsoft dont ruin the game. PFF
Pages: [1] 2 3 ... 20
 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

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

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

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

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

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

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
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!