Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (601)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
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 ... 40
1  Game Development / Shared Code / Phase Modulation for Synthesizers on: 2015-07-27 19:24:21
On nsigma's request (from the "Extremely Fast sine..." thread)

The code is actually being used for phase modulation at this point, not frequency modulation. So maybe I should change the name to PMOp. While I was developing, I had some actual frequency modulation implementations as well but have "phased" them out.
1  
2  
3  
4  
5  
6  
public interface FMOp
{
   float get();
   float get(float modAmt);
   void setFrequency(float freq);
}


The initials PML derived from Phase Modulation Lookup. I previously had tried calculating the sine values, but couldn't find an algorithm fast and accurate enough to compete with the lookup I'm using (1024 unit table with linear interpolation, posted on the thread cited below). I'd be most grateful to learn of a faster method (will be reading closely and trying out methods from here: http://www.java-gaming.org/topics/extremely-fast-sine-cosine/36469/msg/346129/view.html#msg346129)
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  
public class OpPML implements FMOp
{
   // "public" okay, for internal use only
   float index;
   float pitchIncr;
   final int tblSize = SineTable.getOperationalSize();
   
   public void setFrequency(float freq)
   {
      pitchIncr = (freq * tblSize)/ 44100;
   }
   
   // TODO: should not be used, should set to cause compile error
   @Override
   public float get()
   {
      return get(0);
   }
   
   @Override
   public float get(float modulationAmt)
   {
      index += pitchIncr;
      if (index >= tblSize ) index -= tblSize;
     
      float temp = index + modulationAmt;
   
      while (temp < 0) temp += tblSize;
      while (temp >= tblSize) temp -= tblSize;
     
      return SineTable.get(temp);
   }
}


Variant with no modulator. Yes, lots of duplicate code. But minimizing processing in the .get() has the highest priority.
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  
public class OpN implements FMOp
{
   // "public" okay, for internal use only
   float cursor;
   volatile float pitchIncr;
   final int tblSize = SineTable.getOperationalSize();
   
   public OpN(){}
   
   public OpN(float freq)
   {
      this();
      this.setFrequency(freq);
   }
   
   public OpN(float freq, float startingPhase)
   {
      this();
      this.setFrequency(freq);
      cursor = startingPhase * tblSize;
   }
   
   public void setFrequency(float freq)
   {
      pitchIncr = (freq * tblSize) / 44100f;
   }
   
   @Override
   public float get()
   {
      cursor += pitchIncr;
      if (cursor >= tblSize) cursor -= tblSize;
     
      return SineTable.get(cursor);
   }

   // TODO: should cause compile error, should not be used
   @Override
   public float get(float modulationAmt)
   {
      return 0;
   }
}
   
Variant that uses feedback instead of an external modulation source.
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  
public class OpFB implements FMOp
{
   // "public" okay, for internal use only
   float cursor;
   float pitchIncr;
   final int tblSize = SineTable.getOperationalSize();
   private float feedback;
   
   final private float feedbackAmplitude;
   
   public OpFB(float feedbackAmplitude)
   {
      this.feedbackAmplitude = feedbackAmplitude;
   }
   
   public void setFrequency(float freq)
   {
      pitchIncr = (freq * tblSize) / 44100f;
   }
     
   @Override
   public float get()
   {
      // determine feedback amt
      cursor += pitchIncr;
      if (cursor >= tblSize) cursor -= tblSize;
     
      feedback = SineTable.get(cursor);
     
      feedback = cursor + feedback * feedbackAmplitude;
      while (feedback >= tblSize) feedback -= tblSize;
     
      return SineTable.get(feedback);
   }
   
   // TODO: trigger compiler error, never should be used
   @Override
   public float get(float modulationAmt)
   {
      return 0;
   }
}


With these three, one can replicate all 32 "algorithms" employed by the Yamaha DX-7. Here is an example of the code I use for a simple modulator -> carrier pair:
1  
2  
3  
4  
5  
6  
7  
8  
9  
            currentCEnv.tick(cEnvCursor, frequency);
            currentMEnv.tick(mEnvCursor, frequency);
           
            float noteVal =
                  vmCarrier.get(cEnvCursor.value)
                  * cOp.get(
                     vmModulator.get(mEnvCursor.value)
                     * modDepth1 * mOp.get()
                  );

