Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (601)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
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]
1  Game Development / Newbie & Debugging Questions / Re: Issues with 3D scene layout and plane positioning using libgdx on: 2015-07-19 10:48:42
Thanks for the answers everyone. In the end I tweaked my idea slightly so that the edges do not need to be up against the edges of the screen, and also made use of ExtendViewport so that it doesn't warp when resizing.
2  Game Development / Newbie & Debugging Questions / [LibGDX] Trouble understanding some issues with lighting my 3D scene on: 2015-07-19 10:46:40
I'm having some trouble understanding some various issues when working with 3D. I'm using LibGDX, but I'm not sure if my problems / knowledge gaps are more general to OpenGL or the way LibGDX does things.

Image of the scene: http://i.imgur.com/RHi8CyB.png

Legend:
(1) DirectionalLight
1  
new DirectionalLight().set(0.8f, 0.8f, 0.8f, 2, 1, 2);


(2) PointLight
1  
new PointLight().set(Color.RED, 1f, 0.5f, 1f, 5f);


(3) Cube's generated inside LibGDX
1  
2  
3  
4  
5  
 ModelBuilder modelBuilder = new ModelBuilder();
Model model = modelBuilder.createBox(1f, 1f, 1f,
    new Material(ColorAttribute.createDiffuse(Color.GREEN)),
    Usage.Position | Usage.Normal);
ModelInstance inst = new ModelInstance(model);


(4) Default cube exported from Blender
1  
2  
3  
4  
assets = new AssetManager();
assets.load("cube.g3db", Model.class);
Model model2 = assets.get("cube.g3db", Model.class);
ModelInstance inst = new ModelInstance(model2);


All these instances are added to an Array<ModelInstance> and then rendered with as below. Instances are positioned in various places to create the layout shown. The environment contains the 2 lights, as well as some ambient lighting.
 
1  
2  
3  
4  
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
modelBatch.begin(camera);
modelBatch.render(instances, environment);
modelBatch.end();



Given this, I have a few questions. Even just some pointers about the correct terminology to be reading up on would be great.

a. Why do the imported cubes (4) receive the light from the PointLight(2) but the generated cubes (3) do not? Do I need to adjust the materials that are applied for this to work?

b. Why does the left most cube (4) receive the light from the PointLight(2) when the green cubes (3) are positioned in such a way that it should prevent the light from reaching it? The light passes through the cubes somehow. I don't want to yet make the cubes cast shadows or anything like that, just block lights with the models. Or is this all the same subject of shadow mapping?

Thanks for the help, and apologies if this should have gone in the OpenGL forum.
3  Game Development / Newbie & Debugging Questions / Re: Issues with 3D scene layout and plane positioning using libgdx on: 2015-07-11 21:12:47
Thanks for the reply!

I did those tweaks you mentioned and that gave me pretty close to what I was imagining. I noticed that it's quite easy to distort the view a lot by resizing the window to weird aspect ratios, is there any way to "fix" the aspect ratio so that this can't happen regardless of window size?
4  Game Development / Newbie & Debugging Questions / Issues with 3D scene layout and plane positioning using libgdx on: 2015-07-11 20:41:33
Hi all.

I've been using libgdx to experiment with it's 3D api, and currently have a test program set up as shown in this screenshot:



Pastebin of relevant portions of the code: http://pastebin.com/kvqK609n

It's drawing 4 planes out using MeshPartBuilder and applying a texture to each. It also uses a PerspectiveCamera to display the scene.

My questions:
- Why do I need to double the z-axis units to get the correct 'cube' shape appearing? As seen in the code, I need to use +2 for the z coordinates whereas x and y are only -1/+1

- I would like to end up with a scene where the corners of the "floor" and "walls" are stretched into the corners of the viewport, as shown by the red dashed lines. What would be the "correct" way to do this? I've tried all sorts of adjustments with the PerspectiveCamera aspect ratio, or manually adjusting the vertex locations of the planes but nothing has seemed to work quite right. I'm not sure if the "wall" and "floor" planes should actually be larger in units that the back plane, or simply visually stretched somehow via the camera.

