Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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] Changing game to use Scene2D on: 2014-02-03 23:03:53
I have a game I've been working on with LibGdx and it's a top-down 2D rpg and I'm not sure if using scene2d would be the right option for me or not. I have a bunch of rendering code as it is and the game works fine, but I feel like I'd be able to get more out of scene2d for some of the features I'm going to implement in the future. The main thing I was thinking of that it would make easier would be how my game handles input. The game is tile-based and whenever you mouse over a game object, it should display what the object is (as well as a default action to perform on click) in the top corner of the game. I'll also need to add in right-click option boxes for items and game objects. For example, if you right click on a person, it may list: Talk to person, attack person, examine person, etc. I have quite a few classes that render, but I feel like I've done it in an asinine way to begin with.

 

This is my code:

https://bitbucket.org/stein102/rscl/overview

I've got rendering stuff in the following classes:

MapManager
PlayerEquipment
PlayerInventory
PlayerSkills
GameScreen
QuestTrackerUI
TabBar
UIManager

Thanks for any help Smiley

Scene2D is crazy flexible, the main problem people have is figuring out how Skin and that works.

For what I have read in your post, Scene2D would work wonders for you. Things like right click menus require some arsing about to get working without Scene2D, if you used Scene2D all you would need is a table in the clickable area and whenever you right click on a tile, you get it's type and properties, pass it in a constructor for an object maybe named "RightClickButton", which simply draws it at the x y coord of the mouse pointer, then set a boolean to true so the game knows one is already open.

Reallly it is a very powerful tool and the time spent implementing a decent scene2d UI manager pays off, defo.

Like it will remove all this horrid shit :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
if(!dragged){
         for (int ny = 0; ny < 7; ny++) {
            for (int nx = 0; nx < 4; nx++) {
               if (inventoryList[nx][ny] != null) {
                  batch.draw(inventoryList[nx][ny].getSprite(), x + (nx * 65), y - (ny * 65));
               }
            }
         }
      //Rendering for dragging
     }else{
         for (int ny = 0; ny < 7; ny++) {
            for (int nx = 0; nx < 4; nx++) {
               if (inventoryList[nx][ny] != null) {
                  if(nx==selectedX && ny==selectedY){
                     batch.draw(inventoryList[nx][ny].getSprite(),draggedX-(65/2),draggedY-(65/2));
                  }else{
                     batch.draw(inventoryList[nx][ny].getSprite(), x + (nx * 65), y - (ny * 65));
                  }
               }
            }
         }
      }
      batch.end();
   }


Not that your code is horrible but all Scene2D needs to draw is a stage, table and an object, it takes care of everything else like the drawable and that in the background for you.

Okay, so getting the right-click menu set up sounds pretty simple to get working once I have the rest set up. I'll have to work on that soon, but it'll take me a little while to get the rest of the game into scene2D as well. I've never really used it before so it'll take some getting used to. I've got a branch called "graphicsChange" in my repo and I've moved the player and NPCs to scene2D, do you think you could take a look and see if I've done it properly?
2  Game Development / Newbie & Debugging Questions / [LibGdx] Changing game to use Scene2D on: 2014-02-03 09:44:46
I have a game I've been working on with LibGdx and it's a top-down 2D rpg and I'm not sure if using scene2d would be the right option for me or not. I have a bunch of rendering code as it is and the game works fine, but I feel like I'd be able to get more out of scene2d for some of the features I'm going to implement in the future. The main thing I was thinking of that it would make easier would be how my game handles input. The game is tile-based and whenever you mouse over a game object, it should display what the object is (as well as a default action to perform on click) in the top corner of the game. I'll also need to add in right-click option boxes for items and game objects. For example, if you right click on a person, it may list: Talk to person, attack person, examine person, etc. I have quite a few classes that render, but I feel like I've done it in an asinine way to begin with.

 

This is my code:

https://bitbucket.org/stein102/rscl/overview

I've got rendering stuff in the following classes:

MapManager
PlayerEquipment
PlayerInventory
PlayerSkills
GameScreen
QuestTrackerUI
TabBar
UIManager

Thanks for any help Smiley
3  Game Development / Newbie & Debugging Questions / Re: LibGDX quest log display? on: 2014-01-29 22:31:34
^ only for desktop tho

