Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (407)
games submitted by our members
Games in WIP (293)
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  Games Center / WIP games, tools & toy projects / Re: 2D platformer (Boxman) on: 2013-05-10 22:49:13
Break your maps into "sections".  If the player nears the end of a section, load the next section (from disk) in a background thread.  It's probably a good idea to keep the previous section in memory until the player nears another section.  If you need more detail, let me know.

The game looks really cool!  I like how you can create a block when jumping.  What would be neat is if you could create the block, jump off it and after a second or two, it drops (maybe on an enemy below -- killing it).

Keep up the good work!
2  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-05-10 02:35:03
Yup, there is bytecode.  Leola is currently a VM on top of a VM.

Danny02 you are right, it would be more optimal to translate to JVM bytecode.  However, that was not the goal of this project.  My goal was to learn about languages, compilers and virtual machines.

Longor1996,

You can translate to bytecode via the 'b' option as Danny02 mentioned.   This will compile the source file(s) into the bytecode.  You can then run the compiled files directly as so:
1  
2  
java -jar leola.jar b "./test.leola"
java -jar leola.jar "./test.leolac"
3  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-05-02 00:04:45
Try this out:

1  
java -jar leola.jar "./live.leola" "./spaceinvaders/spaceInvaders.leola"


The NPE is from not finding the necessary libraries from not loading the "live.leola" file.
4  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 16:51:55
That does sound like a great idea.  Alas, with two kids I doubt I would ever get the time.  As it is, I'm lucky to get ~5 hours a week to code on my personal projects.

Ludum dare sounds like so much fun though.
5  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 16:39:27
The sound is currently disabled -- there is a memory leak that I haven't fixed yet.

As for the flashing, I have not encountered that.  Does it just seem like it is rendering very slow?
6  Games Center / WIP games, tools & toy projects / Re: Guardian II on: 2013-04-21 15:26:29
I love the art work, looking forward to playing!
7  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 06:03:08
@Argo -- I'm not exactly sure what you are asking.  Are you asking if you can interop directly with Java classes without writing a "binding" layer?

The answer is yes, the "binding" layer is completely optional.  I only recommend using it when you want to have a closer integration with Leola.  For instance in the SQL library I have this construct:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
// conn is a simple "wrapper" around java.sql.Connection.  It adds some useful
// methods for taking advantage of Leola's features
var conn = db:connect("dbUrl", "myuser", "password")

/* wraps all of the delete statements into 1 transaction */
conn.transaction(def() {
 
  conn.query("delete from table where table.id = :ID").params({ID -> 1234}).update()
  conn.query("delete from table2 where table2.id = :ID").params({ID -> 9876}).update()
})


If you want to instantiate a Java object, it is as simple as:

1  
2  
3  
var javaArray = new java.util.ArrayList()
javaArray.add( 20 )
println(javaArray.get(0) ) // prints "20"
8  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 05:40:21
There aren't any operator overloads in Leola (a slight lie).  A work around can be to use a Map to populate the constructor such as:

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  
// the map can contain values that you want to
// populate in the class.  If the value is not supplied, use a default
class Entity(settings) {
   var pos = settings.pos
   var vel = settings.vel

   var someOptionalParameter = case when settings.option != null -> settings.option else "defaultValue"
}


var hero = new Entity({
   pos -> live:math:newVec2(),
   vel -> live:math:newVec2(),
})

var enemy = new Entity({
   pos -> live:math:newVec2(),
   vel -> live:math:newVec2(),
   someOptionalParameter -> "Something that isn't the defaultValue"
})

/* You can even add properties dynamically after construction */
enemy.somethingNew = "a new property"
enemy.somethingElse = def() return "a new function"

println( enemy.somethingNew ) // prints "a new property"
println( enemy.somethingElse() ) // prints "a new function"
9  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-04-21 05:27:32
I was able to play it by removing the contents of the main() in the shader.

Very well done.  Game play is smooth, graphics are fantastic.  The bots kicked my butt.
10  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 05:22:26
@ReBirth -- with regards to calling it "scripting"; I think of a small little one-off program as just little scripts to quickly accomplish a task.  I got this nomenclature from shell scripts.  Same concept, at least for me.  I see what you are saying though.
11  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 05:15:56
Yeah, the Bears suck  Wink