Thanks in advance for any help!
5  Game Development / Newbie & Debugging Questions / Re: How do I use Ashley entity framework alongside Kryonet? on: 2014-08-22 09:12:25
Hi Mike,

Thanks for that reply. So you just have a loop running in it's own thread which processes the queue? Would it be possible to post any code snippet of your loop setup?
6  Game Development / Newbie & Debugging Questions / How do I use Ashley entity framework alongside Kryonet? on: 2014-08-22 06:10:39
Hi,

I've been experimenting with both the Kryonet and Ashley frameworks separately and really like both, and now I'd like to use both in a single project.

My question is how do I hook them up together? Kryonet works with listeners and there is no 'loop', but Ashley needs a loop with a delta passed into it's update method.

I've seen a few posts where people do use a loop on the server, and Kryonet's listener simply add to a queue. This queue then gets processed during every update. Is this a good way to organise things? All of the examples in the Kryonet repository simply handle everything directly in the listener itself at the time of the event.

Thanks!
7  Game Development / Newbie & Debugging Questions / Re: 2D lighting without shaders in libgdx on: 2013-10-02 14:58:52
Box2DLights is probably the easiest way to add lights to a game in LibGDX.

Great, I'll take a look at that. Is it suitable to use even if my game doesn't make use of any box2d physics and such?
8  Game Development / Newbie & Debugging Questions / Re: 2D lighting without shaders in libgdx on: 2013-10-02 12:29:03
In this case, would my lighting mask need to be transparent though? If I draw a similar lightmask image as from that tutorial, it just draws it solid and white, with a black square background, on top of my semi-transparent overlay. I don't need to use batch.setBlendingFunction() to set it up correctly?
9  Game Development / Newbie & Debugging Questions / Re: 2D lighting without shaders in libgdx on: 2013-10-02 11:50:42
I'm not sure I follow, don't I need some sort of line of code to tell it 'use these blending modes' to make it 'subtract' the light gradient image from the 'darkness' overlay?
10  Game Development / Newbie & Debugging Questions / 2D lighting without shaders in libgdx on: 2013-10-02 05:36:16
Hi all,

I'm experimenting with lighting in libgdx, and want to achieve an effect similar to the one found in this tutorial: http://www.alcove-games.com/opengl-es-2-tutorials/lightmap-shader-fire-effect-glsl/

However, at the moment, shaders are a bit over my head. I asked around and got a few answers that it was possible to just set OpenGL blending modes when rendering stuff with a SpriteBatch, but I can't find the exact lines I need to use to get it to work.

Would anyone have a small example of how this could be done without shaders, just using mybatch.setBlendingFunction(....) etc. ?