That's all I'm really concerned with, wasn't planning on releasing android or HTML at all. So what else would I need to change in my game? Probably how the clicks are handled because there are some things I have set up to detect clicks in specific places. Would I just create some ratio and multiply by that. For ex, you resize the screen to be 20% smaller and you would multiply all the positions by 0.8?
4  Game Development / Newbie & Debugging Questions / Re: LibGDX quest log display? on: 2014-01-29 03:31:22
Multi-resolution support is a term that's kinda thrown around. Do you always want to keep the width/height ratio?

Also, current resolution with libgdx is
1  
Gdx.graphics.getWidth();

and
1  
Gdx.graphics.getHeight();


Yes, I'd like to keep the same ratio if possible.
5  Game Development / Newbie & Debugging Questions / Re: LibGDX quest log display? on: 2014-01-29 02:32:19
I suggest paste bin to post the code Cheesy



Note taken on the pastebin suggestions. Would it be possible to glance at my overall project though? I don't mean to be a burden, but I have a lot of classes that render(I've realized this has been a bad decision) and want to refactor my code to a much cleaner point before I continue. If it will make things easier, I've located all the classes that render. They are:

jesse.rscl.map.MapManager
jesse.rscl.player.PlayerEquipment
jesse.rscl.player.PlayerInventory
jesse.rscl.player.PlayerSkills
jesse.rscl.player.screens.GameScreen
jesse.rscl.UI.QuestTrackerUI
jesse.rscl.UI.TabBar
jesse.rscl.UIManager

While we're addressing the issue of rendering and graphics, can anyone suggest me a decent way of providing multi-resolution support? I can only run this game properly on my desktop and not my laptop because the resolution is too large for my laptop.

Thanks again for any help, I know it's a mess :/

I will look into your code tommorow, i promisse!
Also, re-arranging your question, is there a way to check available resolutions with libgdx?

Btw you use netbeans or eclipse?

Appreciate that, I'm sure a set of fresh eyes will do wonders. Plus, the criticism will really help me understand what I'm doing correctly and incorrectly.

As for your question, I use Eclipse.

6  Game Development / Newbie & Debugging Questions / Re: LibGDX quest log display? on: 2014-01-29 01:22:43
I suggest paste bin to post the code Cheesy



Note taken on the pastebin suggestions. Would it be possible to glance at my overall project though? I don't mean to be a burden, but I have a lot of classes that render(I've realized this has been a bad decision) and want to refactor my code to a much cleaner point before I continue. If it will make things easier, I've located all the classes that render. They are:

jesse.rscl.map.MapManager
jesse.rscl.player.PlayerEquipment
jesse.rscl.player.PlayerInventory
jesse.rscl.player.PlayerSkills
jesse.rscl.player.screens.GameScreen
jesse.rscl.UI.QuestTrackerUI
jesse.rscl.UI.TabBar
jesse.rscl.UIManager

While we're addressing the issue of rendering and graphics, can anyone suggest me a decent way of providing multi-resolution support? I can only run this game properly on my desktop and not my laptop because the resolution is too large for my laptop.

Thanks again for any help, I know it's a mess :/
7  Game Development / Newbie & Debugging Questions / Re: LibGDX quest log display? on: 2014-01-29 00:17:41
Thanks for all the suggestions. I've been using scene2D in my game but don't fully understand it. I think I've used it completely wrong. If I was to post up the source for my game, do you think someone could take a brief look at it to see if I've been doing it correctly? It feels really uncomfortable to use and the documentation seems lacking.

Thanks for all the suggestions Smiley


This is the source if anyone has a chance.
https://www.dropbox.com/s/sbodn7mrffbcmjv/Source.rar

8  Game Development / Newbie & Debugging Questions / LibGDX quest log display? on: 2014-01-28 02:31:33
I'm writing a top down RPG using LibGDX and I'm trying to figure out how to create a screen to display the data of a given quest. For example, let's say you have a quest called "Goblin slayer" and you click on that quest in the quest tracker. A screen should come up saying the title of the quest, completed objectives and current objectives. How would you guys suggest setting this up?