cOp is an OpPML
mOp is an OpN
There are envelop/cursor pairs for the carrier and modulator.
There is also another layer of mapping that converts the linear values to something more exponential/logarithmic. I am calling these "volume maps" (amplitude maps would be better?). For modulators, I usually use a "reverse cosine" mapping (1 - cos, for 1/4 of a cycle), and for carriers an exponential mapping (x^6, x=0..1) works pretty well. I was not able to figure out what Yamaha/Stanford folks were using here. nsigma, maybe you understand this better and have a suggestion for this step? My head is a little far away from the theory at the moment. Maybe there is a decibel/logrithmic function-related that would be more ideal.
2  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 19:09:04
Riven, your table has 8 4 times more values than mine. I'm wondering if that compensates sufficiently for the lack of linear interpolation. There is a way to calculate and compare the errors, I'm sure.

I should have noticed that all the operations were occurring within the square brackets!

I was going to use the bit masking idea for keeping the LUT cursor within bounds, but let it go when Java wouldn't allow a byte to be anded with a float. I feel like a turtle among the gazelles. With some effort, I'll look again to see if that is what you coded.
3  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 02:34:43
Listening is Believing

I use a LUT for sine waves for my FM synthesizer. So, I had to give Riven's lookup method a try, actually playing a wave. His sounds just as good. If you'd like to listen: some code where I compare methods follows. (Haven't tried it with a "full stack" of 3 modulators + carrier yet. I'm guessing it will still sound good, though. Also, I want to understand the method he is using for interpolating between table values. I just use linear interpolation.)

In the code, I show a half dozen runs where all the values needed for 10-seconds worth of A-440 are calculated, comparing his and my own lookup. (The first comparison can be thrown out because it is mostly about the Audio code getting loaded into memory.) I think his method is even better than the comparison indicates, because I have to manage the cursor to make sure it doesn't look up a value outside the LUT, and his doesn't actually require this. I'm assuming the radian value inputs will remain accurate all the way up to Float.MAX_VALUE. Is this true? It takes a long time to get there playing an A=440 at 44100 fps.

Yay! Looks like this discussion will result in a significantly faster FM synthesis processing algorithm for me to use.  Grin

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  
package fastSineTest;

import javax.sound.sampled.AudioFormat;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.DataLine;
import javax.sound.sampled.LineUnavailableException;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.Line.Info;

public class ListeningIsBelieveing {

   static int bufferSize = 4 * 1024 * 4;
   
   static long timeDuration;
   
   public static void main(String[] args) throws LineUnavailableException,
      InterruptedException
   {        
      new RivenSine();
      new PFSine();
           
      float pfIncr, rivenIncr;
     
      rivenIncr = (float)((440 * 2 * Math.PI) / 44100f);
      pfIncr = (440 * PFSine.getOperationalSize()) / 44100f;

      float rivenTblSize = (float) (Math.PI * 2);
      float pfTblSize = PFSine.getOperationalSize();
     
      // metrics tests
      for (int i = 0; i < 6; i++)
      {
         play10Seconds(rivenIncr, rivenTblSize, false, true);
         System.out.println("Ri10SecComputationTime(nano): " + timeDuration);
         play10Seconds(pfIncr, pfTblSize, true, true);
         System.out.println("PF10SecComputationTime(nano): " + timeDuration);
         System.out.println();
      }

      // actual playback occurs here
      System.out.println("Riven's is playing...");
      play10Seconds(rivenIncr, rivenTblSize, false, false);
      System.out.println("Phil's is playing...");
      play10Seconds(pfIncr, pfTblSize, true, false);
      System.out.println("Done");
   }

   private static void play10Seconds(float incr, float tblSize,
         boolean method, boolean timeIt)
         throws LineUnavailableException
   {
      AudioFormat audioFmt = new AudioFormat(
            AudioFormat.Encoding.PCM_SIGNED,
            44100, 16, 2, 4, 44100, false);
     
      Info info = new DataLine.Info(SourceDataLine.class,
            audioFmt);
     
      SourceDataLine sdl = (SourceDataLine)AudioSystem.getLine(info);

      byte[] outBuffer = new byte[bufferSize];  
     
      sdl.open(audioFmt, bufferSize);
      sdl.start();
           
      int idx = 0;
      float cursor = 0;
      float normalizedVal = 0;
      int audioVal = 0;
     
      long startTime = System.nanoTime();
     
      for (int ii = 0; ii < 441_000; ii++)   // 10 seconds at 44100 fps
      {
         cursor += incr;
         if (cursor >= tblSize) cursor -= tblSize;
         normalizedVal = getAudioData(cursor, method);
         
         audioVal = (int)(normalizedVal * 32767);
     
         outBuffer[idx++] = (byte)audioVal;
         outBuffer[idx++] = (byte)(audioVal >> 8);        
         outBuffer[idx++] = outBuffer[idx - 2];
         outBuffer[idx++] = outBuffer[idx - 2];
         if (idx >= bufferSize)
         {  
            if (!timeIt) sdl.write(outBuffer, 0, bufferSize);
            idx = 0;
         }
         
         cursor += incr;
         
      }
      if (!timeIt && (idx > 0)) sdl.write(outBuffer,  0, idx);
     
      timeDuration = System.nanoTime() - startTime;
     
      sdl.drain();
      sdl.close();
      sdl = null;
     
   }
   
