Java-Gaming.org Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (649)
Games in Android Showcase (181)
games submitted by our members
Games in WIP (699)
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 ... 5
1  Discussions / Miscellaneous Topics / Re: How do I get Java and Javascript working together? on: 2016-02-03 22:13:08
Why not try (marytts)

http://mary.dfki.de/index.html

Thanks, I will try it.

Wait, what are you using the javascript for? Text to speech is not an answer. And why would you need the window/document/DOM?

It makes no sense.

"Text to speech is not an answer", I beg to differ, http://responsivevoice.org/api/ if you search in the code, you will see that it uses both the window and document objects.
2  Discussions / Miscellaneous Topics / Re: How do I get Java and Javascript working together? on: 2016-02-03 18:49:13
- where does your application run? (Clients PC, server?)
The application run on a clients PC, on start up it connects to a PHP script using TCP sockets.

- how is it started? (Script, service, clickable jar)
The client is simply started by double clicking the jar, and reads a .properties to get the IP and Port it should connect to.
The server is started by a cmd command "php -f <path to a .php file>"

- does it have an UI?
Yes, most of the time it shows a list of users, and sometimes questions.
The interactions are limited to Yes, No, Pin, and RFID Tags

- what does the javascript do?
Text to speech. My boss and I tested several ways to get this feature into the java application, at one time we used google text to speech site, to download the audio files. But now google have added methods to prevent that, and ever since we have tried to find a alternative which supports our native language.

- why should it be integrated?
The application will be used to conduct surveys where most members have poor eyesight, can't read, or have other handicaps

- what does your application actually do?
Its main function is to stamp in and out for shifts, and as well as conduct surveys when it needs to.

- is it run by a single client or should it support multiple users in parallel?
The server support multiple clients to be connected at once, and aside from the surveys, show mostly the same data on all of them.


I talked to my boss today, and we think using javascript and canvas would be the best solution. While I don't like abandoning the java client, at the moment it seems to be the only solution.
3  Discussions / Miscellaneous Topics / Re: How do I get Java and Javascript working together? on: 2016-02-02 22:34:57
I think you're looking for Nashorn

I have tried that, sadly the Javascript functions have document and window inside of them, and from my testing, Nashorn don't like those.
4  Discussions / Miscellaneous Topics / How do I get Java and Javascript working together? on: 2016-02-02 22:16:40
I have been working for the past year on a java application, and so far it have been working well. But today my boss wanted to run some javascript code in my program. We talked and researched on how we could achieve this. Sadly nothing we have tried work, so when I got home I decided to see if I could reprogram the java application into a applet, and then invoke the javascript functions that way. But I have a hard time getting the applet to even run. All I get is java.lang exceptionininitializererror. I been doing some research and many advice to stay away from applets.

So I'm not sure what to do, I could talk to my boss, and see if I could reprogram the whole thing in HTML5 using that and Javascript, while I can do that, I don't have that much time until a client is going to look at the program. Is there another way, or do I simply have to work overtime to do it?
5  Discussions / Miscellaneous Topics / Re: Looking for a old wipeout-like game on: 2015-12-26 10:57:06
Sadly I haven't found it. I wish I could remember more about it. But all I can remember is what I have already said.

Also, it can be that the levels I remember was gray, or I don't remember it right.
6  Discussions / Miscellaneous Topics / Re: Looking for a old wipeout-like game on: 2015-12-24 06:24:48
Oh, sorry. It was on PC, I believe I got the game in a demo disk from a Swedish magazine called, "komputer för alla"

It wasn't Hi-Octane, I wish i could explain in more detail, but I simply don't recognize the game after watching some game play on youtube.
7  Discussions / Miscellaneous Topics / Looking for a old wipeout-like game on: 2015-12-23 00:20:30
This is driving me crazy, I been searching for a game I played when I was a kid. I don't know an exact date, but it must been around the 2000's. It was a racing game which had hover cars, I seem to remember that between each race the player could buy new cars and upgrades, it was one of those early 3D games, and it was much gray in the game. Is there anyone that knows what game it could have been?
8  Game Development / Newbie & Debugging Questions / What's the best way to send data to another client via byte array? on: 2015-12-20 13:00:53
So I been using this method to send data between applications for a long time. I turn everything into a string with delimiters, after that it's just to use .getBytes and send it on it's way. When the receiver gets it, I just simply convert the byte array back into a string, and split it, then I just simply convert it back into what it was; Int, long, boolean, and so on. But I like to know, is there a more common/better way of doing it?
9  Game Development / Networking & Multiplayer / Re: UPD not really fire and forget on: 2015-12-19 03:46:46
Okay, so I re-wrote my Server and Client objects, then setup the sockets I had when I started this thread, and now it works perfectly. I have no idea why, but I guess I messed up the send or receive methods yesterday, and now when I re-coded them, I didn't. I even send the .jar to a friend which live in another country, and while we get a ping around 400, I still get the messages.
10  Game Development / Networking & Multiplayer / Re: UPD not really fire and forget on: 2015-12-18 21:15:59
It was meant to be a while loop all along, I simply did a mistake. Sadly my current code just allow local IP addresses. I done everything I can, but I can't get it to work over the net.

