Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
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 / Performance Tuning / Re: libGDX rendering performance on: 2013-06-27 19:01:39
Hm thank you for the link but I guess caching is no solution to my problem.

The tiles (and that's why I choosed 6x6 for them) are part of a dynamic sandgame style map.
That means each tile could interact with each other tile at any given moment.
2  Game Development / Performance Tuning / Re: libGDX rendering performance on: 2013-06-27 18:39:01
Of course all (all tiles) batch.draw() calls are called between batch.begin() / batch.end().
3  Game Development / Performance Tuning / libGDX rendering performance on: 2013-06-27 18:12:01
Hi there,

I am currently developing a game where I need to render a lot of dynamic small tiles.
One tile is 6x6px targeting a resolution of 1024x768 resulting in a tile-count of 170x128=21760 tiles.

On the desktop I get a decent framerate of 400fps whereas on my test device (acer a500 tegra2) I only get about 20fps :/.

Keeping in mind that the gamelogic, ki, etc. is excluded in this test, I would be happy with a framerate of about 50fps on the tablet.

I am only! rendering tiles that are visible and there are no unnecessary texture binds involved.

Here is the code that is called for each tile:
   public void renderTile(short tileId, int screenX, int screenY) {
      batch.draw(tileTexture, screenX - tileMap.getTileSize(), screenHeight - screenY - tileMap.getTileSize());

Is there any chance to improve this?

Thanks in advance Smiley
4  Discussions / General Discussions / Re: Managing gamestates and entities, singletons on: 2013-04-12 10:33:50
Who actually unit-tests game code anyway?
Well I hope some people do Smiley

And what makes unit-testing a singleton particularly difficult?
When it comes to unit testing you need a clearly defined state of the class you want to test.
When not using a singleton, a simple
new Foo();
provides you a fresh instance and a clean state.

But how can you ensure that for a singleton?
By definition there is only one instance of it and you can not be sure that it's state is what you expect it to be which makes testing it very very hard and error prone.
So your only chance would be to implement a method to reset the state of your singleton which again is error-prone.
5  Discussions / General Discussions / Re: Managing gamestates and entities, singletons on: 2013-04-11 21:10:49
You should avoid singletons wherever you can.
The singleton is reasonable called an anti pattern.

How would you unit-test a singleton?
6  Discussions / General Discussions / Re: why are people trying to use Java2D to make games? on: 2013-04-11 20:54:15
I just started to port a game from Flash to Java and when I started to port the code I already knew that the rendering part should be separated as much as possible (which it should be anyway) so I could decide later wheter to use Java2D, opengl, a printer or whatever.

So in my opinion the question about wheter to use Java2D to make games or not should be wheter or not to use Java2D for the rendering.
Java2D is not about game programming, it is about image processing (which it seems to do very well).

It is perfectly valid to use Java2D for your rendering.
And if you have separated the rendering from the rest of the game it should be no problem to switch from the Java2D API to some OGL API.
Same applies for the inputs btw.
7  Java Game APIs & Engines / Java 2D / Re: Event handling on: 2013-02-22 08:16:14
Thank you very much BoBear2681,
so basicly I need to implement the Observer Pattern by myself given the interface provided by Java.
While this is exactly what I have been looking for, I wonder why(if) there isn't any implementation but only the private field :/.
However, this helped me a lot Smiley
8  Java Game APIs & Engines / Java 2D / Event handling on: 2013-02-21 19:26:51

I am actually not sure if this is the right place for my question but I probably will notice if not.
I come from an ActionScript background and am now dealing with Java to which I would like to port some graphical stuff I have made in "Flash" before.
The rendering is no problem for me at all but which makes me some headache is the way events are handled in Java because I have some swing gui that interacts with my model.

For instance given a custom GUI component (which extends JPanel) is composed of two other GUI components:JLabel and JButton.
If the user clicks on the JButton instance I would like to now the state of the JLabel (from a parent component which instanciated my custom component) without nowing much about the custom component (loose coupling).

So imho it would be the best solution to forward the new state(in this case it is the String of the label) as part of the custom event.

In ActionScript I couldy easily dispatch an custom event like this:
class MyCustomComponent extends Sprite {
  private const myButton : MyButton = new Button();

  public function MyCustomComponent() {
    myButton.addEventListener(MouseEvent.CLICK, onButtonClick);

  private function onButtonClick(event : MouseEvent) : void {
    dispatchEvent(new CustomEvent("change", "new string"));

Another GUI component could handle events of MyComponent like this:
var myCustomComponent : MyCustomComponent = new MyCustomComponent();
myCustomComponent.addEventListener("change", onCustomComponentChange);

In onCustomComponentChange I then could handle the changed state of the component.

So how is this solved "correctly" in Java?

Unfortunately it seems that I can not dispatch custom events that forward objects to the listener.
I thought about some objective c delegate solution:
myCustomComponent.delegate = myDelegate;

where the delegate needs to implement some component specific callbacks.
But this smells boilerplate.

Maybe I have missed something fundamental?

Thank you for your time, any help is appreciated Smiley
Pages: [1]
nelsongames (19 views)
2018-04-24 18:15:36

nelsongames (17 views)
2018-04-24 18:14:32

ivj94 (608 views)
2018-03-24 14:47:39

ivj94 (54 views)
2018-03-24 14:46:31

ivj94 (402 views)
2018-03-24 14:43:53

Solater (66 views)
2018-03-17 05:04:08

nelsongames (111 views)
2018-03-05 17:56:34

Gornova (177 views)
2018-03-02 22:15:33

buddyBro (747 views)
2018-02-28 16:59:18

buddyBro (94 views)
2018-02-28 16:45:17
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05 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‑
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!