Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (672)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 4 5 [6] 7 8 ... 10
 51 
 on: 2016-05-02 21:29:21 
Started by LukeD - Last post by LukeD
I'm making a simple text adventure as an exercise. Well, I say simple; I'm having it run in two threads, because I want the game world to be continuously updated, whilst java's Scanner freezes the thread to listen for user input, which isn't what I want.

So, I have to put the scanner in another thread. Hence, I currently have:

Game.class
and
InputConsole.class

Here's what I have in InputConsole, currently:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
package textAdventure;

import java.util.Scanner;

public class InputConsole extends Thread {

   Scanner userInput = new Scanner(System.in);
   long lastInTime = System.currentTimeMillis();
   long thisInTime = lastInTime;
   String input = "";
   
   public void run() {
      while(true) {
         lastInTime = thisInTime;
         if(userInput.hasNextLine()) {  
            input = userInput.nextLine();
            thisInTime = System.currentTimeMillis();
            System.out.println(input);
         }
      }
   }
}


Now, I want to pass on the value of userinput to my Game class, with a little notification that "hey, this variable is newly changed!". What's a good way of doing this?

Some suboptimal solutions that occurred to me are just things like:

- in Game.class, check the input class for a new time stamp, and if so, grab the new string
- in Input class, change corresponding variables in Game.class

But, is there not something a bit tidier than this? Maybe something akin to action listeners?

 52 
 on: 2016-05-02 19:51:24 
Started by FabulousFellini - Last post by FabulousFellini
Screenshot of one of the acts in level 3, "The Woods".



Obviously there is nothing yet except the terrain.  Next up, adding badguys.

Edit:  Forgot to post the newest demo with better collision detection:
https://www.dropbox.com/s/i8ekwbw1capvfyn/DD_IAN.jar?dl=0

 53 
 on: 2016-05-02 19:15:27 
Started by ThePhotonicPizza - Last post by Riven
Offtopic: passing null to glTexImage2D is tricky, not because it is theoretically incorrect, but it trips up drivers occasionally. Among other issues, it can leave a texture in a state that makes it unusable in an FBO (non-deterministically). I had a loop that created a few hundred FBOs and 1-3% would be 'incomplete' and always render as white. After forcing the textures to be initialized with arbitrary texels, the problem went away. Just allocate 1 buffer in your app and use it to initialize all textures that are not 'naturally' filled with data.

 54 
 on: 2016-05-02 19:10:05 
Started by Spasi - Last post by Spasi
There's a new lmdb branch in the LWJGL 3 repository that implements bindings to LMDB. It's an embedded key-value store that may be used for all kinds of persistence, from game settings to shaders, models and textures (binary values up to Integer.MAX_VALUE in size are supported).

See this presentation to understand what's special about LMDB.
See this LWJGL sample for a demo of the API and an example of zero-copy string persistence.

The nightly builds do not include LMDB yet, you'll have to clone LWJGL and build locally to give it a try. I'll decide what to do after the 3.0.0 release, but it's definitely small enough to embed in the standard LWJGL distribution. Please let me know if you're interested.

 55 
 on: 2016-05-02 18:10:46 
Started by BurntPizza - Last post by FabulousFellini
Finally started the process of building my arcade cabinet to house my games.  First step, sanding the wood, is done.  Next step is the T-molding, then paint.  Here is the housing I bought:

http://www.ebay.com/itm/Table-or-Bartop-Arcade-Cabinet-Machine-Cut-High-Quality-Wood-/281767254716

It's good quality and already cut really well, you just have to sand it down.  I'll keep you updated on the progress and post picutres as they come.

 56 
 on: 2016-05-02 16:23:50 
Started by Fishbreath - Last post by Fishbreath
I'll look into that. It's a backwards-compatible change, which is niceā€”don't have to bump the protocol version or anything.

In the interim, I've just been reserving 250-500ms for comms overhead and extracting the primary variation after search stops.

 57 
 on: 2016-05-02 16:02:42 
Started by Fishbreath - Last post by ags1
I was thinking you could change the move command from:

a3-a1

to:

a3-a1 1000

Where 1000 is the ms to wait for a better move from the AI. If the current overtime would expire, play this move rather than expiring the overtime.

Otherwise millisecond mismatches (quite possible with comms by stdin and stdout) can cause an AI to run out of its overtimes.

 58 
 on: 2016-05-02 14:30:57 
Started by blobloblob - Last post by CommanderKeith
I (honestly) was thinking about that solution too - but it makes your (gameplay) framerate issues even worse, especially when vsync is on.
If it's dynamic enough and only activates at <half the monitor's refresh rate, it should be OK. It might improve the perceived responsibility.
Could you also just repaint the small cursor and the small 'dirty' section where it used to be painted? Might save some time.

 59 
 on: 2016-05-02 13:55:05 
Started by blobloblob - Last post by jonjava
Make it run at 60 FPS.

Or 24 fps for a cinematic look.

 60 
 on: 2016-05-02 13:31:10 
Started by blobloblob - Last post by blobloblob
Perhaps maybe it would be possible to create an "overlay" GL context and drawable on top of the existing one? Could this be a solution, or I miss some point? What you think?

Pages: 1 ... 4 5 [6] 7 8 ... 10
 
IanParcs (48 views)
2016-04-18 14:18:53

KaiHH (46 views)
2016-04-18 08:35:41

KaiHH (76 views)
2016-04-15 12:43:58

theagentd (79 views)
2016-04-14 02:16:17

theagentd (94 views)
2016-04-14 02:15:43

IanParcs (106 views)
2016-04-12 03:51:16

IanParcs (48 views)
2016-04-12 03:50:03

IanParcs (44 views)
2016-04-12 03:49:54

IanParcs (39 views)
2016-04-12 03:49:52

IanParcs (49 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12: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!