Did you port-forward the port for UDP on the listener (the server)? And I assume you don't bind the client sockets to ports do you?

Giving up? How about this then: http://www.jfastnet.com/ it's from a member on our forum. (Haven't used it myself though)

Yes, I have port forward the two ports I'm using, and even tried turning off my firewall (including the one in the router). The strange thing is, it's always the Clients server's port that don't get any reply, except when I use 127.0.0.1 or 192.168.10.220

Call my stubborn, but I don't like using libraries. I'll try to solve this a bit longer before I move to TCP.
11  Game Development / Networking & Multiplayer / Re: UPD not really fire and forget on: 2015-12-18 20:48:39
It was meant to be a while loop all along, I simply did a mistake. Sadly my current code just allow local IP addresses. I done everything I can, but I can't get it to work over the net. Soon I just give up and use TCP anyway.
12  Game Development / Networking & Multiplayer / Re: UPD not really fire and forget on: 2015-12-18 18:58:22
Yes, I test on the same machine.

So I changed do the Client object now have a DatagramSocket too, and got another problem. That socket only resives the first message it gets, and then it stops working. Even if the server keeps sending data.

It's not much, but I get "Client: waiting....", and then the data that was received. But it never loops back around.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
    @Override
    public void run() {
        //This code was meant to receive the messages from the server, so the game didn't freeze if it didn't get any.
        if(true){
            try{
                System.out.println("Client: Waiting...");
                byte[] buffer = new byte[1024];
                DatagramPacket pack = new DatagramPacket(buffer, buffer.length);  
                server.receive(pack);
               
                System.out.println(new String(pack.getData()));
                //read(new String(pack.getData()));
            }catch(Exception e){
                e.printStackTrace();
            }
        }
    }



EDIT: I'm testing another solution, each Client object, will have two client sockets. It connects to the server with both, and then the server uses one of them as a receiver and the other as sender.

EDIT 2: Nvm, it didn't work
13  Game Development / Networking & Multiplayer / [Solved] UPD not really fire and forget on: 2015-12-18 17:32:00
First off, I never been good at networking. I have manage to get TCP/IP to work, but never really used UDP, so sorry for any beginner mistakes. Anyway, I have starter to make my own game, and decided to use UDP, since it doesn't really matter if some data get lost. However, so far it's not really as fire and forget as I had hoped.


This is difficult for me to explain, but I'll do my best. So I created a "Client" object, which contains a simple send method, which sends data via this little code

1  
2  
3  
byte[] bytes = data.getBytes();
DatagramPacket pack = new DatagramPacket(bytes, bytes.length, adress, port);
client.send(pack);


then I assumed the server would send the data back via the same DatagramSocket, and I knew that .receive freezes the method/game until it manage to receive something. So I made a different thread for it
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
@Override
    public void run() {
        if(true){
            try{
                byte[] buffer = new byte[1024];
                DatagramPacket pack = new DatagramPacket(buffer, buffer.length);  
                client.receive(pack);
               
                String sData = new String(pack.getData());
                read(sData, pack);
               
            }catch(Exception e){
                e.printStackTrace();
            }
        }
    }


But it never receive's anything, I had to change my send code for me to be able to receive the message from the server.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
public void send(InetAddress adress, int port, String data, boolean receive){
        try{            
            //Send data to the server
            byte[] bytes = data.getBytes();
            DatagramPacket pack = new DatagramPacket(bytes, bytes.length, adress, port);
            client.send(pack);
           
            //This is my make shift code to get the reply from the server.
            //Sadly if this doesn't get a reply it freezes the game.
            if(receive){
                //Wait to receive an answer
                byte[] buffer = new byte[1024];
                DatagramPacket back = new DatagramPacket(buffer, buffer.length);
                client.receive(back);
                read(new String(back.getData()), back);
            }
           
            //Somehow it doesn't send the data without this
            Thread.sleep(1);
           
        }catch(Exception e){
            e.printStackTrace();
        }
    }


