Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (569)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (618)
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 ... 38
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-11 21:43:11
Started my new job at a local bike shop called the bike smith, woot.

Good bunch of guys, good laugh, trade prices on stuff :p.
2  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-07 18:25:48
Bit the bullet, bought one of these. 8 weeks and the red one will be in stock and in my garage next day Cheesy.

Yay



I regret nothing.
3  Game Development / Newbie & Debugging Questions / Re: [libGDX] Make Tiled cell/tile transparent with code on: 2015-04-04 07:18:49
I guess the cell is a texture. Any way i can change the alpha of a texture?

You could use a simple shader, as that is basically what the sprite alpha and color altering methods are doing.

It would not take long to switch over to Sprite as opposed to texture, it's going to be easier and faster than doing it yourself.
4  Game Development / Newbie & Debugging Questions / Re: [libGDX] Make Tiled cell/tile transparent with code on: 2015-04-03 20:43:07
The Sprite class allows you to directly change the alpha amount.

I believe it is :

1  
2  
Sprite sprite = new Sprite() ;
sprite.setAlpha(someValue) ;
5  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-04-03 11:43:36
I've been working on a project that was shelved back in November, I am doing a refactor and update on it and I was quite curious to just how flexible the Entity and Component code was.

So I made a new playable character that was literally a cloud, I was entertained for a whole 30 minutes just building playable objects.
6  Discussions / General Discussions / Re: Looking for a developer on: 2015-04-03 06:37:19
I appreciate the op. Kev, as per usual had dimmed in on this with the exact same (good) advice he gives every other thread like this.

The difference? The op didn't go full asshole and throw it back in his face.
7  Discussions / General Discussions / Re: Looking for a developer on: 2015-04-02 07:52:56
Lol also that is a neat idea, don't give it away for free like you just did :p.
8  Discussions / Miscellaneous Topics / LuaJ and LibGDX - Class not found on: 2015-03-31 13:53:16
So I decided to have a little look at lua scripting for fun, decided on LuaJ after some googling.

I am just using an existing code base for this, as you might have read in this thread here, I was looking for a way to handle component data outside of the java code. Like loading from JSON (this is my method at the moment) or XML.

So yeah, here is the problem.

This an Android game, that is where the problem lies as it works fine on desktop. It can find, load and run the script just fine.

Here is the script:

1  
2  
3  
4  
5  
6  
7  
function init(entity)   
   local package = "com.gibbo.components";
   local size = luajava.newInstance(package..".SizeComponent");
   size:setWidth(1.5f);
   size:setHeight(1.5f);
   entity:add(size);
end


The obvious problematic line is
local size = luajava.newInstance(package..".SizeComponent");
, which can not be found on Android. I am not sure what else I can say, besides that I have the error:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
03-31 14:51:16.038: I/ERROR(26785): Lua error 
03-31 14:51:16.038: I/ERROR(26785): function init(entity, position)  
03-31 14:51:16.038: I/ERROR(26785):    local package = "com.gibbo.components";
03-31 14:51:16.038: I/ERROR(26785):    local size = luajava.newInstance(package..".SizeComponent");
03-31 14:51:16.038: I/ERROR(26785):    size:setWidth(1.5f);
03-31 14:51:16.038: I/ERROR(26785):    size:setHeight(1.5f);
03-31 14:51:16.038: I/ERROR(26785):    entity:add(size);
03-31 14:51:16.038: I/ERROR(26785): end
03-31 14:51:16.038: I/ERROR(26785):
03-31 14:51:16.038: I/ERROR(26785): :4 vm error: java.lang.ClassNotFoundException: com.gibbo.components.SizeComponent


There is obviously some sort of difference about how android is compiled compared to desktop, but yeah, not sure what to do from here.

UPDATE:

I found this on stack overflow that states I can either downgrade to fix the problem, however I can not find any documentation for anything prior to LuaJ 3.0. So I decided to instead go with the second second suggestions, I downloaded the source and found the missing libaries and changed the source. But nada, still same problem.
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: [LibGDX] How to check if Object is in certain part of camera? on: 2015-03-30 20:38:31
Op, of you're new to vectors and dot product,  this article describes how the dot product can be used for your EXACT requirements. Which is convenient lol.