   static float getAudioData(float cursor, boolean method)
   {
      if (method)
      {
         return PFSine.get(cursor);
      }
      else
      {
         return RivenSine.sin(cursor);
      }
   }
}


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  
package fastSineTest;

public class RivenSine {
     public static final float sin(float rad)
      {
         return sin[(int) (rad * radToIndex) & SIN_MASK];
      }

      public static final float cos(float rad)
      {
         return cos[(int) (rad * radToIndex) & SIN_MASK];
      }

      public static final float sinDeg(float deg)
      {
         return sin[(int) (deg * degToIndex) & SIN_MASK];
      }

      public static final float cosDeg(float deg)
      {
         return cos[(int) (deg * degToIndex) & SIN_MASK];
      }

      @SuppressWarnings("unused")
      private static final float   RAD,DEG;
      private static final int     SIN_BITS,SIN_MASK,SIN_COUNT;
      private static final float   radFull,radToIndex;
      private static final float   degFull,degToIndex;
//      private static final float[] sin, cos;
      public static final float[] sin, cos;

      static
      {
         RAD = (float) Math.PI / 180.0f;
         DEG = 180.0f / (float) Math.PI;

         SIN_BITS  = 12;
         SIN_MASK  = ~(-1 << SIN_BITS);
         SIN_COUNT = SIN_MASK + 1;

         radFull    = (float) (Math.PI * 2.0);
         degFull    = (float) (360.0);
         radToIndex = SIN_COUNT / radFull;
         degToIndex = SIN_COUNT / degFull;

         sin = new float[SIN_COUNT];
         cos = new float[SIN_COUNT];

         for (int i = 0; i < SIN_COUNT; i++)
         {
            sin[i] = (float) Math.sin((i + 0.5f) / SIN_COUNT * radFull);
            cos[i] = (float) Math.cos((i + 0.5f) / SIN_COUNT * radFull);
         }

         // Four cardinal directions (credits: Nate)
         for (int i = 0; i < 360; i += 90)
         {
            sin[(int)(i * degToIndex) & SIN_MASK] = (float)Math.sin(i * Math.PI / 180.0);
            cos[(int)(i * degToIndex) & SIN_MASK] = (float)Math.cos(i * Math.PI / 180.0);
         }
      }
}


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  
package fastSineTest;

public class PFSine {
   
   static final float[] data = makeSineWaveTable();
   
   public static float get(int i)
   {
      return data[i];
   }
   
   public static float get(float i)
   {
      final int idx = (int)i;
     
      return data[idx+1] * (i - idx)
            + data[idx] * ((idx+1) - i);
   }
   
   // mask used for looping through table (assuming 1024)
   public static int getMask()
   {
      return 0x3ff;
   }
   
   public static int getOperationalSize()
   {
      /*
       * Table has one redundant record to allow
       * simpler LERP coding. For example, 1024 records
       * to capture a single SINE cycle, but with a
       * 1025th record added that duplicates the first.
       *     data[0] == data[1024] is TRUE
       * So, since the get(float i) does a lookup of
       * (i + 1), the last allowable position is
       *     i = data.length - 1;
       * Example: incoming < 1024.0 is OK for a table
       * of length 1025 (1024 for cycle + 1 redundant).
       */

      return (data.length - 1);
   }

   private static final int WAVE_TABLE_SIZE = 1025;
   
   public static float[] makeSineWaveTable()
   {  
      float[] audioData = new float[WAVE_TABLE_SIZE];
     
      for (int i = 0; i < WAVE_TABLE_SIZE; i++)
      {
         audioData[i] = (float)(Math.sin(2 * i *
               (Math.PI/(WAVE_TABLE_SIZE - 1))));
      }
     
      return audioData;
   }
}

 
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-21 21:07:10
Got my three monitors + VESA stand all up and running Cheesy
Nice! How is this wired/cabled? Any particular video card needed to have 3 monitors? Is 4 a possibility?
5  Game Development / Newbie & Debugging Questions / Re: Best Practices for Creating New Objects on: 2015-07-21 20:02:42
Probably no difference between this:
1  
    for (int i = 0, n = entities.size(); i < n; i++)
and this:
1  
2  
    int n = entities.size();
    for (int i = 0; i < n; i++)

??

I can't remember what prompted the change any more, but I started using the former version several years ago. It seems to me there would be no particular advantage now, if there ever was any.

True/false?
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-21 19:50:50
@J0

