Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
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  Discussions / General Discussions / John Carmack dissing java for mobile games! on: 2005-04-01 07:36:11
Here is the link to the blog:
http://www.armadilloaerospace.com/n.x/johnc/Recent%20Updates

Some quote:
Quote

It turns out that I’m a lot less fond of Java for resource-constrained work. I remember all the little gripes I had with the Java language, like no unsigned bytes, and the consequences of strong typing, like no memset, and the inability to read resources into anything but a char array, but the frustrating issues are details down close to the hardware.



The biggest problem is that Java is really slow. On a pure cpu / memory / display / communications level, most modern cell phones should be considerably better gaming platforms than a Game Boy Advanced. With Java, on most phones you are left with about the CPU power of an original 4.77 mhz IBM PC, and lousy control over everything.



I spent a fair amount of time looking at java byte code disassembly while optimizing my little rendering engine. This is interesting fun like any other optimization problem, but it alternates with a bleak knowledge that even the most inspired java code is going to be a fraction the performance of pedestrian native C code.



Even compiled to completely native code, Java semantic requirements like range checking on every array access hobble it. One of the phones (Motorola i730) has an option that does some load time compiling to improve performance, which does help a lot, but you have no idea what it is doing, and innocuous code changes can cause the compilable heuristic to fail.



Write-once-run-anywhere. Ha. Hahahahaha. We are only testing on four platforms right now, and not a single pair has the exact same quirks. All the commercial games are tweaked and compiled individually for each (often 100+) platform. Portability is not a justification for the awful performance.
2  Game Development / Networking & Multiplayer / Re: Java 5 Web Start import feature on: 2005-02-22 11:15:28
Yes, but for someone that does not have their games on your site, jnlp stuff, jardiff, even coding the program to be suited to be completely jar bundled etc etc, might not be a great solution...

I do however agree that the click to run thing is nice from a webserver. Actually thinking about how to use it as an alternative installer solution for our game. (That is, just download a very small jar file, that unzips a small program, which will then automatically run our patchupdate to download the appropriate patch (the whole game)).  Just to get the game into the operating system, start menus etc. For now we have been using InstallAnywhere as installation solution (and probably will in the future too), but I is tempting to perhaps make a webstart version as well.

Anyone done anything like it?

(Sorry for drifting off the topic, sue me Tongue)
3  Game Development / Networking & Multiplayer / Re: Java 5 Web Start import feature on: 2005-02-19 15:39:17
Quote
Oh, go on then, I'll take the bait (since I've no mod access): tell us WTF your product has to do with this, and what it does that makes it better than jws.


Well if you read the original poster, he is using jws to get "updating" of the software, but does not like it.
Here is a quote from his post:
Quote
We're focusing on web start since that gives us the nice update feature a multiplayer focused game needs to keep its players in sync when game-state affecting changes are made. However, we think that a web start link on our site is still too risky, because all users with a broken java and/or browser will never be able to run it.

So we're creating separate linux and win32 installers that do the following steps:

1. Install a private 1.5 jre
2. Unpack TT web start files (jnlp and jar files) to some temp. dir.
3. Use the new java 5 import feature (javaws -import) to inject TT into the web start cache.

It all works nicely, except for updates, which is whole reason for using web start in an offline installer.


With PatchUpdate you dont need webstart. I personally don't like webstart at all for keeping software updated. (Having only jar files for your app really _s u c k s_ imo). Seems like the original poster doesn't like it that much either, and is looking for another solution with their own installers.

PatchUpdate was created for such solutions. We actually created if for our own online game since webstart was a real mess when it comes to updating. The game is continously changing and files are added all the time, megabytes of music and graphics etc. And with a game consisting of 100+ mb of data, you dont really like webstart Tongue Also, you wish to update single files and not complete jar files (i heard you can use jardiff and shit with jws, but it was a mess too).

You can use PatchUpdate for free for non-commercial software.
4  Game Development / Networking & Multiplayer / Re: Java 5 Web Start import feature on: 2005-02-18 14:59:03
Check out the PatchUpdate API, free to use. Make easy, nice looking updating of your software.

http://patchupdate.mythicscape.com
5  Java Game APIs & Engines / Java Sound & OpenAL / What sound api should i use? on: 2005-01-30 17:02:11
I need a good sound api to use for a game. It should be able to:

- play wav and ogg files
- play several of sound files simultaneously (without one sound blocking out the others)

For example background music (an ogg file) should be able to play in the background and battle sound fx on top of that...

Can someone please help me figure out what exactly i should use to get this working?
6  Java Game APIs & Engines / Java Sound & OpenAL / Problem with playing sound files simultaneously on: 2005-01-22 22:44:10
Hello,

I am using the java sound to play sound files.

I'm using the javazoom spi:s for ogg and mp3 support.

http://www.javazoom.net/vorbisspi/vorbisspi.html

