Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 ... 23
1  Discussions / General Discussions / Re: Java Game Development in a High School Classroom? on: 2010-01-21 21:56:17
My suggestion is to start with a few good old zx spectrum classics that don't take much work and let your students remake them. Java2D is a solid game development api, so don't worry about it. I'm using Java2D together with Jython for the scripting language for a Starflight roguelike game i'm working, which supports both image icons (not animated) or unicode characters.

http://www.worldofspectrum.org/tbosg/
2  Discussions / General Discussions / Re: Java 7 to get Closures! on: 2009-12-05 20:54:40
You have JOCL, which i believe let's you compile code that will take advantage of GPUs to do vector math, but i would rather see this abstracted directly into the language. The problem i see is that Java is a sort of C language for the Java VM and network applications which are meant to run in all kinds of targets like mobile phones or even a refrigerator with a JVM connected to the internet.
3  Discussions / General Discussions / Re: Java 7 to get Closures! on: 2009-11-25 22:32:56
A compliant ahead-of-time compiler may not perform transforms across compilation-units.

Nothing to do with what i said.

4  Discussions / General Discussions / Re: Java 7 to get Closures! on: 2009-11-22 21:13:29
The Sun compiler makes no optimizations at all. It leaves them for the JVM to perform at startup and runtime. This allows the optimizations to specifically target the platform it's running on. I believe the IBM compiler does optimize code, but it's only small minor stuff.

That's OK for translating byte codes to native code but in this case you are optimizing at an higher level, deciding in what context an immutable object like Integer can be safely replaced by an equivalent primitive data type. This is an obvious optimization in many cases and the compiler should do this automatically.
5  Discussions / General Discussions / Re: Java 7 to get Closures! on: 2009-11-22 14:07:03
You already have direct buffers. Why would you need yet another primitive data type and how would this work with generics? Just look at what happens when mixing primitive arrays with generics already.

" The compilers in current VMs are not great at basic optimizations and transform objects into primatives would not be easy. This is because of the dynamic loading/compiling/linking nature of Java.  It would require a good lifetime compiler framework to make feasiable. "

Every VM uses primitive data types but these are usually hidden away in VM code and not accessed directly like you do in Java. It's the compiler and not the VM that does this kind of optimization and decides when it's safe to convert an object reference to a VM internal data type, but this would only be visible if you looked inside the generated VM code.
6  Discussions / General Discussions / Re: Fast scripting... on: 2009-11-21 21:45:43
It means it's a better solution than using a scripting language.
7  Discussions / General Discussions / Re: Java 7 to get Closures! on: 2009-11-21 21:38:50
In case someone missed the point i was being ironic. I prefer Java to stay within the mutli-threading/imperative programming paradigm.

The biggest stinker in Java is by far generics. I would rather see this fixed to be more intuitive and less restrictive.

And also remove primitives. Everything should be an Object. A good compiler can optimize simple immutable objects to be as fast as primitive objects.
8  Discussions / General Discussions / Re: Java 7 to get Closures! on: 2009-11-20 21:38:02
I wander when someone is going to ask for first class object continuations in Java.

http://www.ccs.neu.edu/home/dorai/t-y-scheme/t-y-scheme-Z-H-15.html#node_chap_13
9  Java Game APIs & Engines / JOGL Development / How useful is OpenCL? on: 2009-11-14 22:24:57
The same site that is hosting the JOGL project is also hosting Java bindings for OpenCL, JOCL? How useful is this for game programmers? What's the advantage?

http://projectkenai.com/projects/jocl/pages/Home

10  Java Game APIs & Engines / JOGL Development / Re: Opengl 3.2 SimpleJOGL on: 2009-11-09 23:10:10
That's an interesting example.
11  Java Game APIs & Engines / Tools Discussion / Using tuProlog for games on: 2009-11-04 21:18:20
I'm currently testing tuProlog as a scripting language and a simple relational database to use in games. In case someone is interested here's my impressions.

tuProlog is a Prolog interpreter created in 100% pure Java code. The official site is here: http://www.alice.unibo.it/xwiki/bin/view/Tuprolog/ hosted by a research institute of an italian university. Last modification and download size is 2008-12-23 and 1.8M. The number of core files (excluding guis and extras) is around 80 classes. The documentation includes a pdf user guide (which i find very well written and complete) and the api documentation which is also very complete.

The scructure of the installation file 2p-2.1.1.zip:
COPYRIGHT
CHANGELOG
doc
lib
LICENSE
src
test