I use Notepad++ (with my own custom syntax highlighting) with the NppExec plugin -- works awesome.  I bound CTRL+SHIFT+C to compile and run the current file.  As ReBirth has mentioned, an IDE would be overkill.


You can download the jar file, a windows executable file (for convenience) and the space invaders game here: https://dl.dropboxusercontent.com/u/11954191/leola.zip

To install, just extract to a directory (ex. C:\leola)

To run the space invaders game, open a cmd prompt and navigate to the install directory and
run the following command:

1  
C:\leola>leola.exe "./live.leola" "./spaceinvaders/spaceInvaders.leola"



A cool feature about the game framework is that it detects when a file has changed.  If a file has changed, it will reload the game.  This helps facilitate the rapid prototyping by giving almost instant feedback when modifying the code.

If anyone is interested, I can put up a short tutorial on how to setup Notepad++ for nice easy integration with Leola.

Thanks!

Tony
12  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-21 00:29:00
Thanks   Cheesy

There is a 'switch' and a 'case' statement, they only differ in that the 'switch' executes a statement when a condition is met, and the 'case' executes an expression.  They both support a type of pattern matching, not as robust as say Scala's pattern matching -- but still useful.

Here are some examples:
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  
// finds the first match
var myFavoriteTeam = "Packers"
var status = case myFavoriteTeam {
   when "Bears" -> "the worst"
   when "49ers" -> "OK"
   when "Seahawks" -> "Meh"
        when 1234 -> "Just showing the conditions can be anything"
   when "Packers" -> "The greatest"

   else "not so good"
}

println(status) // prints "The greatest"


class X();
class Y();

var x = new X()

// finds the first match
switch {
   when x is Y -> println("x is Y")
   when x is X -> println("x is X")  
   else println("Unknown")
} // prints "x is X"

class Z() is Y(); // Z inherits from Y
var z = new Z()


// finds the first match, in this case it is Y because Z inherits from Y
switch {
   when z is X -> println("z is X")
   when z is Y -> println("z is Y")
   
   else println("Unknown")
} // prints "z is Y"
13  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-04-19 14:31:05
Please do!  This game looks amazing!  This is the type of game I've been wanting to make.  I don't know if this has been asked, any plans to open the source up?

Kudos.
14  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-04-19 03:20:39
I gave that a try, now I get this error:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
java.lang.RuntimeException: Cannot compile shader /shaders/basique.frag : 
Fragment shader failed to compile with the following errors:
WARNING: 0:7: implicit cast from ivec2 to vec2
WARNING: 0:8: implicit cast from int to float
ERROR: 0:7: Compiler error: This built-in function is not supported on the hw.
ERROR:  compilation errors.  No code generated.

   at com.deathpat.shoot.util.ShaderUtils.createShader(ShaderUtils.java:36)
   at com.deathpat.shoot.util.ShaderUtils.createProgram(ShaderUtils.java:67)
   at com.deathpat.shoot.model.renderer.Shader.create(Shader.java:50)
   at com.deathpat.shoot.display.gui.PanelDisplay.init(PanelDisplay.java:197)
   at com.deathpat.shoot.display.gui.PanelDisplay.<init>(PanelDisplay.java:139)
   at com.deathpat.shoot.display.gui.sets.MainPanelSet.<init>(MainPanelSet.java:23)
   at com.deathpat.shoot.model.scene.scenes.MainMenu.onInit(MainMenu.java:69)
   at com.deathpat.shoot.engine.scene.Scene.init(Scene.java:182)
   at com.deathpat.shoot.engine.scene.Scene.update(Scene.java:114)
   at com.deathpat.shoot.engine.scene.SceneManager.update(SceneManager.java:97)
   at com.deathpat.shoot.engine.Engine.oneLoop(Engine.java:348)
   at com.deathpat.shoot.engine.Engine.start(Engine.java:325)
   at com.deathpat.shoot.Daedalus.<init>(Daedalus.java:58)
   at com.deathpat.shoot.Daedalus.main(Daedalus.java:42)


I didn't think my graphics card was *that* old, I guess it may be time for an upgrade  Cry

