Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (574)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (620)
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 ... 74
1  Discussions / General Discussions / Re: Which Smartphone should I choose??? on: 2015-04-08 18:36:49
The reason for the samsung being more expensive is that it has the better processor with better integrated GPU. It is considered middle class while the one in the micromax leans more towards low end,  since it has an older architecture and inferior GPU.
2  Game Development / Newbie & Debugging Questions / Re: Questions about creating a level editor. on: 2015-04-06 17:31:42
I found that Databases provide an organized way to save game data. Would that be a viable option for a small game or should I just stick to text files? I just want something that a player could not easily break or cheat by changing its text.
Organize your gamestate in some kind of model with your dynamic runtime specific objects like renderers and such as transient fields where needed and use xstream to load and store this model as json or xml. This is simple to set up and quite powerful.  If you really need to hide the savegames from your users, you can wrap the in and outputstreams in some kind of obfuscator or encryption later. Trust me, you'll want to have human readable savegames during development.
3  Discussions / General Discussions / Re: Arraylists of arraylist as a representation of relationships/adjacency in graphs on: 2015-03-30 12:22:06
You have a typo in your else if branch:
1  
else if(e1.p2.x == e.p1.x && e1.p2.y == e.p1.y && !adjLists.contains(e1.p1.x) && !adjLists.contains(e1.p1.y))


should probably be
1  
else if(e1.p2.x == e.p1.x && e1.p2.y == e.p1.y && !adjLists.get(j).contains(e1.p1.x) && !adjLists.get(j).contains(e1.p1.y))


Overall it's easier to read and more performant to store adjLists.get(j) into a variable anyway:
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  
        for(int i=0; i<vertexnum; i++){
            adjLists.add(new ArrayList<Integer>());
        }

        for(int j=0; j<vertexnum; j++) {
            ArrayList<Integer> aList = adjLists.get(j);
            for (Point p : nodes) {
                for (Edge e : edges) {
                    aList.add(e.p1.x);
                    aList.add(e.p1.y);
                    aList.add(0);

                    aList.add(e.p2.x);
                    aList.add(e.p2.y);
                    aList.add(0);
                    for (Point p1 : nodes) {
                        for (Edge e1 : edges) {
                            if (e1.p1.x == e.p1.x && e1.p1.y == e.p1.y && !aList.contains(e1.p2.x) && !aList.contains(e1.p2.y)) {
                                aList.add(e1.p2.x);
                                aList.add(e1.p2.y);
                                aList.add(0);

                            } else if(e1.p2.x == e.p1.x && e1.p2.y == e.p1.y && !aList.contains(e1.p1.x) && !aList.contains(e1.p1.y)){
                                aList.add(e1.p1.x);
                                aList.add(e1.p1.y);
                                aList.add(0);
                            }
                        }
                    }

                }
            }
        }
4  Discussions / Miscellaneous Topics / Re: Python Load Balancing. on: 2015-03-29 12:37:28
Python explodes in flames!
Yeah, I laughed, too, but it's probably FUD.

I have no indepth knowledge about python, but there are things like Zope and CerryPy, which is even used by Netflix, so its safe to assume, that python can handle heavy loads and multiple requests just fine.
 
5  Game Development / Newbie & Debugging Questions / Re: Using a single array for enemy and friendly entities? on: 2015-03-24 19:51:14
ok, so what exactly do you want?

- find all enemy ships for all ships?
- find any enemy ship for all ships?
- find all enemy ships for the currently selected ship?
- find any enemy ship for the currently selected ship?

Edit:
craftms solution is finding all enemies for all ships and offers a codeblock for them to engage in a fight -> this might exaclty be, what you want...
6  Java Game APIs & Engines / Java 2D / Re: vignette shader dons't work on: 2015-03-21 12:30:27
gl_FragCoord is alway the absolute coordinate of the pixel in the frame buffer, hence on the full screen.  You need to pass in the "texture coordinates" from your vertex shader.  See http://www.lighthouse3d.com/tutorials/glsl-core-tutorial/glsl-core-tutorial-texture-coordinates/ for more explanation. It's the same principle, even without applying a texture image.
7  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-14 14:37:39
Smoke tested my Arduino project: LED Music Visualization Frame:

<a href="http://www.youtube.com/v/emn7pw13G_E?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/emn7pw13G_E?version=3&amp;hl=en_US&amp;start=</a>
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-06 00:49:23
Space Ship Hygiene Simulator 2057
Smiley

What happens if two guys try to occupy the same bath tube?  Shocked
9  Discussions / General Discussions / Re: jgo on mobile on: 2015-02-23 17:54:02
Any chance for jgo to have the text reflow on mobile? If I zoom so I can read the rest, I have to scroll back and forth every sentence.
+1 from me.  Same resolution.
10  Discussions / Miscellaneous Topics / Re: Netbeans DataObject reference in other DataObject on: 2015-02-22 16:42:24
You'll probably need to anyway if you want to do more with Netbeans RCP.  Cool
11  Game Development / Newbie & Debugging Questions / Re: I'm trying to make a shotgun and this is happening on: 2015-02-22 16:29:58
Has been asked before: http://www.java-gaming.org/topics/bullet-shooting-in-mouse-direction/34029/view.html
Just use vectors right and don't use degrees...