It's refreshing to find a product like this, that is well organized, has a complete manual and doesn't force you to read source code or hack through a disorganized wiki in order to know how to use it.

tuProlog can be run double clicking on it's jar file (using a MacOSX) and a gui application will start. With this i can browse a theory, manage loaded libraries, enter queries to solve goals and see the results. In Prolog the source is called a theory which is a list of clauses. Running a program is solving a query goal which is the main method. Loading a library is like loading a package. This gui also let's me run a prolog program step by step and manage the methods  (clauses) to spy (breakpoints). It's very sophisticated and user friendly for research stuff.

Let's see how it works for a basic method to find a member in a list.

The source:
1  
2  
member(X,[X|R]).
member(X,[Y|R]) :- member(X,R).


Press the Set Theory button and the new theory is accepted. Now try to solve for the goal "member(1,[3,2,1])." by writing the text on the query field. The final dot is necessary. Press Enter and solution view shows:

1  
2  
yes.
Solution: member(1,[3,2,1])


Pressing the Next button shows there are no more solutions:

This programming language is a bit weird but i find it very useful to store game data and execute queries.

For example, i entered the following theory:

1  
2  
3  
4  
inventory(player,1,item(shield,ac(5),price(100))).
inventory(player,10,item(gold)).
inventory(player,10,item(potion,name(potion_of_healing),effect(heal))).
actor(player,name(x),str(10),int(10),agi(10),spd(10)).


Notice we can mix structured data similar to XML with tabular data and still query information in the same maner.

Inventory can be understood as a table with a reference to the player actor. To know how if the player has any potions and what effect they have i used the query string "Id=player, actor(Id, name(N), _, _, _, _), inventory(Id, Q, item(potion, name(PN), effect(PE)))." and the result is:

1  
2  
3  
yes.
Id / player  N / x  Q / 10  PN / potion_of_healing  PE / heal
Solution: ','('='(player,player),','(actor(player,name(x),str(10),int(10),agi(10),spd(10)),inventory(player,10,item(potion,name(potion_of_healing),effect(heal)))))


I didn't made any tests to performance but the idea i have is that this should be much slower than SQL and SQL would be much slower than using optimized data structures, but we can use Prolog just to store data textually and process it to an internal data structure like we would do with XML and XSLT.

Extending the language with libraries is easy and is very well explained in the manual. A library is a Java class that extends Library and provides methods that will be added as predicates, functors or directives to the theory. Libraries can be loaded and unloaded dynamically. The libraries provided are Basic, ISO, DCG, IO.

Using tuProlog directly as a scripting language for moders, even with a Prolog engine configured to use only builtin clauses, would not be safe. The alternative is to encode a scripting language in Prolog terms, validate scripts when loading and interpret them. It's very slow but it would give full control and safety options.

1  
2  
3  
4  
5  
script(myscript_1,[
instruction(...),
instruction(...),
...
]).


Resuming, my opinion is tuProlog may be a very good alternative to xml, xquery and xslt. As a scripting language for moding games it needs a lot of work to make it secure and efficient.
12  Discussions / General Discussions / Re: Looking for some tools to generate and call dlls from java on: 2009-11-01 21:05:04
Thanks a lot.

Now to find an intel assembler written in Java that can create ELF and PE shared libraries. Otherwise i will have to try writing one myself.
13  Discussions / General Discussions / Looking for some tools to generate and call dlls from java on: 2009-11-01 13:47:58
Python has an extension called ctypes  http://python.net/crew/theller/ctypes/  which is used to make calls to dlls for any os format. I'm looking for something like this but for Java.

Another tool i'm looking for is an intel assembler coded in Java that can build dlls for any os format. This tool complements the tool above.

The idea is to develop Java applications that can access native apis but are 100% coded and maintained using Java source and Eclipse. Not need for C code and native c compiler tools.

I tried looking for these two tools but found nothing. Does anyone know of an open source project that provides tools similar to this?
14  Game Development / Artificial Intelligence / Re: AI Scripting for Players? on: 2009-10-20 20:17:28
What i tested some days ago was to use Janino to dynamically compile scripts and run them with a SecurityManager that only permits using your game classes. you can't hide classes but you can prevent moders from using them and with Janino you can tell it to compile only class bodies and prevent the use of the import instruction.
15  Discussions / General Discussions / Java VM alternatives on: 2009-10-14 00:35:23
I'm looking to do some tests with alternative Java VMs. That is VMs that can run Java classes proper api classes installed and is stable enough to work with most Java libraries available on the net.