I know that game, I have played that ~6 years ago, it was actually the inspiration for my game. But this game is going to be story based. I need the earth to be there in the background according to the story. I think I will replace that texture with a large and improved earth background.

Your game looks polished and interesting! I can also see J0's point about the planet looking a bit like a placeholder.

You may already be light-years ahead of the following information. But for what it is worth, in case it might be helpful, here is some data I used for generating an earth map via Perlin noise. Admittedly, I didn't take the approach to its potential--I was just trying to get a grasp of the basic concepts when exploring this a while back. The color mapping is a tweaked, by-eye remaking of one I found in a tutorial by AngryOctapus. http://www.angryoctopus.co.nz/?p=11 which has various ideas laid out, but would also benefit from using 3D rather than applying a lens. (I can't recall the jgo member name of this person, but he comments here now and again.)

In any event, in this case, the simplex function's -1 to 1 range is mapped to values ranging from 0 to 255 (leftmost column). These values are assigned to RGB values in the middle columns. You'd want to do it 3D instead of flat, of course. The color-mapping shown might be a good starting point for tweaking. The algorithm generating the graphic below just uses a normal sort of fractal octaves--maybe I skipped an octave here or there. (I'm happy to explain further if you haven't already delved into Perlin fractals.)

One could also bias the output towards the white end at the poles of the planet. Or tweak the colors to make it more other-worldly or more accurately reflecting Earth.


7  Games Center / Showcase / Re: VERBAL - the fast-paced thinking word game on: 2015-07-21 02:10:33
Perhaps I can implement swipe gestures to rotate left/right, with an upward swipe to remove just one letter from the word bar. So starting with BAR, right swipe twice to insert two empty slots at the beginning, then play RE for REBAR.

Or, left swipe BAR once to get AR, then play BOR for ARBOR.

Or, upward swipe the B in BAR and play O for OAR.

I like these ideas!

I have also struggled with mentally arranging letters while solving the puzzles. An idea I had to ameliorate this would be to offer clues instead of instantly awarding them. So the player could choose to accept a mediocre 5-letter clue or they could discard it. That way you can safely use the word bar to experiment without hurting your score, and you won't get mugged by low value clues any more.

That suggestion helps with the mugging, which happened a couple times to me before I understood what was going on. But the strain on working memory is still pretty high for folks who want to "play Scrabble" with their tiles. Maybe that's a feature, something the Lumosity folks would brag on.

An idea occurs to me: highlighting or otherwise marking the clued letters to make it easier to sort out those where you know where they go versus those that need maneuvering into place. That's one less thing to keep track of mentally, alleviating a bit of the struggle.
8  Games Center / Showcase / Re: VERBAL - the fast-paced thinking word game on: 2015-07-20 16:44:27
Verbal runs great on the emulator I have via Android Studio on Linux. I will try the device I have soon, but might not be able to get to it today.

The version I have has two games: the original speed challenge and the game for finding a 9-letter word using 6-8 letter words to generate clues. I like having the two modes of play to choose between. Sometimes one wants to go for a rush, sometimes one wants to ponder.

I have a suggestion/request for the "Solve the Puzzle" game. Would it be okay to enable one to click and drag the letters to rearrange them? I was having a lot of trouble trying to keep track mentally of what letters might be where. In Scrabble, one can move the tiles about on the tray, and this is very helpful for visualization. Just a swap function between two tiles would add a lot. I found myself occasionally using the strategy of trying out plausible 9-letter words while taking care to avoid 6-8 in the process. Actually managed to score 950 on one of my rounds! Of course there is some luck as some words are easier to find than others.

I was a bit skeptical that a word game would work without a keyboard. For example, with online Boggle, is impossible to get a decent score while only using the mouse to click out words. But you managed to make it work quite well! I think that is a big accomplishment.

One other idea--it would be nice, maybe, if one could add prefixes to an existing word and also get bonuses. For example, I'm thinking click and drag the first letter one (or more) to the right, leaving the first spot empty, then filling it in. BOARD becomes ABOARD, say. (Or have a little button for rightwards rotations.)

I found myself a little miffed at having to redo entire words when only the first letter needs changing. FIGHTER LIGHTER
for example. But that would also add a complication to the UI, requiring drag-and-drop or some other solution.
 
The background graphics are nicely done. They definitely add polish, but at the same time do not distract.