Edit: was a bit quick with my response and missing the point... yeah show more code and mockup the result you want to have in an image editing program. Looking at the provided image, it seems like the angle is reapplied to the bullet each frame!?
12  Discussions / Miscellaneous Topics / Re: Netbeans DataObject reference in other DataObject on: 2015-02-22 16:23:18
Probably better post here: http://forums.netbeans.org/platform-users.html
13  Game Development / Newbie & Debugging Questions / Re: LibGDX Tilemap Null Tiles on: 2015-02-20 20:35:15
1  
map.getLayers().get(1) 

Off-By-One?  Are you sure you don't want get(0) ?
14  Game Development / Newbie & Debugging Questions / Re: Realtime 3D Terrain Splat Mapping on: 2015-02-19 17:53:18
Anything wrong with projecting to the FBO?  Sounds reasonable...
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-17 06:56:04
Parallax scrolling is the <marquee> of 2012-2015 Wink
Meh. I think it looks great!
16  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-16 23:20:28
Added triplanar texture coordinates generation to my texture "synthesis" shader:


17  Discussions / General Discussions / Re: What's your day job? on: 2015-02-16 15:45:13
In my free time, I work on LWJGL and (try to) raise a little girl.
Good luck! Mine is 4 and I (nearly) gave up on raising and moved on to survive Wink
18  Game Development / Game Mechanics / Re: Ideas for calculating when to generate new tiles. on: 2015-02-15 23:11:54
Usually you split the current region into quadrants and always have the 3 other regions generated/preloaded that connect to that quadrant:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
+---------+---------+---------+
|         |         |         |
|    A    |   A/D   |    D    |
|         |         |         |
+---------+----+----+---------+
|         | A *| D  |         |
|   A/B   +----+----+   D/C   |
|         | B  | C  |         |
+---------+----+----+---------+
|         |         |         |
|    B    |   B/C   |    C    |
|         |         |         |
+---------+---------+---------+

So here the middle of this 9 cells is your current region and the player (the *) is in quadrant A of it, so you need to generate the 3 top-left regions to allow seemless transition.
19  Discussions / General Discussions / Re: What's your day job? on: 2015-02-15 22:57:49
Freelance everything working mostly for insurance companies. Currently something between dev-op, cloud-manager, systems-engineer and portal-troublemakershooter...
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-14 08:26:40
Hey @cylab, I tried out your plugin (...)
I have to clarify that it is not my plugin,  I just forked the existing one and fixed some stuff.
21  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-13 23:27:47
I do python lately because we move our IT automation over to ansible and didn't like it at first. But after needing to write some of the automation stuff in java with heavy json modification, I was bewildered how awful it felt compared to the ease it was with python.

Regarding tabs and spaces. Just make sure you follow PEP 8 style guide for python and switch you IDE to show whitespaces (which is default for me anyways)
22  Game Development / Newbie & Debugging Questions / Re: WorkerThread, how to pass an undefined method to be executed..? on: 2015-02-13 23:15:43
Actually I was refering to the program organization when writing my post, since the problem with offloading arbitrary stuff to an external thread is that you have to manage what to do with the result, etc. somehow. This is difficult, if the isDone() polling and get()-result handling is in the gameloop, while the executor call is somewhere completely else. So having the callback, ensures that you don't have to put your code all over the place.

But yes, I should not have divagated to Guava, so here is an implementation without it:
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  
57  
58  
59  
60  
61  
62  
63  
64  
  // this rolls the callable and the callback in one interface
  public interface CallbackCallable<T> extends Callable<T>
  {
    // while the call() from callable should be called on the thread of the thread-pool
   
    // the following two should run on the gl thread
    void onSuccess(T result);
    void onFailure(Throwable thrown);
  }

  // ...

  // to get over the result from the future to the gl thread, a bridge is needed
  public class GLThreadBridge
  {
    // this connects the Future with the Callable that created it.
    private static class CallbackHolder<T>
    {
      Future<T> future;
      CallbackCallable<T> callback;

      public CallbackHolder(Future<T> future, CallbackCallable<T> callback)
      {
        this.future = future;
        this.callback = callback;
      }
    }

    // the pool
    private final ExecutorService pool = Executors.newFixedThreadPool(7);
    // and the callback queue
    private final ConcurrentLinkedQueue<CallbackHolder> holders = new ConcurrentLinkedQueue<CallbackHolder>();

    // to submit the tasks
    public <T> void submit(CallbackCallable<T> task)
    {
      holders.add(new CallbackHolder<T>(pool.submit(task), task));
    }

    // this handles the future polling and result callback calls
    public void handleFinished()
    {
      for (Iterator<CallbackHolder> iterator = holders.iterator(); iterator.hasNext(); )
      {
        CallbackHolder holder = iterator.next();
        try
        {
          if(holder.future.isCancelled())
            throw new InterruptedException("Task was cancelled");

          if(holder.future.isDone())
          {
            holder.callback.onSuccess(holder.future.get());
            iterator.remove();
          }
        }
        catch (Throwable t)
        {
          iterator.remove();
          holder.callback.onFailure(t);
        }
      }
    }
  }