Thanks Smiley
9  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Right click option box? on: 2013-10-04 23:11:58
I don't want to use scene 2d because I've already written my actual inventory GUI without using scene2d. I could re-write it I suppose, but I don't really know how to use it.
10  Game Development / Newbie & Debugging Questions / [LibGdx] Right click option box? on: 2013-10-04 20:22:20
I'm working on my game, and the idea is to have a inventory System similar to runescape. The part that I'm suck on is when you right click, what would be the best way to deal with the option box that is supposed to pop up? I know how to find which item was clicked, but what should I do to draw/add options to the box?
11  Game Development / Newbie & Debugging Questions / Re: How to implement game objects? on: 2013-09-24 03:58:11
I'm honestly really lost about where to take this. I want to be able to have something similar to the below to create objects, but I can't quite figure out how to get it done. Can anyone point me in the direction of a source code example where I can see something like this in use?

[/quote]
In short, I used a builder pattern - so I could get something like this
1  
Weapon wep = WeaponBuilder.name("Weapon1").enchantment(Enchantment.FIRE).build();


[/quote]
12  Game Development / Newbie & Debugging Questions / Re: How to implement game objects? on: 2013-09-23 02:24:26
Because of the lack of multiple inheritance, making a inheritance hierarchy doesn't make sense for rpgs in Java (for example, a sword may be enchanted and is a melee weapon, but it can't extend both EnchantedItem and Weapon).

I asked the same question: http://www.java-gaming.org/topics/composition-with-an-rpg/29851/msg/274826/view.html
reponses were very helpful.

In the end, how did you personally end up implementing it? Do you think I could take a look at some of your source code so I can get some ideas?

Thanks.
13  Game Development / Newbie & Debugging Questions / Re: How to implement game objects? on: 2013-09-22 07:48:52
So what you're saying is that I can create an inheritance tree like GameObject > Consumable > HealthItem, and have it read how much the item is supposed to heal and the item name from some sort of data? Or would I need to make it more like GameObject > Consumable > HealthItem > Potion > LargeHealthPotion, which stores all the information needed for a "Large Health Potion"?

Just out of curiosity, why do you have a phobia about XML? Are there some disadvantages to XML that I'm somehow unaware of? Also, what do you mean by "write and editor in Java"? Do you think you could explain this a little more? I'm interested in learning about his this works. My plan was to have all my data in XML and to build an editor where I can distribute it to a non-programmer and give them the capability to add items into the game.

Thanks for the suggestions you've given me. I really appreciate the time you've taken to help me out.
14  Game Development / Newbie & Debugging Questions / How to implement game objects? on: 2013-09-21 23:32:25
I've started working on a RPG and have the basics done so far. Basic movement around the screen, drawing a map, collision with the map, etc. What I'm stuck on is a good way to add game objects into the world? I know I want the world to be data driven, so I can just add perhaps a new type of sword into an XML file and it's in the game. I'm not sure on how to go about this and what to do next. Any suggestions at all?
15  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Trouble parsing XML? on: 2013-08-29 19:04:25
I figured it out, I was trying to use a FilePath, not a FileName. So what I did was used the parse(FileHandle) method instead and it worked perfectly.
16  Game Development / Newbie & Debugging Questions / [LibGdx] Trouble parsing XML? on: 2013-08-27 18:01:37
I have the following XML I need to parse in my LibGdx game

1  
2  
3  
4  
5  
6  
7  
<items>
   <item id="1" name="sword">
      <description text="Just a regular sword."/>
      <wieldable slot="HAND"/>
      <weapon damage = "3"/>
   </item>
</items>


and I get an error on this code, any ideas?
1  
2  
XmlReader reader = new XmlReader();
Element root = reader.parse(items/Items.xml);


The error message is:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing XML on line 1 near: items/Items.xml
17  Game Development / Newbie & Debugging Questions / Re: Benefits of using scene2d? on: 2013-08-23 05:57:51
Okay, perfect. So my screen can have multiple input listeners?

1  
Gdx.input.setInputProcessor(new InputMultiplexer(inputProcessor1, inputProcessor2, ...));


Multiplexer (at bottom of page).