15  Games Center / WIP games, tools & toy projects / Re: [WIP] Daedalus on: 2013-04-19 02:56:08
The game looks awesome!

I'm getting this error:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
java.lang.RuntimeException: Cannot compile shader /shaders/basique.frag : 
Fragment shader failed to compile with the following errors:
ERROR: 0:7: '' : Declaration must include a precision qualifier or the default precision must have been previously declared.
WARNING: 0:7: implicit cast from ivec2 to vec2
WARNING: 0:8: implicit cast from int to float
ERROR:  compilation errors.  No code generated.

   at com.deathpat.shoot.util.ShaderUtils.createShader(ShaderUtils.java:36)
   at com.deathpat.shoot.util.ShaderUtils.createProgram(ShaderUtils.java:67)
   at com.deathpat.shoot.model.renderer.Shader.create(Shader.java:50)
   at com.deathpat.shoot.display.gui.PanelDisplay.init(PanelDisplay.java:197)
   at com.deathpat.shoot.display.gui.PanelDisplay.<init>(PanelDisplay.java:139)
   at com.deathpat.shoot.display.gui.sets.MainPanelSet.<init>(MainPanelSet.java:23)
   at com.deathpat.shoot.model.scene.scenes.MainMenu.onInit(MainMenu.java:69)
   at com.deathpat.shoot.engine.scene.Scene.init(Scene.java:182)
   at com.deathpat.shoot.engine.scene.Scene.update(Scene.java:114)
   at com.deathpat.shoot.engine.scene.SceneManager.update(SceneManager.java:97)
   at com.deathpat.shoot.engine.Engine.oneLoop(Engine.java:348)
   at com.deathpat.shoot.engine.Engine.start(Engine.java:325)
   at com.deathpat.shoot.Daedalus.<init>(Daedalus.java:58)
   at com.deathpat.shoot.Daedalus.main(Daedalus.java:42)


I'm on Windows 7, Radeon X1950 Pro
16  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-17 18:56:36
Thanks davedes!

It's just like anything else, just by taking the time to dig into it.  I initially toyed around with parser generators (in particular Antlr) but found them extremely confusing and cumbersome to use.  Once I decided to write the lexing/parsing manually, things started going smoothly.  The book that helped out tremendously is http://www.amazon.com/Writing-Compilers-Interpreters-Software-Engineering/dp/0470177071.

My initial implementation was just a very simple Abstract Syntax Tree walker, essentially what BeanShell is.  Performance was not very good at all, but it motivated me in the sense that creating a language was "doable".
17  Games Center / WIP games, tools & toy projects / Re: A Java scripting language -- Leola on: 2013-04-17 15:59:11
It does borrow a lot of features from JavaScript.  The key differences are explicit language support for classes and namespaces.  I almost think it being so closely related to JavaScript is a good thing, in that it is easy to read and write.

I don't have a benchmark for the calculus, but I'd imagine they wouldn't be very good compared to C or Java.  Calculus isn't necessarily Leola's forte, the example was to show off closures and higher order functions.

For an interpreted language, it is actually fairly "fast".  The simple prototype games average ~60 FPS, which is pretty good given that 90% of the code is in Leola (the render calls and game loop are in Java).

I also use Leola for simple scripting tasks (updating/querying databases, moving/parsing files, etc.) and have never encountered performance problems.

18  Games Center / WIP games, tools & toy projects / A Java scripting language -- Leola on: 2013-04-17 00:47:49
Hello Java-Gaming.org,

I have been working on a programming language on and off now for about 3 years.  It doesn't really have an objective other than for entertainment for myself.  With that said, I have found it quite fun to program in!

It is written in Java and interfaces fairly well with Java.  If you are interested you can check out the project page at https://github.com/tonysparks/leola.

As a proof of concept I began to write a simple 2D game framework (currently just wraps Java2D) for simple/rapid prototyping.

Here is a screenshot of a simple Space Invaders clone:


Here is the Leola source code for the Space Invaders clone: http://pastebin.java-gaming.org/4584c18435b


Here is another screenshot of an in progress top down shooter:



Thank you all for your time!

-Tony
19  Games Center / Showcase / Re: Ricochet - An Android puzzle game on: 2011-01-06 03:57:25
Thanks Captain Awesome for the feedback!