Now you can use the bridge to submit callables with integrated callbacks:
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  
  // put this somewhere, you can access it
  GLThreadBridge glThreadBridge=new GLThreadBridge();

  // ...

  // this is an example how to use the submit method...
  void offloadToPool()
  {
    glThreadBridge.submit(
      new CallbackCallable<Chunk>()
      {

        // will be called on external thread
        @Override
        public Chunk call() throws Exception {
          return loadChunk();
        }

        // will be called from gameloop
        @Override
        public void onSuccess(Chunk loaded) {
          // do something with loaded
        }

        // will be called from gameloop
        @Override
        public void onFailure(Throwable thrown) {
          // handle a failure somehow
        }
      }
    );
  }


To move execution of the onSuccess()/onFailure() methods to the gameloop/gl-thread, handleFinished() has to be called at the beginning of the loop:
1  
2  
3  
4  
5  
6  
7  
8  
9  
  // and this shows how to integrate it in the gameloop...
  void gameLoop()
  {
    while(true)
    {
      glThreadBridge.handleFinished();
      //...
    }
  }


Disclaimer: I just wrote it down and didn't try it, so it might need more work to actually... well... work Wink
23  Game Development / Newbie & Debugging Questions / Re: WorkerThread, how to pass an undefined method to be executed..? on: 2015-02-13 22:22:08
This is solved by Future.
Well, read my post?
24  Game Development / Newbie & Debugging Questions / Re: WorkerThread, how to pass an undefined method to be executed..? on: 2015-02-13 22:14:51
Actually the biggest problem is usually not the thread execution, but getting the result back to the GL thread: With google guava, you would probably do something like this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
ListeningExecutorService pool = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10));
Futures.addCallback(
   pool.submit(new Callable<Chunk>() {
      public Chunk call() {
         return loadChunk();
      }
   },
   new FutureCallback<Chunk>() {
      public void onSuccess(Chunk loaded) {
         // do something with loaded
      }
      public void onFailure(Throwable thrown) {
         // handle a failure somehow
      }
   },
   myGameloopExecutor // execute the callbacks on the gameloop
);


You would need to implement your own GameloopExecutor by minimally implement the AbstractExecutorService class and store the Runnables and Callables you get in a Queue that you could execute at the start of the gameloop.
25  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-13 21:54:45
Where does that else clause even set in? It's he lower if, isn't it?

Yep it's really
1  
2  
3  
4  
5  
6  
7  
8  
9  
if(nested()) {
   if(stillNesting()) {
      for(int count =  0; count < nestAmount; count++)
         for(int dex =  0; dex < nestAmount * 2; dex++)
            initMindExplosion(fetalPosition);
   } else {
      whenWillIdoIt();  
   }
}

26  Game Development / Newbie & Debugging Questions / Re: WorkerThread, how to pass an undefined method to be executed..? on: 2015-02-13 21:35:13
Also refrain from misusing reflected methods. Just let the user pass in a runnable...
27  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-13 21:27:45
Fixed some stuff in the GLSL-plugin for Intellij Idea

It now also works correctly with IDE themes, like e.g. Dracula:
28  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-13 21:05:35
1  
2  
3  
4  
5  
6  
//This makes my brain go numb.
if(nested())
   if(stillNesting())
      for(int count =  0; count < nestAmount; count++)
         for(int dex =  0; dex < nestAmount * 2; dex++)
            initMindExplosion(fetalPosition);


hehe, I do exactly this, but the following is super evil:
1  
2  
3  
4  
5  
6  
7  
8  
// Some guess-work here ...
if(nested())
   if(stillNesting())
      for(int count =  0; count < nestAmount; count++)
         for(int dex =  0; dex < nestAmount * 2; dex++)
            initMindExplosion(fetalPosition);
else
   whenWillIdoIt();  

29  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-02-13 20:36:39
Quote
Estimated balance at 2017-02-13:    $239
Wow, you'll be rich!
30  Games Center / Showcase / Re: Spinner Tronic -- an unique arcade experience! on: 2015-02-13 20:34:42
The second track is MUUUUUUCH better (imho) Pointing

Other feedback pending...
Pages: [1] 2 3 ... 74
 
Riven (28 views)
2015-04-16 10:48:47

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

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

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

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

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

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

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

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

ags1 (69 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!