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" |
|
|
|
|
|
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
| var conn = db:connect("dbUrl", "myuser", "password")
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) ) |
|
|
|
|
|
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
| 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" })
enemy.somethingNew = "a new property" enemy.somethingElse = def() return "a new function"
println( enemy.somethingNew ) println( enemy.somethingElse() ) |
|
|
|
|
|
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  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.zipTo 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  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
| 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)
class X(); class Y();
var x = new X()
switch { when x is Y -> println("x is Y") when x is X -> println("x is X") else println("Unknown") } class Z() is Y(); var z = new Z()
switch { when z is X -> println("z is X") when z is Y -> println("z is Y") else println("Unknown") } |
|
|
|
|
|
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 
|
|
|
|
|
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
|
|
|
|
|
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/4584c18435bHere 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. 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!
|
|
|
|
|
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. 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; TimeUnit nextTime = new TimeUnit(); TimeUnit totalTime = new TimeUnit(); }
Key keyboardKeys = new Key[255]; Queue<KeyEvent> keyEvents; 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]; if (down) { if ( ! keyEvent.isDown ) { keyEvent.isDown=true; keyEvent.nextTime.toZero(); keyEvent.totalTime.toZero(); KeyEvent event = new KeyEvent(this, key); processKeyEvent(event, true); } else if ( keyEvent.totalTime.lessThanEq(KEY_DELAY) ) { TimeUnitPlus(keyEvent.totalTime, timeStep.getElapsedTime(), keyEvent.totalTime); } 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); } } } 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) { for( KeyListener l : this.listeners) { l.onKey(event, isDown); } }
void keyPressed(KeyEvent e) { keyEvents.add(e); } void keyReleased(KeyEvent e) { keyEvents.add(e); } |
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
|
|
|
|
|
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
| 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; } 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
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|