beautiful, seems like these guys think of everything. Thanks! Smiley
18  Game Development / Newbie & Debugging Questions / Re: Benefits of using scene2d? on: 2013-08-22 20:39:20
Okay, perfect. So my screen can have multiple input listeners?
19  Game Development / Newbie & Debugging Questions / Re: Benefits of using scene2d? on: 2013-08-22 17:44:53
Okay, I'll just stick to using it for my overlay like I had already planned. Would it be bad to have a tiled map rendered behind my scene2d stage? Because I can't figure out how to make it so the tiledmap only renders on part of the screen. The main game will have mouselisteners, so I think it might cause a problem.
20  Game Development / Newbie & Debugging Questions / Benefits of using scene2d? on: 2013-08-22 17:03:32
I'm working on a 2d rpg using LibGdx and have started considering using Scene2d for some in-game stuff as opposed to just the GUI like I had originally intended. My game is tilebased, and you can right click on different game objects to get different options for each object. For example, lets say the player finds a tree, there would be options like: Examine tree, chop tree, pick apple. Would scene2d be a good option for me to use?

I'm very new to LibGdx and by extension, scene2d. If scene2d is something I should consider using, can someone link me to a useful guide on how to properly implement it? That would be really helpful.

Thanks!
21  Game Development / Newbie & Debugging Questions / Re: [SOLVED] Can't render tiled map on: 2013-08-17 05:21:20
Thanks for all the replies. Turns out I was just using the wrong compression format for my map. So simple.
22  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-16 16:52:47
Thanks, got it working now. Just have some errors on loading the map itself, looks like this:


Exception in thread "LWJGL Application" com.badlogic.gdx.utils.SerializationException: Error parsing file: maps/map.tmx
   at com.badlogic.gdx.utils.XmlReader.parse(XmlReader.java:71)
   at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:100)
   at com.badlogic.gdx.maps.tiled.TmxMapLoader.load(TmxMapLoader.java:88)
   at jesse.rscl.Screens.GameScreen.<init>(GameScreen.java:49)

code is:
1  
map = new TmxMapLoader().load("maps/map.tmx")
23  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-15 22:16:29
I actually used the LibGdx setup ui
24  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-15 21:38:58
Is there a way I can change from the stable to the nightly? Using eclipse by the way.
25  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-15 21:30:14
I'm using the latest stable build. It's LibGdx - 0.9.8
26  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-15 16:57:18
Are you using the most current version of LibGdx? I am and it's not recognizing a few of the class names.
27  Game Development / Newbie & Debugging Questions / Re: [LibGdx] Can't render tiled map on: 2013-08-15 03:57:58
I copied that exact code but it's still not working.
28  Game Development / Newbie & Debugging Questions / [SOLVED] Can't render tiled map on: 2013-08-15 02:26:52
I'm trying to render a map I've made in tiled but I can't seem to figure out how to get it to work. Can anyone give me an example of how to render one all the way from loading it up to rendering it? That would be awesome.

Thanks
29  Game Development / Newbie & Debugging Questions / How to structure 2D RPG? on: 2013-08-12 21:47:09
My goal is to write a top-down 2D RPG(Similar to runescape classic, but much simpler) using LibGdx. My main question is how I should structure my game? I've made a previous thread asking about Component-Entity Systems and that seems like a good option, but I want to explore my choices.

 

I want to be able to have a few XML or Json files with most of the game content in it, and I could read all the data into my game and have it create the required game objects.

 

So back to my main question, how should I be structuring this game? I would really appreciate any help or advice anyone can give me.

 

Thanks.
30  Game Development / Newbie & Debugging Questions / [LibGdx] Draws textures upside down on: 2013-08-12 08:41:11
I'm just delving into LibGdx and have found that when trying to draw textures, they draw themselves flipped. How do I fix this?

Thanks
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (81 views)
2014-04-15 18:08:23

BurntPizza (73 views)
2014-04-15 03:46:01

UprightPath (84 views)
2014-04-14 17:39:50

UprightPath (67 views)
2014-04-14 17:35:47

Porlus (83 views)
2014-04-14 15:48:38

tom_mai78101 (107 views)
2014-04-10 04:04:31

BurntPizza (167 views)
2014-04-08 23:06:04

tom_mai78101 (263 views)
2014-04-05 13:34:39

trollwarrior1 (213 views)
2014-04-04 12:06:45

CJLetsGame (223 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!