Enjoy, I suggest you read the rest as well. Nice read imo.
10  Game Development / Newbie & Debugging Questions / Re: How to calculate new position based on angle? on: 2015-03-30 20:29:50
A little note info would help, as you have not stated what you are using, what you have tried etc.

There is many ways to do this, you are wanting to rotate an object around a local coordinate right?
11  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-30 15:55:39
Weird, all my code like this, I Negate it lol. If I don't it shoots opposite.

That probably means you have the source/goal mixed up in your subtraction. It's not the end of the world, just one extra step you don't really need.

Omg thank you, I had it mixed up in all my projects. How the hell did I miss that! Fail Sad.
12  Game Development / Newbie & Debugging Questions / Re: [LibGDX] Entity Components - Should I read from file? on: 2015-03-30 15:52:11
Very nice information here.

Do you recommend serializing components using json, then add them to the entity rather than serializing the entire entity with the components?

The first one seems cleaner, as a serialized character at the moment has literally over 1000 lines in the json file.

However, I don't want to have to read the data in every time I spawn a new character or object, as this will make it slow.

For reference, this is what a basic character looks like:

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  
   private static Entity createHaldor(Vector2 position) {
      Entity e = new Entity();
      PhysicsComponent physicsComponent = new PhysicsComponent(
            BodyType.DynamicBody, true, 2);
      DrawableComponent drawableComponent = new DrawableComponent(new Sprite(
            VRD.ASSETS.get("sprites/01/jump.png",
                  Texture.class)), DepthBuffers.VD);
      SizeComponent sizeComponent = new SizeComponent(1.5f,
            MathHelper.getRatioY(1.5f, drawableComponent.getSprite()
                  .getWidth(), drawableComponent.getSprite().getHeight()));
      MotorComponent motorComponent = new MotorComponent();
      AnimationComponent a = new AnimationComponent();
      LabelComponent labelComponent = new LabelComponent();
      ContactComponent contactComponent = new ContactComponent();
      GroundColliderComponent groundColliderComponent = new GroundColliderComponent();
      DirectionComponent directionComponent = new DirectionComponent();
      AirborneStateComponent airborneComponent = new AirborneStateComponent();

      groundColliderComponent.transform.setPosition(new Vector2(0, -.6f));
      groundColliderComponent.transform.setParent(physicsComponent.transform);
      groundColliderComponent.width = 0.35f;
      groundColliderComponent.height = 0.25f;

      labelComponent.name = "Haldor";
      labelComponent.internalName = "haldor";
      a.current = AnimationCache.getAnimation(labelComponent.internalName,
            "jump");
      motorComponent.maxSpeed = 4f;
      motorComponent.accelerationRateX = 25f;
      PolygonShape poly = new PolygonShape();
      poly.setAsBox(0.75f / 2, 1.5f / 2);
      CircleShape circle = new CircleShape();
      circle.setRadius(0.375f);
      circle.setPosition(new Vector2(0, -.375f));
      physicsComponent.addNewFixtureDef(FixtureData.BUILDER.name("foot")
            .density(0.25f).restitution(0f).friction(0f).shape(circle)
            .dataToSet(contactComponent).build());
      circle = new CircleShape();
      circle.setRadius(0.365f);
      circle.setPosition(new Vector2(0, .375f));
      physicsComponent.addNewFixtureDef(FixtureData.BUILDER.name("head")
            .density(0.25f).restitution(0f).friction(0f).shape(circle)
            .dataToSet(contactComponent).build());
      physicsComponent.transform.setPosition(position);
      drawableComponent.transform.setParent(physicsComponent.transform);
      drawableComponent.transform.setPosition(new Vector2(-sizeComponent
            .getWidth() / 2, -sizeComponent.getHeight() / 2));
      drawableComponent.transform.setAngleAxis(0, 0, 1, 0);
     
      e.add(sizeComponent).add(physicsComponent)
      .add(drawableComponent).add(motorComponent)
      .add(contactComponent).add(a).add(labelComponent)
      .add(directionComponent).add(groundColliderComponent).add(airborneComponent);
     
      return e;
   }