What's interesting is I used JBox2d for the physics which seems to hold up OK.  I did have to go into the source and cache some values to improve performance.  I too have a Galaxy S phone and a couple of my friends have a Droid Incredible and Droid 2/X which all seem to run fine.  I'm interested in how it runs on lower end devices.  Some peoples comments mention it crashes -- which I can't reproduce on the emulator.  I'm guessing it's some sort of ClassNotFound/Method type of exception.  I'm thinking of catching any crashes and sending them to my server to analyze the exceptions.

Quote
Although I would like the ball to fly in the opposite direction of where my finger is, it seems more natural to me that way :p
Interesting, I'll have to test that out!  Maybe I'll include that in the options.  Thanks!
20  Games Center / Showcase / Re: Ricochet - An Android puzzle game on: 2011-01-05 02:01:40
Good to know, thank you princec.

Has anyone tried it out? If so what device? Was it fun?

Thanks you,

Tony
21  Games Center / Showcase / Re: Ricochet - An Android puzzle game on: 2011-01-04 04:38:06
I finally published a lite version of my game to the Android Market, you can find it here: http://www.androidblip.com/android-games/ricochet-lite-105516.html

I fixed the resolution bug and it now supports all resolutions. 

Thank you,

Tony
22  Games Center / Archived Projects / Re: sScroll package - - Simple 2D Side Scroller Engine Demo 1 on: 2011-01-01 22:54:08
First off, nice work!  I remember when I was in college I started a similar project with a couple of friends.  Not only did it help my programming/communication skills it also helped me get a job once I graduated.

Quote
3. Any tips on the best way to handle keyboard input. I notice that when a button is held down, it sends tons of key down events, but then only one key release event when u let up.
I have found that this can cause problems when using complex boolean operations inside an if else if ... statement.  This problems seem to disappear when using a switch. Probably has to do with the fact different mechanics of how testing is done with a switch.

Yes, if I remember correctly it also behaves differently on Win and *nix platforms as well.  I recommend keeping your own keyboard states and updating them when you see appropriate.

Here is some pseudocode:
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  
   class Key {
     boolean isDown; // is the key pressed?
    TimeUnit   nextTime  = new TimeUnit();  
     TimeUnit   totalTime = new TimeUnit();
  }

  Key keyboardKeys = new Key[255];
  Queue<KeyEvent> keyEvents; // key events this update

  // Process your input
 public void update(TimeStep timeStep) {
    while( ! keyEvents.isEmpty() ) {
       KeyEvent e = keyEvents.poll();
       processKeyboardEvents(timeStep, e.getKey(), e.isDown() );
    }
  }

  private void processKeyboardEvents(TimeStep timeStep, int key, boolean down) {

      if ( key > 0 && key < this.keyboardKeys.length ) {
         Key keyEvent = this.keyboardKeys[key];
         
         // key pressed?
        if (down) {
            // check to see if this is a newly pressed key
           if ( ! keyEvent.isDown ) {
               keyEvent.isDown=true;
               keyEvent.nextTime.toZero();
               keyEvent.totalTime.toZero();
               
               KeyEvent event = new KeyEvent(this, key);
               processKeyEvent(event, true);  
            }
            // do not allow multiple key presses in a given time frame
           else if ( keyEvent.totalTime.lessThanEq(KEY_DELAY) ) {              
               TimeUnitPlus(keyEvent.totalTime, timeStep.getElapsedTime(), keyEvent.totalTime);              
            }
            // this key has been held, so let it rip.
           else if ( keyEvent.totalTime.greaterThan(KEY_DELAY) ) {
               TimeUnitPlus(keyEvent.nextTime, timeStep.getElapsedTime(), keyEvent.nextTime);
               if (keyEvent.nextTime.greaterThan(NEXT_TIME) ) {
                  keyEvent.nextTime.toZero();
                 
                  KeyEvent event = new KeyEvent(this, key);
                  processKeyEvent(event, true);
               }
            }
         }
         // key released
        else {            
            keyEvent.isDown=false;
            keyEvent.nextTime.toZero();
            keyEvent.totalTime.toZero();
           
            KeyEvent event = new KeyEvent(this, key);
            processKeyEvent(event, false);
         }
      }
   }

   private processKeyEvent(KeyEvent event, boolean isDown) {
      // let listeners know of the KeyEvent
     for( KeyListener l : this.listeners) {
          l.onKey(event, isDown);
      }
   }