Having extras that will help with game development would be very interesting. Anything you can recommend?
16  Java Game APIs & Engines / JOGL Development / Re: glReadPixels, glDrawPixels / Overlay crash on: 2009-09-25 19:42:29
Check this thread. Maybe it helps.
http://java.sun.com/products/jfc/tsc/articles/mixing/
17  Java Game APIs & Engines / JOGL Development / Re: glReadPixels, glDrawPixels / Overlay crash on: 2009-09-25 10:10:37
If you are using Swing you should really use GLJPanel.
18  Java Game APIs & Engines / JOGL Development / Re: Some questions related to gl contexts and threads on: 2009-09-25 10:08:15
You can use the setIgnoreRepaint(true) method but this is only a good idea if your window is a standalone window. If you want a GL window integrated with a gui then GLJPanel might be the best option.
19  Java Game APIs & Engines / JOGL Development / Re: Some questions related to gl contexts and threads on: 2009-09-24 23:06:46
Quote
As far as it goes for other threads, it sounds like you have the right rules.  Keep in mind that JOGL by default forces everything onto the AWT thread internally, so you'll have to call Threading.disableSingleThreading() to correctly get different threads to work.

Is this still required if you aren't using a GLCanvas and building the GLDrawable directly?

I'm using the following code to associate a GLDrawable to a Frame. I'm actually surprised this is working.

1  
2  
3  
4  
5  
6  
private static Frame frame;
private static GLCapabilities capabilities;
private static GLDrawable drawable;
private static GLContext context;
private static GL gl;
private static GLU glu;


Part of a makeFrame method called from the main method.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
capabilities = new GLCapabilities();
AWTGraphicsDevice dev = new AWTGraphicsDevice(null);
AWTGraphicsConfiguration awtConfig = (AWTGraphicsConfiguration) GLDrawableFactory.getFactory().chooseGraphicsConfiguration(capabilities, null, dev);
     
GraphicsConfiguration config = null;
if (awtConfig != null) config = awtConfig.getGraphicsConfiguration();
     
frame = new Frame(title, config);
     
frame.setSize(PWIDTH,PHEIGHT);
frame.setFocusable(true);
frame.requestFocus();
     
drawable = GLDrawableFactory.getFactory().getGLDrawable(frame, capabilities, null);
context = drawable.createContext(null);

// add listeners to frame
...

frame.setVisible(true);


The main method.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
long period = (long)(1000.0 / DEFAULT_FPS) * 1000000L;
     
makeFrame("CubeGL (Active)", period);
     
while (!frame.isDisplayable()) Thread.yield();
     
drawable.setRealized(true); // can now be rendering into

stats = new FrameStatistics(period);
rot = new Rotator3D();
     
init();  // OpenGL initialization

loop();  // A while loop that calls simulUpdate and renderFrame

// Finalize
stats.printStats();
context.destroy();
System.exit(0);  

20  Java Game APIs & Engines / JOGL Development / Re: Problem with JOGL : Use of the AWT event queue? on: 2009-09-24 20:21:43
I never had any problem with active rendering following the receipt in the Killer Game Programming in Java online chapters. You don't even need a GLCanvas to draw with OpenGL. As long as you follow the precautions explained in the book it should work all right.
21  Java Game APIs & Engines / JOGL Development / Re: How add a mouse listener on OpenGL primitives? on: 2009-09-22 00:44:40
This can be seen as a collision testing problem. You are checking for collision between the unprojected line that passes through the pixel in the screen and your camera and all the world geometry that fits inside the visible area. A physics api like Bullet might be able to do this with advanced algorithms that take much less time than checking all the triangles of all objects in your scene.
22  Java Game APIs & Engines / JOGL Development / Re: Some questions related to gl contexts and threads on: 2009-09-20 21:52:15
Thanks. That puts some light on this subject.
23  Java Game APIs & Engines / JOGL Development / Some questions related to gl contexts and threads on: 2009-09-20 02:06:13
The jogl user guide says that the AWT thread is the one that has the opengl context current. Does this means it's ok to call gl methods from inside awt listeners?

Using jogl active rendering method similar to what is described in the Killer Game Programming book
http://fivedots.coe.psu.ac.th/~ad/jg2/ch15/index.html

suppose we want to use a different thread than AWT. If i understand correctly the rule is one drawable can have many contexts but one context per thread has to be associated to exactly one drawable. Also we have to make the context in each thread current before rendering one step and release it after. Is this correct?