Am I missing something here, if UDP is suppose to fire and forget, why do I need to wait for a response? or am I not understanding something here?




P.S The server send code is
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void send(String data, InetAddress address, int port){
        try{
            //Just a simple send data function, not much to it.
            byte[] sendData = data.getBytes();
            DatagramPacket send = new DatagramPacket(sendData, sendData.length, address, port);
            server.send(send);
        }catch(IOException e){
           
        }
    }
14  Discussions / Miscellaneous Topics / Re: Battlestation Thread on: 2015-10-30 08:36:47
I have to admit that I cleaned it up before posting, otherwise it would be filled with paper, coke cans, and cat hair.

15  Discussions / Miscellaneous Topics / Re: pack multiple files into one in java on: 2015-10-29 21:50:56
I was hoping there was a better way to do it. But it seems like I have to do it that way.

Edit: I'm now finished with my zipping code, and it turned out better than I thought. My worry was that I would keep recreating the same zip over and over again, but then I realized that I could just generate all the thumbnails in a temp folder, and then zip all at once, so only one recreation of the zip file is needed.
16  Discussions / Miscellaneous Topics / pack multiple files into one in java on: 2015-10-29 20:01:45
So I'm working on a program which will make it easier for me to organize my image files. However I have run into a problem, I would like to zip the thumbnails the program generates when it detects a new image. But this is more difficult than I thought in java, since it's not possible to add a new file to an existing zip file, instead the whole zip file must be recreated. So I'm wondering, is there any other way to bundle the thumbnails into a single file? 
17  Discussions / Miscellaneous Topics / Re: How well does this work? on: 2015-06-10 06:13:19
My PC had around 220 fps with these specs: (Win 7, GTX 970, 8GB RAM, i5-3570k CPU) - Chrome
And my laptop had 114 fps with these specs: (Win 8, i3 CPU, 4GB RAM, integrated chip) - Chrome

Seems a little low on the 1st one O.o are you limiting the FPS?

Edit: Mouse moves/acts very nice as well Smiley

Edit: Tested on my Windows phone xD 50-60fps. Nokia Lumia 735

No, there is no fps limit, the render function recur again the moment it's complete.
Good to know it worked on the phone too, I will probably do phone version sometime, but the main platform will always be computers.
18  Discussions / Miscellaneous Topics / How well does this work? on: 2015-06-09 21:23:51
I have just started to create an isometric game using javascript and html5, later I will add php and MySQL so I can make it to a proper game, now it's just a test project. But I would like to know if there is any problems with it now, the fps you get, and how accurate the mouse is.

EDIT: ops forgot the link ^^"
http://creaturecontroller.com/battle/arena.php
19  Discussions / Miscellaneous Topics / Re: Trouble with 3D hitscan on: 2015-05-19 07:35:03
Well the idea is that I override x, y, an z in each iteration because I advance the point. So the first iteration would be right in front of me, while every other iteration would be a bit farther along. Then I return the point where I hit something, so I end up with yaw, pitch, and distance to the object I'm aiming at.
20  Discussions / Miscellaneous Topics / Re: Trouble with 3D hitscan on: 2015-05-18 19:14:02
Are you hitting your own player?

Ops, clicked wrong when I was going to click "quote". Anyway, Sometimes, other times the shot goes straight up in the air.
21  Discussions / Miscellaneous Topics / Trouble with 3D hitscan on: 2015-05-18 19:05:25
This isn't programmed in Java, so that's why I put it here. But since it's math, people here should be able to understand it. I'm trying to make a hitscan script in a 3D space, but it doesn't work right at all, since it always "detects" that I aim at my feet, and not where I aiming at. So I want to know, if the problem the math, or somewhere else?

1  
2  
3  
4  
5  
6  
7  
lv_x = Sin(lv_pitch) * Cos(lv_yaw);
lv_y = Sin(lv_pitch) * Sin(lv_yaw);
lv_z = Cos(lv_pitch);