// java KeyListener
void keyPressed(KeyEvent e) {
   keyEvents.add(e); // queue them up so you can process them in the "update"
}
void keyReleased(KeyEvent e) {
   keyEvents.add(e); // queue them up so you can process them in the "update"
}


Quote
4. The best way to handle state for different objects.  Currently for any objects that I need to keep strict track of several states that the object could be in for logic purposes.  I currently have several binary flags I call state flags. which can be set to true or false.  The combination of all these flags and their values are what makes up an objects state in my code.  I was thinking this might be good to put these flags in some kind of order, that I can generate a binary number with, that I can test for specific binary strings to do complex state checks and therefore more complex state logic.

This will probably work for simple state machines, however I recommend looking into a more object orientated Finite State Machine class.  A quick google search on the topic gives some pretty good examples, this one in particular seems helpful: http://ai-depot.com/FiniteStateMachines/FSM.html

Hope this helps,

Tony
23  Games Center / Showcase / Ricochet - An Android puzzle game on: 2011-01-01 05:15:26
This is my first Android game, I have been working on it in my spare time since May 2010.

I plan to release a lite version (with ads) and a full version which includes a level editor.

Click here (Android APK: http://goo.gl/ZHUvJ ) for the beta release of the lite version. It currently only supports devices with a resolution of 480x800 or higher.

I did all the programming and graphics (please excuse the programmer art).

Feedback is welcomed.


Screenshots:

Main menu


In game


Thank you,

Tony Sparks
24  Java Game APIs & Engines / Android / Re: fastest way to draw a (mutable) bitmap? on: 2011-01-01 05:14:13
You might want to try making the image a power of two, 256x256.
25  Java Game APIs & Engines / Java Sound & OpenAL / Re: 3D Sound Engine on: 2010-02-21 18:54:30
I was browsing the API, first off it looks awesome!  I'm planning on using it for my project, however I didn't notice a way to stream the file contents from an InputStream versus supplying a file name.  I'd like to do this because I package all of my resources into a single archive file and access them via streams.  Is there a nice way to accomplish this?

Thank you,

Tony
26  Game Development / Game Mechanics / Phys2d collision mask on: 2009-07-17 05:52:27
Hello,

I am running into some troubles with the Phys2d bitmask on Body's.  I would expect that having a collision group of 1 set on two Body's would allow them to collide with each other.  However I could not get this to work, so I dug around in the code and noticed this in CollisionSpace.java:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
       /**
    * @see net.phys2d.raw.CollisionContext#resolve(net.phys2d.raw.BodyList, float)
    */

   public void resolve(BodyList bodyList, float dt) {
      for (int i = 0; i < bodyList.size(); ++i)
      {
         Body bi = bodyList.get(i);
         if (bi.disabled()) {
            continue;
         }
         
         for (int j = i+1; j < bodyList.size(); ++j)
         {
            Body bj = bodyList.get(j);
            if (bj.disabled()) {
               continue;
            }
                                // should this be if ((bi.getBitmask() & bj.getBitmask()) == 0)?
           if ((bi.getBitmask() & bj.getBitmask()) != 0) {
               continue;
            }
...


Has any one else encountered this problem?  In order for collision groups to work they have to be non-matching bits? - that doesn't make sense...

Thanks,

Tony
Pages: [1]
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Try the Free Demo of Revenge of the Titans

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (88 views)
2013-05-17 21:29:12

alaslipknot (96 views)
2013-05-16 21:24:48

gouessej (128 views)
2013-05-16 00:53:38

gouessej (123 views)
2013-05-16 00:17:58

theagentd (131 views)
2013-05-15 15:01:13

theagentd (119 views)
2013-05-15 15:00:54

StreetDoggy (161 views)
2013-05-14 15:56:26

kutucuk (184 views)
2013-05-12 17:10:36

kutucuk (185 views)
2013-05-12 15:36:09

UnluckyDevil (191 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.656 seconds with 21 queries.