Definitely a fun game!
9  Discussions / Miscellaneous Topics / Re: Music composing on: 2015-07-20 04:44:14
Maybe there is a free version of a notation program like Sibelius or Finale (doesn't Coda have something called Allegro?) that lets you do playback. Or another notation program. If you could code it to MIDI, there might be a way to even play it back using Java's MIDI and record that, but I've never gone that route. Audacity is free and a good product for audio recording and editing, but doesn't play back MIDI unfortunately, as far as I know.

There might be a 30-day trial on a Native Instruments product, like Kontact or whatever their orchestration program is. I use Finale (paid for it) and Sonar Homestudio (paid for it), so haven't looked too deeply into this topic.
10  Game Development / Newbie & Debugging Questions / Re: Where to start in terms of programming? on: 2015-07-16 20:09:41
From the earliest moments on, a catchy title and an escalator pitch (demonstrating a viable concept that distinguishes itself from the pack), may do more for you than this or that aspect of the coding. Maybe a good guideline as to what to code first: what coding does the best job of giving the title/pitch credibility?

Sometimes when making something new, there is a "creative" bottleneck. I seem to be running into people these days that have a great but somewhat nebulous idea, and are spinning in place trying to get support. Often the devil is in the details of making a "great idea" real. Once this or that creative/conceptual premise is shown to be solvable, almost everything else flows from that solution. Design decisions, programming decisions--these are much easier to solve (and solve creatively) when the requirements are clear.
11  Game Development / Newbie & Debugging Questions / Re: How to find memory leaks? on: 2015-07-14 18:48:53
Just in case you don't know where JVisualVM.exe is, it's in the JDK directory, the bin subfolder.

When you run it, and there are other Java programs running, JVisualVM can see them and offer you the service of attaching and monitoring/profiling them.

I'd probably run the app outside of Eclipse, though, and keep Eclipse off while checking it out.

http://visualvm.java.net/docindex.html
12  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-10 08:32:05
Time spent on my web site--discovering all sorts of doh! stuff that I didn't know about, like the need to use <ctrl> F5 to update and force the dang browser to refresh the cache. (That's yet more time I won't get back spent searching the Browsers' Options areas for what to do, or wondering if there's some time lag for when my host does updates and exploring other misguided theories.) Another fun one: disappearing files and file folders on the site because of not understanding the permissions properties.

Ah, also figured out a way to get the site so that all the internal links are in a single .js includes. I don't know what standard practice is. I made two variables: liveURL and sandbox, and set it up so that with one edit all the addresses concatenate either one or the other string. At least that worked relatively smoothly.

Took a break.

Came back and tried to work some on Java, audio library, on volume faders for the motif-sequencers I built. Discovered the situation is kind of snarled up, and am going to have to muddle on it for a while yet before figuring out a good design plan. That sort of not-one-line-of-code-written time counts as coding, too. Right?
13  Game Development / Newbie & Debugging Questions / Re: What technologies should I choose as a newbie java game programmer ? on: 2015-07-08 20:57:45
If you're an absolute beginner, check out Processing.

Processing is cool, but is it really suitable for game making? OP sounds ready to go. I thought Processing was mostly for making interesting animations. Happy to be corrected.

For game loops and example programs, there are a lot of resources and tutorials which can be reached via the links under the Java-Gaming logo on the top left.

Deciding whether or not to go with OpenGL is a big question, which I can't answer for you. I've only dabbled there, and instead have more experience with Java2D.

For sound, the library TinySound (can do a search for posts by the author on JGO's site) will do 90% of what any game programmer normally wants, eliminating the learning curve for javax.sound.sampled library. But if you go for a framework or library like Libgdx or JMonkey Engine, it will also have functionality to simplify dealing with sound.

Mostly, I think you should just jump in with a learning project or two and ask questions here when you get hung up. A lot of resources are scattered all over the place. The main text books on Java game programming are growing progressively obsolete. Welcome to the bleeding edge! (You aren't in Kansas University any more.)

If you do read any general programming books, my #1 suggestion is to pick ones that emphasize how to write code that is first and foremost easy to read and modify. You are going to be doing a LOT of rewriting over the next months (years), and kicking yourself every time you come back to something and ask "WTF was I doing?"
14  Discussions / Business and Project Management Discussions / Re: Am curious how to budget a team project on: 2015-07-08 17:39:09
Thanks for inputs, all! Understood, about team building being very varied. I'm thinking, the equivalent of a prototype will come from a script being developed. I am going to advise the "client" that the first step is to take his "curricula" and work a significant segment of it into a form (kind of like a film script with visual information, and puzzles built in) where it is easy to visualize and the entire project becomes more real.

In addition, I could see where it might be necessary to build mockups, if a mechanic is at all unique. For some segments, for example, a simple variant on a "hidden object" puzzle (highly likely to be included), these might be easy enough to visualize.

I'm surprised that the differences in programming between something like "Banner Saga" (multi-layered 2D with set scenes, dialogue screens with choices, and intervening puzzles) is not considered enough information to give a range of estimates. Especially, when contrasted with trying to implement 3D which to me seems like it would automatically add significant complications and extra work.

I meet with the "client" (using the term loosely!) tonight for Pakistani food. Things are at a very exploratory stage.

Long ago, I worked as a team coordinator for a game company that employed about a dozen people. I think something like 8 or 9 games/apps made it to market. We had a couple programmers who primarily implemented our game-enabled FORTH onto various desktops, and others who worked primarily on the games. (Program once, implement on many!) We are talking about computers that boasted of having 64 KB of RAM, mind you! I made a game while I there, called "Laser Tanks." The boss came up to me and handed me a roll of quarters, sent me to an arcade, and said, come up with a tank-themed game. But as a team coordinator, I occasionally had to put the game aside and work with the "core" team as they were getting frazzled. For example, I ended up being the main person who installed and got some software running that converted 8080 to Z-80 assembly language (despite having only a smattering of assembly language programming experience). I was also a main intermediary that helped coordinate common game features and sharable code in the team, and tracked time estimates and kind of helped people along.

This experience (which I viewed as overall positive despite the long hours) and an overly healthy "can do" optimism leads me to venture into projects that are sometimes over my head.

I like the video from GNecro1, in that one can see many important stages or components of the larger project dealt with in turn. Nice find.
15  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-08 08:29:14
@wessles, looks like a totally nerve-wracking game to play! On the video, some of the moves by the center seem to be made before the blocks appear. Is this the case? Is there a way to anticipate which rows/columns they are going to come flying through on?
16  Discussions / Jobs and Resumes / Re: Hayden Davenport - Video Game Composer for Hire on: 2015-07-07 17:36:42
It looks to me like you neglected to put in the ":" on http:// in your links. Edit that in and you should be good to go.
17  Discussions / Business and Project Management Discussions / Re: Am curious how to budget a team project on: 2015-07-07 17:34:34
Refining things here. (Thanks for thoughts and helping me think this through.)

Let's say it's a single-person game.

It occurs to me a first version could be something along the lines of "The Banner Saga" (on Steam) as an example of a form which is 2D with layers to give it some depth. Also "Banner Saga" has an alternation between script and puzzles/combat that potentially works for the target project.

I think the key is the script, which if it is strong and has a marketing plan, there will be a chance to raise money via a Kickstarter campaign. I was just trying to get a sense of the scale of the team size and budget.

But by staying 2D with layers, this starts to scale down to something I might be able to program myself, assuming I had a good artist & script. So, I guess that simplifies things. What do I require? (Only I can answer that!)

I should check the credits on Banner Saga to get a better sense of their team size.
18  Discussions / General Discussions / Re: English proof-reading service? on: 2015-07-07 06:54:43
My wife is an editor/proof-reader (graduated from UC Berkeley, has experience as a magazine editor). She charges for her time, though ($30/hr). PM me and I will give you her Skype account. These days, she mostly does academic formats, theses, dissertations. She only has a memoir project at the moment, so can take on more work.

[EDIT: She asked me to add that she often will do a free, short sample, e.g., up to three pages, in order to "get acquainted." It gives her a chance to get a sense of the time needed for the work and for the client to judge the quality of her work.]
19  Discussions / Business and Project Management Discussions / Am curious how to budget a team project on: 2015-07-07 06:43:06
How many people does it take to make an RPG? I've gone to meetups where there are all sorts of people trying to sell themselves, and some of the roles surprise me. Is there really a need for things like 'level designers'? It seems to me a good artist and programmer pair can accomplish a lot. But if 3D is involved, maybe it takes a couple programmers because of the need to rig up the art to 3D models? (Having not done this, I may be assuming it is more mystical and difficult than it actually is, or I may be clueless about the complications. My experience is with sound and 2D.)

For the purposes of this discussion, lets assume the target is desktop/laptop computers, and the setting of basic D&D stuff, nothing particularly original. What would be a good lean team, assuming a decent script exists?

This is mostly for informational purposes--nothing concrete, yet.
20  Discussions / General Discussions / Re: Steam Machine vs homebuilt PC on: 2015-07-06 19:12:10
Some comparisons here:

http://www.tomshardware.com/s/steam+machine+comparison/

The site promotes building your own, so there will be bias.
21  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-06 01:53:47
@opiop65 What a fine kitty!
22  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-05 07:33:10
Another couple of Java FM synth patches built, yesterday and today. (If you are Yamaha DX7 buff, I got a halfway decent Torim working (classic Bo Tomlyn patch, would be better replica but I haven't implemented pitch level scaling) and a favorite of mine from a fan magazine that has hammer dulcimer qualities.) Slowly am assembling an old sequencer cue I wrote for a documentary back in the 1980's. The video had a lot of zippy graphics in it, very "high tech" look of the time. (It was a a scholastic thing for UC Berkeley, School of Design, didn't get any commercial exposure that I know of.)

I had an image last night of lots of "note material" fragments floating around like tiny asteroids, and the "game" being pushing them into slots on larger, spinning asteroids, each of which is playing as much of the its particular sequence as has been assembled so far. Volume levels determined by proximity as the spinners move around on the screen (through space).

Kind of vague still. Main thing, because the "score" is procedural, there is a lot of flexibility in how it would/could be assembled. I want to exploit that capability. Need to get back to working on fade/envelope controls for the sequences, and a more flexible way to proceed partially through the sequences instead of loading each entirely from beginning to end for each iteration.

Am also doing about 10 sample questions a day on a Java Cert program. Amazing what you don't need to know (and still are tested on) in order to program. And, need to keep hacking on new website design. And Android study.
Overload! Tongue
23  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-02 02:18:20
Took most of the day for some HTML/Javascript coding, figuring out a way to quickly fade out music on a web page before moving to the next link. I just wanted a quick fade, like half a second, as abrupt sound stoppage works against the mood that I'm trying to create on the site.

The effect is not ideal (a bit of borderline zippering) and it makes going from link to link a little slow (adds a second). Haven't uploaded any of the new stuff yet, so don't go looking for it.

Coding involves rewriting <a> href tags to call a javascript function. This function first does a recursive/progressive subtraction of myAudio.volume, using setTimeout(), then after a pause to accommodate the fade, a call to window.open(). Considering I didn't know about this stuff before today, and was checking out blind alleys like onbeforeunload(), I think I did okay.

If there is a better approach, I'd be happy to hear about it.
24  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-30 18:17:39
Making bleepy noises should be right up there in terms of fun as "bumping into trees"!
http://www.java-gaming.org/topics/what-i-did-today/33622/msg/344162/view.html#msg344162
Am playing with "pulse music" ideas here, now that I have sequences able to coordinate on a common pulse. Next step, I think, will be implementing envelopes over the volumes of the sequences as they loop along. Then maybe get into a layer of metrical accenting. (I "hear" it, a certain way of composing "pulse" music, Minimalist style.)
25  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-30 01:10:40
So sad to hear about the deaths (princec, ags1). My condolences. I get to go to a memorial for a best buddy who passed last January--for some reason it was put off until July 11. Maybe now I'm a bit more ready to deal with it.

Yay, Cowboy Bebop. Very much enjoyed binge-watching the entire series that last year.

Programming this last week: mostly audio. Added two more synths from my Yamaha DX7 collection into Java (one done last night). Also, did some cleanup work on the wrapper system (enabling both Android and Java), and the creation of a new structure that I'm calling a "Motif" -- which is basically a Sequence but I didn't want to use the term because Java has its own Sequencer.

Today: got a system working that allows a shared pulse to be used by two independently started sequences...err...motifs. You can schedule an audio event sequence to start ASAP on the "NextPulse". If the pulse size of the motifs are the same, then they will maintain lock step synchronicity. And, the Task Manager says it was all done with 0.2% CPU usage or less. Down the road, am hoping to build on it so that the game UI can target musical measures as well as individual beats, and to be able to alter metrical values and accent patterns.
26  Discussions / Miscellaneous Topics / Re: I have not programmed in 3 weeks. on: 2015-06-24 18:57:15
How many hours is that? 1900 - 830 = 1030, yes? 72.5 a week? Less an hour for lunch? That's still over 65 a week, which is brutal if you wish to do anything else with your life. I hope you are making "overtime" -- if not, it reflects the erosion of workers rights (if you are in the USA). Let me guess, you have been made a "manager" (aka bogus title used to circumvent labor laws and extract a maximum number of hours from employees. Check out Bernie Saunders and his position for raising the cutoff for how low the annual wage for a "manager" working unpaid overtime can be. [EDIT: just found this link: http://www.huffingtonpost.com/rep-bernie-sanders/corporate-greed-must-end_b_7653442.html "We need to end the scandal of companies taking advantage of outdated rules to avoid paying overtime to 'supervisors' -- often earning less than $30,000 a year -- when they clock 50 or 60 hours a week on the job."]).

First priority may just have to be figuring out how to get into a better position (as well as staying sane). Programming under those conditions is really rough, since programming usually involves deep thought. Giving it 15 minutes a day can be more painful than not doing it at all.

Is there a commute involved? I've sometimes managed to do a little work on public transportation. At my day job (music store), I sometimes jot down code or ideas to be worked on later. But that sort of thing depends on how much focus they are demanding from you and how tight they are about the breaks.

The only success I have with "programming" in short bits is to pick up something like this program: Enthuware.com. It can be set up to dole out X questions that you can do every day (using a setting called "Leitner Mode". The questions can be very varied, so it will help refresh a diverse range of concepts. (There's a learning concept called "interleaved practice" that applies. http://j2jenkins.com/2013/04/29/interleaved-practice-a-secret-enhanced-learning-technique/)

On one question you may be given String/StringBuilder tasks, another reviews legal Overrides, another concerns use of static and/or static blocks, order of execution, or rules of inheritance or etc., etc. My panel is the basic Java Cert panel, covering core Java. There are a number of tests panels you can choose from. It works for me, in part, because I kind of program "by ear" and am a little shaky on the specific syntax issues involved with different concepts. So, it is honing my understanding of the language, and enhancing my ability to read code.

I do 5 to 10 questions a day, only taking around 10-15 minutes when you include grading and checking out web questions from other students who are having troubles with the questions. The Leitner Mode is kind of like a game where you can see your progress (as questions move from "Unanswered" to "Learned" status) over time. It is the most cut-and-dried, easiest way to do a little bit every day that I know, even when other things are stressful and difficult. You can jump into it cold, and it feels like a nice break (at least for me). Not creative, but it keeps the programmer mind from atrophying, and is kind of fun.
27  Game Development / Game Mechanics / Re: Simple 2D fluid simulation on: 2015-06-19 19:17:28
Just let me know if the algorithm ends up being useful, and a link to the game when you have a working demo would be nice. It would be neat to see in action.
28  Game Development / Game Mechanics / Re: Simple 2D fluid simulation on: 2015-06-18 21:18:14
I was fooling around with some fluid simulations, and came up with the following a while back. I don't know if it will give you what you want. (I'm reacting to the graphic that basil_ posted.) The amount of activity in it is determined by the starting positions of the y values.

1) create float array, with a length = x pixels (width that you wish to fill) and pre-fill with y values that match the water height in pixels of your starting wave shape.
2) create a second array to hold the differences in levels between all the elements in the first array.

Algorithm:
(a) fill second array with differences.
(b) add 1/2 of those differences to each corresponding side.

Example:
water[0] = 7
water[1] = 8
water[2] = 9
water[3] = 9
water[4] = 8
water[5] = 7
water[6] = 6
water[7] = 5

populate:
delta[0] = 1 // between water[0] and water[1]
delta[1] = 1
delta[2] = 0
...
delta[6] = -1 // between water[6] and water[7]

then add back to original:
water[0] += 1/2 delta[0]    // note, each end only has one delta contributor
water[1] += 1/2 delta[0] + 1/2 delta[1]
water[2] += 1/2 delta[1] + 1/2 delta[2]
...

I hope I am remembering this correctly. The amount of fluid stays the same, and the turbulence continues indefinitely. There is no "friction" component.
29  Game Development / Game Mechanics / Re: Best way to debug? on: 2015-06-18 20:50:16
Some people prefer using a step-debugger process. Others prefer to embed print messages to the console at key spots revealing, key data.

I've seen books were the preference was asked of some of the greatest programmers alive, and some prefer one, or the other, or a mix of both. There was no clear winner.

I lean towards printing console messages, and use the following basic form:
1  
System.out.println("classname.methodname, variable=" + variable);

A lot of people would think this is overkill, but I really hate having old messages appear and not know where the heck they are coming from. Hence: the inclusion of the class and method names.

You don't necessarily have to put these in every one of your 100+ files. For example, you can pick a single entity that is unable to shoot, focus on that. Chances are that what you learn will be applicable to parallel situations. Also you can scatter these through various stages of you process, to try to narrow the possibilities of where the hang is occurring.

In situations where you want to look at a statement that repeats a huge number of times, and you don't want to flood the console, you can add a counter and only print every 1000th iteration or whatever is a useful count.

[EDIT] Riven's advice on using the debug to identify a hanging thread is really good. I will use this more in the future.
30  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-06-18 20:37:38
Most useful line, to me:
Quote
Illegal1 = 0O
Pages: [1] 2 3 ... 40
 
Riven (23 views)
2015-07-27 16:38:00

Riven (13 views)
2015-07-27 15:35:20

Riven (18 views)
2015-07-27 12:26:13

Riven (8 views)
2015-07-27 12:23:39

BurntPizza (24 views)
2015-07-25 00:14:37

BurntPizza (36 views)
2015-07-24 22:06:39

BurntPizza (20 views)
2015-07-24 06:06:53

NoxInc (23 views)
2015-07-22 22:16:53

NoxInc (14 views)
2015-07-22 22:13:39

Jesse (36 views)
2015-07-22 03:10:36
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

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
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!