You can probably see why it might be beneficial to read the parameters from a file lol.

EDIT: I was considering using Lua, as this will allow me to have components configured in a script outside of the code base. I thought about this approach given the fact I won't be maintaining this project (or won't be the only one) in the long run.
13  Game Development / Newbie & Debugging Questions / [LibGDX] Entity Components - Should I read from file? on: 2015-03-30 13:12:57
I am a little stumped on the best approach for this, I want to clean up my code a bit and move my entity components to an external file that is loaded in at runtime.

However I am a little unsure how to go about this, as I have never done any extensive I/O coding, I usually just write the code once and when I am happy with it, dump the entire thing to disk using Protobuf or Json and then read it in later.

I would like it to be somewhat readable though, so that if I want to make small changes (like balancing) down the road, I don't have to re-write it and redump it.

I am using the Ashley Entity Framework which is fairly lightweight, along with LibGDX and Box2D. I have it setup so that entities bodies and fixtures are not created until they are added to the Ashley engine, so there is no serializing of actual Box2D bodies; which is nice.

Serializing sprites is bad though, correct? So my option there would be to store the file path and instead grab it from the AssetManager after the entity has been loaded from disk.

Any ideas? Suggestions?, for the record, playable characters (of which there are currently 5) have between 15 and 20 different component combinations that make them unique.

The main idea here is to remove a lot of horrible code into a nice file that is readable and can be altered.
14  Game Development / Networking & Multiplayer / Re: KryoNet Performance on: 2015-03-29 18:43:33
You can have as many as the machine that the server is running on can handle.

This, however you also have to take into consideration if the client can handle what you require as well, as clients will be receiving data from the server about the current state of other clients.

Yes the server might be able to receive 100 and process 100 packets every 33ms, but the clients and their net might not be able to. So it is a case of finding a nice balance, don't think just because the server is running sweet and handling a few clients just fine, make virtual clients and test it. Put your network under stress as well and test it with a moderate connection.

Just my two cents  Cheesy.
15  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Animated graphics formats in OpenGL Java on: 2015-03-29 16:34:57
Not sure on the licensing but I can confirm that animated PNGs are ridiculously large in size, hence why you don't see many.

16  Game Development / Networking & Multiplayer / Re: Kryonet How to update sprite animation in client/server on: 2015-03-28 13:19:07
Might I add, does it really, really matter if the server knows exactly what the state time of an animation is?

Is best not to just inform the server:

"Hey  I just entered the walk state. Let everyone know ".

The clients should know how to draw and time the animations.
17  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-28 08:38:24
You shouldn't have to negate anything.

Weird, all my code like this, I Negate it lol. If I don't it shoots opposite.
18  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-26 19:17:24
To note, you have to Negate the result of the subtraction.

1  
-originY -  targetY


This is different from :

1  
-(originY - targetY) 
19  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-26 18:40:02
Doing Origin - Target makes them look in opposite directions.

Negate it.

1  
MathUtils.atan2(-(originY - targetY),  - (originX -  targetX));


When doing cos and sin, you multiply it by a scalar.

1  
2  
velocityX = MathUtils.cos(angle)  * speed
velocity  MathUtils.sin(angle)  * speed


Ensure speed (or whatever you call it) remain the same during both multiplications.

You also need to learn to use vectors to encapsulate your data.

You can literally half your members, they also have really nice functions.
20  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-26 18:18:08
Ensure you are doing atan2 the correct way. Origin -  target, not the other way around.

Also ensure that you are multiplying the cos and sin by the same value.

If atan2 is not working (for whatever reason), use vectors. Get dst, square it and normalise (this could be completely wrong, tired as shit).
21  Game Development / Newbie & Debugging Questions / Re: OSX 10.10 seems to have broken my games on: 2015-03-26 10:43:31
This must be a problem across many different sdks/languages, as Marmalade (c++ game library) are reporting strange issues on osx beta.

From email :