What happens if we start messing with BufferStrategy in a canvas that is being used for opengl rendering? Just curious.
 
24  Game Development / Artificial Intelligence / Re: Character EXP Formula on: 2009-09-07 01:17:11
If you want to use a math formula to generate that table of values you need a function y=f(x) where 0=f(0) and N=f(100) and N is a very big value that is almost impossible to reach, like the maximum value of a float, MAX_FLOAT. It's not very hard to try a few solutions. The quadratic function could do the trick, y=x^2, but to to ensure that f(100)=MAX_FLOAT that won't do. Instead of using 2 for the power use log_100(MAX_FLOAT) (logarithm base 100) and that should do the trick, but not sure about this. The formula is y=x^(log_100(MAX_FLOAT)).

A more complete solution would ensure certain fixed values (example f(0)=0, f(25)=1000, f(50)=10000, f(75)=100000, f(100)=MAX_FLOAT) and then do a bezier or cubic interpolation between those values to build your table.
25  Game Development / Game Play & Game Design / Re: Scripting for games using Java on: 2009-09-02 22:06:52
Thanks for the input. I will check pnuts. It looks a solid scripting language.

"1) If you needed to compile Java source at runtime, with no IDE. But isn't there a JSR for this that made it into the JDK? Does Janino provide extra funcitonality?"

I have two requirements for a game scripting language 1) scripts can be compiled to bytecode and 2) it can be compiled dynamically. I know that java 1.6 has some support for dynamic compilation but i have a mac with with java 1.5 and i'm not sure if it works. Anyway it looks like Pnuts can do the job. 
26  Game Development / Game Play & Game Design / Re: Structural Game Design on: 2009-09-01 22:22:43
It might be cool as a graphical language for simple behaviors for game moders or just as a learning tool. Things like this have been around since i had my Commodore Amiga.
27  Game Development / Game Play & Game Design / Scripting for games using Java on: 2009-09-01 22:15:29
Better than using some crappy scripting language for a game is to use Janino

http://www.janino.net/

an embedded java compiler and which can load java classes directly from java source.

The problem with this is nothing prevents a modder who creates some extension for a game to access the java.io.* package and do all sorts of nasty things  without any restrictions.

My question is there a simple way to restrict a modders script when using Janino or other embedded java compiler as a game scripting solution?
28  Discussions / Miscellaneous Topics / Re: The end of Sun? on: 2009-07-18 19:58:57
Looks like we have a few Java unbelievers around here. Java isn't so easy to beat down. Java is now open-source and there are plenty of influential companies backing it up. If Sun dies Java will continue to be supported.
29  Discussions / General Discussions / Re: Another language feature I'd like on: 2009-07-12 12:56:23
WRT: Lisp - Its real power comes from being a metacircular language (like smalltalk, javascript, lua et al.) and you eval expressions (trees) not sequences.  Comparing two language so far apart in paradigm doesn't really make sense.  Things easy in one are hard in the other and vice-versa.  Attempts to push too many paradigms into a single language (have to date been) failures.

Thats not the real problem here. LISP and it's cousins are used in applications that would be impossible or very hard to work with Java or C++. To be used with Java games we would need a very efficient LISP to bytecode compiler. The simple way the Java VM handles call frames makes it difficult to do an efficient LISP compiler.

The Java language isn't very bad. What pisses me mostly is the mess of mixing primitives with real objects and the half-assed implementation of generics without real-time type checking RTT. The compiler should be smart enough to know when to use primitives internally and use RTT automatically. This is why we use an high level language, so that we don't need to bother with small optimizations.
30  Game Development / Game Play & Game Design / Re: YAVMA - Yet Another Vector Math API on: 2009-07-04 13:17:40
I guess there's no trouble if i just copy paste code from inside the vecmath api if i keep the GPL. My problem with vecmath is maintenance and using inheritance. Maintenance is by far the biggest issue. Vecmath has a lot of classes style Vector<N><T> and editing one class implies editing all the others. So what i'm going to do is to create a class that generates the java source. The files generated are a combo of: Byte, Int, Short, Float, Double types and 2,3,4,9,16 dimensions. There's no inheritance and all classes are final. With a few differences with the interface, like for example most methods return this at the end to allow chaining operations, this should work in a similar way to vecmath.
 

 

Pages: [1] 2 3 ... 23
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (38 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (28 views)
2014-10-15 16:18:58

TehJavaDev (53 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (64 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (78 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!