Thanks!
11  Game Development / Newbie & Debugging Questions / Re: libgdx - how do I load local assets without an android project? on: 2013-03-30 18:59:44
Thanks all, that has helped me narrow things down to it being a problem only when I use TextureAtlas. My .atlas and .png file are in the same directory as I think libgdx expects, so I'm not sure what else could be wrong as I'm only seeing a generic NullPointerException.
12  Game Development / Newbie & Debugging Questions / Re: libgdx - how do I load local assets without an android project? on: 2013-03-30 16:43:54
There are other methods on GDX.files as well though, I wondered if one of these can be used instead? (e.g. classpath(), but I've not figured out how)

It seems odd that I must have this separate android project folder simply to store my assets in when I'm not going to be using it.
13  Game Development / Newbie & Debugging Questions / libgdx - how do I load local assets without an android project? on: 2013-03-30 16:39:03
Hi all,

I've been getting to grips with using libgdx to develop my game, but as I'm only creating this for desktop, I'm using a single project rather than the default split of base game / desktop project / android project. Now I've been trying to use the following line to load a textureatlas:

1  
atlas = new TextureAtlas(Gdx.files.internal("assets/packed/game.atlas"));
where the 'assets' directory is in the root of the project directory. However running this code just gives me a NullPointerException. From what I can gather though, GDX.files.internal is expecting there to be an assets folder in the android project directory - which I'm not using.

So my question is, how can I correctly reference and load a local file in my project? Thanks.
14  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Is Slick2D still recommended or is libgdx the way to go? on: 2013-03-16 15:53:25
I'd really like to get more input on "the docs are a mess most of the times". Can you point out a few examples and make suggestions on how to correct them?

For me at least, one thing was what I mentioned above about how to use the camera. I would have got much more out of a basic example that matheus23 gave me over the longer current page. I think many of the code samples on the wiki introduce concepts from other parts of the framework that confuse them, e.g. the camera sample includes creating a mesh, binding a texture etc.

Another thing that I couldn't find anything about was the use of the Screen class. The SimpleApp and AppLifecycle pages make no mention of Screen, or how to use it. Until I found https://code.google.com/p/libgdx-users/wiki/ScreenAndGameClasses via Google I didn't even know the feature existed.
15  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Is Slick2D still recommended or is libgdx the way to go? on: 2013-03-16 14:32:41
Thanks everyone for the replies, I'm convinced - libgdx it is Smiley
16  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Is Slick2D still recommended or is libgdx the way to go? on: 2013-03-16 12:20:12
Thank you, that's a massive help. I wish that was on the wiki page for the camera!

One small question, does it have any built in support for draw order / depth? I realise there's a PerspectiveCamera class as well, but I'm not sure if that's what I want (My view will be something similar to any old top-down RPG, Zelda, Chrono Trigger, etc.) In Slick2D I would just sort my entities list by their 'y' position (faked depth) first before they're drawn, but I'd rather do things the 'correct libgdx' way if I'm going to be using it Smiley
17  Java Game APIs & Engines / Engines, Libraries and Tools / Re: Is Slick2D still recommended or is libgdx the way to go? on: 2013-03-16 12:02:37
Perhaps it's me not giving it enough of a chance Smiley So as an example, one thing I've found difficult to find some basic examples of is how to use the cameras.

In java2d / Slick2D, I'd just create a camera class which follows the player, and when things are drawn to the screen, they're offset by the camera position. It's pretty simple and not much code. However, the wiki page for the OrthographicCamera in libgdx is just plain confusing and has so much stuff that's just not relevant to me, I'm not even sure where to begin.
18  Java Game APIs & Engines / Engines, Libraries and Tools / Is Slick2D still recommended or is libgdx the way to go? on: 2013-03-16 10:44:44
Hi all,

I've been playing around with both Slick2D and libgdx for a while now, trying to decide which to use for my game. What's the general consensus these days on which one to use?

My thoughts:

Slick2D

+ Easier to start using, more familiar to people who've used java 2d etc.
+ Does the basics and doesn't have a whole lot of extra stuff I don't need
+ The recent Mojang 'Mojam' seems to have made the forums busier again
- Not really being maintained any more, the maintainer himself has suggested libgdx to people


libgdx

+ Newer, maintained and still being developed
+ Seems to have plenty of featres...
- ... if you can find them in the semi-complete docs. It's hard to find how to do even basic things at times
- Almost seems to do 'too much' for my needs - I'm just creating a desktop game


So I guess my questions are, if I feel more comfortable using Slick2D, should I? Or should I put the time in to learn the 'libgdx way' of doing things?

Thanks!
Pages: [1]
 
Jesse (14 views)
2015-07-29 04:35:27

Riven (36 views)
2015-07-27 16:38:00

Riven (18 views)
2015-07-27 15:35:20

Riven (21 views)
2015-07-27 12:26:13

Riven (12 views)
2015-07-27 12:23:39

BurntPizza (30 views)
2015-07-25 00:14:37

BurntPizza (41 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (27 views)
2015-07-22 22:16:53

NoxInc (18 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

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