Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
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  Java Game APIs & Engines / Android / Libgdx Android Notifications on: 2014-12-13 21:01:40
Hey guys, i'm using LibGDX to make an android game, and I wan't to be able to use android notifications to notify the player about progress updates in the game.

Maybe I'm just over thinking, but I can't figure out how to do it.

The tutorial on the android website (http://developer.android.com/guide/topics/ui/notifiers/notifications.html) provides a good amount of detail on how to do it, but in my LibGDX project none of the required libraries are there, and there aren't any API's I can download.

So if anyone could help me out and point me in the right direction I would appreciate it greatly!

Thanks,
04hockey
2  Game Development / Newbie & Debugging Questions / Re: Libgdx JSON saving problem? on: 2014-11-04 14:48:17
So what is wrong? Putting value X to json, serializing it, saving it to file, reading it from file, parsing json and getting value X somehow is a different value than what you put in the json?
It's also not clear to me what the problem is. Could you specify what you mean by "all of the tasks within the facility are different, as if they have generated all new ones"? Because I have no idea what the result looks like.

As for this:
Output of old task vs. new task:
1  
2  
com.fanger.zombie.FacilityTask@327a5b7f
com.fanger.zombie.FacilityTask@7f0d08bc

This is not unexpected to me. The number you are seeing behind the @ sign is the object's hash code, which by default in most cases is the object's internal address. If you serialize an object, then deserialize it, you in fact create a new object (which is identical to the old object, but may be located somewhere else in memory). At least, that's how I always understood it to be.

As far as I know the LibGDX json serializer is not really smart enough to serialize references to objects (please correct me if I'm wrong), which means that if your save structure contains multiple references to the same object (e.g. many buildings refer to the same task objects) then things will get messed up. While serializing, every single time the task is encountered it is serialized to disk as a seperate object. When deserializing, these objects are instantiated again, but now as many seperate task objects instead of one. Maybe this is the problem you are having.

One way to fix this is to use custom serialization and assign ID's to your task objects, then reconstruct everything while deserializing. This is a bit messy, though. An alternative, and better, approach would be to use another serialization approach, e.g. just using Java's default serialization(which is actually quite good and easy to use) or use a library such as Kryo which is really fast.

Thanks for the replies guys, but I managed to figure out the problem last night before I went to sleep.

In line 2 from my first set of code, I call the method:
1  
         finishAction(taskScheduled, survivorPerforming);


That method is what sets a tasks enabled value to false so you cant do it again. The problem was, I was setting the reference to the actual task being performed, not the actual task stored within the facility. I think with saving/loading that becomes a new object which is what caused my problem.
3  Game Development / Newbie & Debugging Questions / Libgdx JSON saving problem? on: 2014-11-04 03:44:03
Hi guys.

I'm making a game where I have some JSON serializable objects that I can save to a file, and load up at the next time the game is played.

The save structure is like this:

First, an arraylist containing all of the buildings on the map.

A building contains a couple of values unimportant to this issue, and a currentTask variable and an arraylist of tasks (tasks are their own custom class, FacilityTask.java). This is a real-time game, so if you schedule a task and close the game it will technically still be going on.

So upon opening a saved game, it checks to see if any tasks have been completed:
1  
2  
3  
4  
5  
6  
      if(performing && getRemainingTime() <= 0){ //if the facility is performing a task and the remaining the time of the task is <= 0 millseconds
         finishAction(taskScheduled, survivorPerforming); //terminate the current task scheduled
         performing = false; //setting the facility to not performing a task
         startingTime = 0; //reset the starting time of the current task
         endingTime = 0; //reset the ending time of the current task
      }


In the case of this test, the task we are testing is already completed once i open the game. (Keep in mind that if i never close the game, this feature works perfectly fine).

But opening a game with a completed task, all of the tasks within the facility are different, as if they have generated all new ones (ive taken away any code that generates the array of tasks within a facility).

Output of old task vs. new task:
1  
2  
com.fanger.zombie.FacilityTask@327a5b7f
com.fanger.zombie.FacilityTask@7f0d08bc


Because of this, finishing the task doesn't change anything because its not even a variable within the facility anymore. I know this isnt a problem with the saving/loading im doing with JSON because if i start a task, close it, and open it before its completed, the progress is saved and in-tact.

I don't really know what section of code to post, as this issue seems like it could be a problem with a few different classes and thousands of lines of code, so if you'd like to see something please ask me and ill post it.
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2014-07-02 19:37:47

Started working on this.

Ignore the crappy character sprite, but the world is an infinite, procedurally generated world, with chunk loading so FPS doesn't drop no matter how big your world is. Also maxing out at 1 millisecond per generating a new chunk (4098x4098). Grass is randomly generated, going to make it so you can enter the buildings too Smiley. Grass has a cool wavy animation too.
5  Games Center / WIP games, tools & toy projects / Re: Lumens Cave on: 2014-06-27 03:14:08
Astonishing art and animation work, and a very unique concept. Looking forward to seeing where this goes.
6  Games Center / WIP games, tools & toy projects / Re: LodeScape RPG on: 2014-06-27 03:04:41
Looks lovely. Can't wait to see where this goes.
7  Games Center / WIP games, tools & toy projects / Re: The Terminal Angel Disease - 2D Indie RPG on: 2014-05-07 23:47:09
Lovely concept. Can't wait to see where this goes Smiley
8  Games Center / WIP games, tools & toy projects / Re: [LibGDX] Virtual Bart Valdal Minigame Prototype on: 2014-05-04 03:51:17
Looks pretty good to me! Obviously just needs some more functionality and better people and such but it looks good so far! Keep it up!
9  Games Center / WIP games, tools & toy projects / Re: [LibGDX] Virtual Bart Valdal Minigame Prototype on: 2014-05-03 23:35:55
Make sure your sharing is public so we don't have to request access to download the jar.
10  Discussions / General Discussions / Re: Depth VR need your suggestion! on: 2014-04-26 03:52:43
Good god this is absolutely incredible! Not sure how difficult it would be to program with that but I would definitely be interested in backing the project with a little more info!
11  Games Center / WIP games, tools & toy projects / Re: Pollution Simulator on: 2014-04-24 20:38:47
If you read the second image, the dot is supposed to represent a certain number of people. As time goes on, more people and dots are added.
12  Games Center / WIP games, tools & toy projects / Pollution Simulator on: 2014-04-24 20:20:10
Hey guys, I recently entered a STEM competition for my high school and I decided I'd make a video to kind of show off my program.

I know it's not really a game, I just thought it would be fun to share with you guys Smiley



<a href="http://www.youtube.com/v/qkwS-jO5L5o?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/qkwS-jO5L5o?version=3&amp;hl=en_US&amp;start=</a>

So, let me know what you think. Don't be afraid to be harsh Smiley

(Also, not sure if this should be in the showcase, because it seems only games are in the showcase. If a moderator wants to move this to the showcase forum (as the app is finished) then please do so)

DOWNLOAD LINK:
http://adf.ly/kq3vV
13  Game Development / Newbie & Debugging Questions / Re: Slick2D Icon problem on: 2014-04-24 19:14:32
Ah I figured it out! When I saved my PNG in Paint.net I had to make sure it saved as a 32-bit image instead of using Paint.net's auto-detect.
14  Game Development / Newbie & Debugging Questions / Re: Slick2D Icon problem on: 2014-04-24 19:08:34
The guy in this video does the same exact thing and it works perfectly fine:

http://www.youtube.com/watch?v=MCnPaf6TPjw
15  Game Development / Newbie & Debugging Questions / Re: Slick2D Icon problem on: 2014-04-24 19:03:45
changed code:

1  
app.setIcons(new String[]{texturePath + "icon.png", texturePath + "icon16.png", texturePath + "icon64.png", texturePath + "icon128.png"});


still not working
16  Game Development / Newbie & Debugging Questions / Re: Slick2D Icon problem on: 2014-04-24 18:48:41
Yeah using .ico isnt' working either.
17  Game Development / Newbie & Debugging Questions / Re: Slick2D Icon problem on: 2014-04-24 18:46:16
I've seen videos of people using .png files for the icon, I tried the .ico too let me try it again
18  Game Development / Newbie & Debugging Questions / Slick2D Icon problem on: 2014-04-24 17:57:45
Hey guys, I am working on a project for school using Slick2D, and I'm trying to change the icon of the program but no matter what size Icon I try to use none of them work, it just displays the default image for a program.

Here's what I'm trying to change the icon to:


Here's what it's displaying:


My code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
   public Main(String name) throws SlickException {
      super(name);
      app = new AppGameContainer(this);
      app.setIcon(texturePath + "icon.png");
      app.setTargetFrameRate(75);
      app.setDisplayMode(600, 700, false);
      app.setForceExit(true);
      app.setShowFPS(false);
      app.setAlwaysRender(true);
      app.start();
   }


I have tried this with x16, x32, x64, x128 images and none of them have worked :/

I know its reading the right image, because if the path is incorrect it throws an error and closes the application.

Thanks!
19  Games Center / Featured Games / Re: Kitten Challenge on: 2014-04-24 16:58:46
Wow this is impressive. I like the art style and the game is unique and challenging.
20  Game Development / Newbie & Debugging Questions / Re: Inventory System? on: 2014-04-24 16:41:59
I know this, but creating a class specifically for each item I could have rendering properties, update properties, ect. for each item.
21  Discussions / Miscellaneous Topics / Re: Is our Universe Simulatable? on: 2014-04-24 14:44:47
This was a really interesting video! I'm sure in the far future we could definitely have the power to simulate an entire universe.
22  Game Development / Newbie & Debugging Questions / Re: Convert a tile-like scroller to a platformer scroller on: 2014-04-24 14:25:34
I'm not sure what you really mean by the scrolling? Can you elaborate a little more for me?
23  Discussions / General Discussions / Re: Game mechanic explorer on: 2014-04-24 06:26:49
Wow this is great! Thanks for sharing!
24  Game Development / Newbie & Debugging Questions / Re: Inventory System? on: 2014-04-24 06:23:13
What I really wanted to know was whether I should have the Arrays hold Enum values or actual Objects.

But I'm pretty positive that actually having Objects is probably the better option. Thanks everyone!
25  Game Development / Newbie & Debugging Questions / Re: Inventory System? on: 2014-04-24 05:05:26
With using an Enum, I would need to have a switch statement to decide how to render the item, wouldn't this slow performance the more items I add?
26  Game Development / Newbie & Debugging Questions / Re: Inventory System? on: 2014-04-24 01:14:32
I know how to make the inventory work, I am talking about loading the data for the inventory items, obviously I would have to load an image path from the XML and have my code render it based on where it is inside the inventory.

I am going to need to save it, so that's why I was thinking of hard coding it because I could make the objects serializable.
27  Game Development / Newbie & Debugging Questions / Inventory System? on: 2014-04-24 00:54:40
Okay so I'm working on a game and I've been really conflicted recently on how I want to go about doing the inventory system.

What I mean is like how it actually works.

My friend suggested that each inventory item would have an XML file where you could load data from it, but I'm not sure how I would get the rendering to work for that and I'm not sure it's efficient. Along with that, some items (weapons) need to have functionality to them when they are selected/equipped so I'm not really sure how that would work with XML.

I myself had two ideas: Classes for each type of item with each their own rendering method, or Enum values for each item where a switch statement would decide what to render and what kind of functionality it would have, although that would create a ton of lag the more items that were added into the game.

So, if I could get some opinions and ideas on this, that would be lovely! Thanks!
28  Game Development / Game Mechanics / Re: Infinite 2D world on: 2014-04-17 00:48:31
What I do for my game is I have an array that stores objects that are currently loaded, and each time the update loop goes through I check to see the players movement to see if I have to load/unload any more objects.
29  Game Development / Newbie & Debugging Questions / Re: Scaling my games? Performance loss? on: 2014-04-16 03:39:27
Thank you! This was extremely helpful!
30  Game Development / Newbie & Debugging Questions / Scaling my games? Performance loss? on: 2014-04-16 01:27:51
Hey guys,

I recently started working on a side-scroller where the background images fill the entire screen, and there are many background images put together to form the game.

But, I wanted to know how the game scaling should be done? My game is full-screen and obviously there's hundreds of monitors and some with really really odd aspect ratios and sizes. Obviously, if all the monitors had the same aspect ratio the scaling would be fine as there would be no warping.

But I am scaling a smaller image to the size of the screen, if the monitor is shaped oddly, wouldn't the image stretch and warp itself to a point where it will look extremely odd?

Also, I am using Slick, and each background image is an image scaled to the size of the screen, and I'm currently not rendering off-screen images, but for some reason rendering a background images cuts my frame-rate from 4000 fps to 2000 which seems like a bit too large of a performance drop just for rendering one image.

Am I rendering this properly? If not, how should I be rendering these images?

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.

rwatson462 (30 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (48 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
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

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