http://www.javazoom.net/mp3spi/mp3spi.html

However, i have a problem with playing two sound files at the same time with the same application. The weird thing is that some sound files work, you can play them simultaneously , but some other files might not work...

Anyone have any clue what may cause this?

Here is the code i'm using. SoundManager.java
It has two play methods, playMusic() and play(). It is coded so that it is only possible to play one single music at a time. But the problem occurs when for example calling playMusic() to start a music file, and then calling play() to play other sound fx on top of it. Some of the fx files will play, others wont...

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  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
import java.io.File;
 
import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.DataLine;
 
public class SoundManager{
     
      private String basePath;
     
      private PlayThread music;
     
      public SoundManager(String path){
            this.basePath = path;
      }
     
      synchronized private AudioInputStream getAudioInputStream(File file)
            throws Exception{
            return AudioSystem.getAudioInputStream(file);
      }
     
      synchronized private AudioInputStream getAudioInputStream(
                  AudioFormat af, AudioInputStream in){
            return AudioSystem.getAudioInputStream(af, in);
      }
     
      synchronized private DataLine.Info getInfo(AudioFormat af){
            return new DataLine.Info(SourceDataLine.class, af);
      }
     
      synchronized private SourceDataLine getLineInfo(DataLine.Info info)
      throws Exception{
            return (SourceDataLine) AudioSystem.getLine(info);
      }
     
      public void play(String filename){
            // This should open up a new play thread for the sound to play.
           PlayThread pThread = new PlayThread(basePath+"/"+filename);
            pThread.start();
      }
     
      public void playMusic(String filename){
           
            if (music != null){
                  music.abort();
            }
           
            music = new PlayThread(basePath+"/"+filename);
            music.start();
      }
     
      public void stopMusic(){
            if (music != null){
                  music.abort();
            }
      }
     
     
      private class PlayThread extends Thread{
            String filename;
           
            AudioInputStream din = null;
            AudioFormat  decodedFormat;
            AudioInputStream in;
           
            SourceDataLine line;
           
            boolean running = true;
           
            public PlayThread(String filename){
                  this.filename = filename;
                  playFilename(filename);
            }
           
            public void run(){
                 
                  try{
                       
                        byte[] data = new byte[4096];
                        line = getLine(decodedFormat);            
                       
                        if (line != null){
                             // Start
                           line.start();
                           
                            int nBytesRead = 0, nBytesWritten = 0;
                           
                            while (nBytesRead != -1 && running){
                                nBytesRead = din.read(data, 0, data.length);
                                 
                                if (nBytesRead != -1)
                                      nBytesWritten = line.write(data, 0, nBytesRead);
                            }
                        }
                       
                        line.drain();
                      line.stop();
                      line.close();
                     
                      din.close();
                      in.close();
                     
                  }catch(Exception e){
                        e.printStackTrace();
                        System.out.println("Failed to play sound file: "+filename);
                  }
            }
           
            public void abort(){
                  this.running = false;
            }
           
            private void playFilename(String filename){
                  try{
               
                        File file = new File(filename);
                        // Get AudioInputStream from given file.      
                       in = getAudioInputStream(file);
                       
                        if (in != null){
                              AudioFormat baseFormat = in.getFormat();
                             
                              decodedFormat = new AudioFormat(
                                          AudioFormat.Encoding.PCM_SIGNED,
                                          baseFormat.getSampleRate(),
                                          16,
                                          baseFormat.getChannels(),
                                          baseFormat.getChannels() * 2,
                                          baseFormat.getSampleRate(),
                                          false);
                              // Get AudioInputStream that will be decoded by underlying VorbisSPI
                             din = getAudioInputStream(decodedFormat, in);            
                        }
                  }
                  catch (Exception e){
                        e.printStackTrace();
                  }
            }
 
            private SourceDataLine getLine(AudioFormat audioFormat) throws LineUnavailableException{
             
                  SourceDataLine res = null;
                  //DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat);
                 DataLine.Info info = getInfo(audioFormat);
                  //res = (SourceDataLine) AudioSystem.getLine(info);
                 try{
                        res = getLineInfo(info);
                  }catch(Exception e){
                        e.printStackTrace();
                  }
                  res.open(audioFormat);
                  return res;
            }
      }
}



Any help is greatly appreciated.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (51 views)
2014-04-15 18:08:23

BurntPizza (48 views)
2014-04-15 03:46:01

UprightPath (63 views)
2014-04-14 17:39:50

UprightPath (45 views)
2014-04-14 17:35:47

Porlus (62 views)
2014-04-14 15:48:38

tom_mai78101 (86 views)
2014-04-10 04:04:31

BurntPizza (146 views)
2014-04-08 23:06:04

tom_mai78101 (243 views)
2014-04-05 13:34:39

trollwarrior1 (202 views)
2014-04-04 12:06:45

CJLetsGame (209 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22: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!