lv_x = PointGetX(CameraGetTarget(lp_player)) + (lv_x * lv_distance);
lv_y = PointGetY(CameraGetTarget(lp_player)) + (lv_y * lv_distance);
lv_z = lv_cameraHeight + (lv_z * lv_distance);


lv_distance increases by 1 in a while loop until it hits something.
lv_pitch and lv_law is both in degrees.
22  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:52:31
This is another askyahoo situation isn't it? where no one have an opinion or thought on their own, instead they just go to sources to give the absolute definition.

Or your responses are well educated.

I am currently studying defining languages and such in Formal Languages and Automata class, which is done in Software Engineering and Computer Science at my uni.

Good for you, but I'm looking for peoples opinions. Otherwise I would have searched up the answers myself.
23  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:45:46
This is another askyahoo situation isn't it? where no one have an opinion or thought on their own, instead they just go to sources to give the absolute definition.
24  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:23:20
that is, if it's not Turing complete, you might simply consider it "data" instead, to be processed by some other program into something more tangible.

Cas Smiley

Excuse me if I sound rude, but what are you talking about? and how did you come to that conclusion from my thread? I was simply asking what people consider a programming language to be, and gave the example that I count java, php, javascript, and SQL as a programming language, while I don't count css and html.
25  Discussions / Miscellaneous Topics / Re: What do you define as a programming language? on: 2015-05-01 10:12:21
Turing Complete is a good place to start.

Cas Smiley

Start where?
26  Discussions / Miscellaneous Topics / What do you define as a programming language? on: 2015-05-01 09:50:47
Often when people ask me what programming languages I know/use, I often answer "php, java, javascript, and basic SQL". Even if I can html and css I mostly don't count those since they don't have the logic php, java, and javascript have, while SQL being on the border since it have a few functions/methods. I just wonder, how many leave out languages like that?
27  Discussions / Miscellaneous Topics / Make the simplest code unreadable on: 2015-02-24 13:20:48
Just for fun I made a simple code, as unreadable as possible.

The result:
1  
2  
3  
4  
5  
    public static void main(String[] args) {
        String txt = "";
        for(int i=0; i<6; i++){txt += txt .length() == 0 ? "h" : txt .length() == 2 ? "j" : i == 3 || i == 4 ? (txt .charAt(txt .length()-1) == ' ' ? "d" : " ") : i == 5 ? "å" : "e";}
        System.out.println(txt);
    }


I would love if you could make your own version, and see how bad it can get.
28  Discussions / General Discussions / Randomly generated items on: 2015-02-24 09:38:00
I'm working on an RPG, and have been thinking if I should make randomly generated items, or only have pre-made items. It would be nice to have thousands of items. But I'm afraid of the items getting dull, when it's just X copies of the same item. Then I was thinking of maybe randomly generate gray, white, and some of the blue items. But any quality better then that, are pre-made. I would like to know what you think.
29  Discussions / General Discussions / Re: Do you sometimes skip braces? on: 2015-02-08 06:37:58
Usually if I need a simple if-else statement I do things like this.

1  
2  
3  
4  
5  
//example 1
return map.contain(key) ? map.get(key) : null;

//example 2
bgColor = bgColor == Color.gray ? Color.white : Color.gray;


That way I skip large if statements, and to me that's perfectly readable.
30  Discussions / General Discussions / Do you sometimes skip braces? on: 2015-02-08 05:39:15
This isn't a thread about if it's a good/bad idea to skip braces, I just want to know if you personally do it, and if you do when?

I normally skip braces in loops if I don't need them, especially if it's two loops, a if statement, and then a method. Since I don't think having three end braces in a row improve readability of the code. But I never skip braces if I need to use a else statement, since I think that makes it more difficult to read the code.
Pages: [1] 2 3 ... 5
 
KaiHH (75 views)
2016-01-31 23:15:29

sci4me (102 views)
2016-01-23 21:47:05

sci4me (88 views)
2016-01-23 21:46:58

KaiHH (122 views)
2016-01-19 13:26:42

theagentd (205 views)
2016-01-05 17:10:00

ClaasJG (223 views)
2016-01-03 16:58:36

chrisdalke (211 views)
2015-12-28 06:31:21

Guerra2442 (235 views)
2015-12-25 03:42:55

Guerra2442 (232 views)
2015-12-25 03:27:21

theagentd (286 views)
2015-12-21 14:43:24
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

Rendering resources
by Roquen
2015-10-15 07:40:48
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!