"Please note that we have detected a compatibility issue with latest beta version of OS X (10.10.3 beta).
 
Specifically, the licensing component of Marmalade is incompatible with the latest OS X update. The impact of this issue is severe: Marmalade licenses cannot be activated or verified. As a result of this it is not possible to perform any builds or deployments
".

Coincidence?
22  Game Development / Newbie & Debugging Questions / Re: Best tutorials on the basics? on: 2015-03-24 11:20:53
Short and sweet.
23  Game Development / Game Play & Game Design / Re: Best Approach at HUD and Fonts on: 2015-03-23 11:27:19
Also for the record you should have a camera for the UI on its own.
24  Discussions / Miscellaneous Topics / Re: What Anti-Virus are you using? on: 2015-03-22 09:16:02
None.

Not used Anti-virus in 5+ years, it's funny that I only ever get virus' and slowdowns when anti-virus software flags it.

Also, I use private torrents as well so it's pretty much impossible to get a virus, it's ridiculously well moderated. Also stick to Pornhub as well :p.
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-21 17:56:13
Booked moto-cross lessons for the 4th of July, can't wait.

After a decade of mountain biking I am finally going to try it "with an engine" as all my non mountain biking friends claim it to be. Little concerned as I have only ridden a 125cc bike once, and this guy is confident that I will be fine on a 450cc bike right off the bat given my experience on a downhill mountain bike. One way to find out :p.

I'll be taking my GoPro so will try and get a video, probably of me having a complete whip out.
26  Java Game APIs & Engines / Engines, Libraries and Tools / Re: EGit and libGDX on: 2015-03-21 17:45:51
Now how do I mark this as solved...?

Edit your thread title with [solved] at the start.

You can also use other tags, like [libgdx] as well Cheesy.
27  Java Game APIs & Engines / Engines, Libraries and Tools / Re: EGit and libGDX on: 2015-03-21 08:15:18
Just create a repo for the folder that contains all 3 projects and you're good to go.

I recommend you look into how the git ignore file is configured and ignore the bin / assets folder of you want to keep the repo small.
28  Game Development / Newbie & Debugging Questions / Re: Mouse Position in Zoomed Tile Map on: 2015-03-20 09:03:41
If you don't feel like helping, just don't respond.

Oh I'll help, what I won't do is write it for you, which is what you're basically asking.
29  Game Development / Newbie & Debugging Questions / Re: Mouse Position in Zoomed Tile Map on: 2015-03-19 18:11:39

Please supply a simple code example of getting the correct coordinates based on the tile map.

Thanks

No, read my reply here to find out why .
30  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Entity Framework and Input - Best approach? on: 2015-03-18 19:51:05
This is sort of what I have at the moment.

I am using components to swap states about, what I have at the moment is you press the space key and if the entity has a GroundedComponent, it gives the entity a JumpComponent, the JumpSystem then uses data from that component to propel the entity upwards, then removes the GroundedComponent, the JumpComponent and adds an AirborneComponent.

All this is fine and dandy, but you can't really poll for input from Scene2D like I am doing now. Say you press left, change the data in the VelocityComponent, which is then handled by the MotorSystem.

However, if you know what Scene2D is like, it has every button you add to the stage take a callback. I don't want to have to make a ton of anonymous classes in a system (the button shouldn't even be in the system for a starter).

So Scene2D has no knowledge of any of the components of an entity, I think I may be missing something simple here :S.

Pages: [1] 2 3 ... 38
 
Riven (22 views)
2015-04-16 10:48:47

Duke0200 (35 views)
2015-04-16 01:59:01

Fairy Tailz (27 views)
2015-04-14 20:13:12

Riven (28 views)
2015-04-12 21:36:37

bus hotdog (45 views)
2015-04-10 02:39:32

CopyableCougar4 (46 views)
2015-04-10 00:51:04

BurntPizza (46 views)
2015-04-06 22:06:58

ags1 (51 views)
2015-04-02 10:58:48

Riven (49 views)
2015-04-01 18:27:05

ags1 (66 views)
2015-03-31 10:55:12
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

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
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!