Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (530)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3
  ignore  |  Print  
  iPhone + kev g  (Read 12681 times)
0 Members and 1 Guest are viewing this topic.
Offline CommanderKeith
« Posted 2009-07-01 18:35:28 »

Hi,

I'm not sure if you follow Kev Glass's blog, but he's been doing some amazing things with the iPhone (and Android and applets). I hope he's ok with me posting this, it's just that I know that there's people here who are busting to use java on the iPhone, and that's sort of what kev has managed to do:

http://www.cokeandcode.com/kevsblog

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #1 - Posted 2009-07-01 18:43:31 »

yup its pretty awesome stuff, been following it too, you simply write code with the simple api and it'll work as an applet, android and the iphone app (no jailbreak needed), very cool stuff.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #2 - Posted 2009-07-01 19:23:44 »

That's cool! It's sort of too bad that I've already ported my Java 2D game API to iPhone (manually) and then written an entire game straight in Objective-C, but maybe I can port some of my other Java games over this way. The problem is whether any of my games are fun enough to be worth the time... :p

See my work:
OTC Software
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #3 - Posted 2009-07-01 19:30:27 »

That's cool! It's sort of too bad that I've already ported my Java 2D game API to iPhone (manually) and then written an entire game straight in Objective-C, but maybe I can port some of my other Java games over this way. The problem is whether any of my games are fun enough to be worth the time... :p

Sounds like you'd be an excellent candidate for porting the remaining library code abstraction layer into Objective-C =)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #4 - Posted 2009-07-01 19:41:06 »

Hi,

I'm not sure if you follow Kev Glass's blog, but he's been doing some amazing things with the iPhone (and Android and applets). I hope he's ok with me posting this, it's just that I know that there's people here who are busting to use java on the iPhone, and that's sort of what kev has managed to do:

http://www.cokeandcode.com/kevsblog

It's a noble pursuit; but i'm pretty sure there are other automated solutions in existance for doing it that are in a much more mature state. (though they'll obviously cost $$$)

Innaworks' alcheMo is one for sure.

I'm curious how Java's more complex language constructs are translated into objective-c; finally blocks, threading & synchronization, etc.
From what I remember, that's what made J2ME -> Brew more complicated than one would have first imagined.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #5 - Posted 2009-07-02 01:41:04 »

Sounds like you'd be an excellent candidate for porting the remaining library code abstraction layer into Objective-C =)
Perhaps. :p

I really don't have the time to do something like this, though. I don't even have time to do my own games anymore. Sad

See my work:
OTC Software
Offline zammbi

JGO Coder


Medals: 4



« Reply #6 - Posted 2009-07-02 07:32:43 »

Sounds all very interesting. Would be great if you could easy port Java code to iPhone.
I wouldn't mind seeing the results for myself.

Current project - Rename and Sort
Offline stained

Senior Newbie





« Reply #7 - Posted 2009-07-02 12:34:06 »

I'm fine with you posting it.

Kev
Offline stained

Senior Newbie





« Reply #8 - Posted 2009-07-02 12:36:03 »

This image describes most of what I've been doing.

Kev
Offline ChrisM

JGO Coder


Medals: 1
Projects: 1


END OF LINE.


« Reply #9 - Posted 2009-07-02 16:08:00 »

Welcome back Kev Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ShannonSmith
« Reply #10 - Posted 2009-07-02 20:09:28 »

I knew I had never seen the two of you in the same room at the same time. How was Krypton?

Welcome back dude.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #11 - Posted 2009-07-02 21:06:01 »

Hi Kev.

See my work:
OTC Software
Offline h3ckboy

JGO Coder


Medals: 5



« Reply #12 - Posted 2009-07-02 21:49:17 »

didnt know you long, but nice to have you back.
Offline noblemaster

JGO Ninja


Medals: 20
Projects: 10


Age of Conquest makes your day!


« Reply #13 - Posted 2009-07-02 22:58:11 »

It's definitely an intriguing project! I ported my game Aevum Obscurum to both the Android & iPhone platform and I noted that Objective C is actually a lot closer to Java than I initially though. I ended up converting Android Java code directly to Objective C. However, I guess the crux lies in the detail.

Offline CommanderKeith
« Reply #14 - Posted 2009-07-03 19:27:58 »

Hey nice to hear from you again Kev!  I always knew you'd be drawn back!  Cool

Offline stained

Senior Newbie





« Reply #15 - Posted 2009-07-15 16:52:21 »

For anyone interested, I got some OpenGL ES stuff working. I've used NeHe lesson 4 (a rotating triangle and quad) as a reference since it's a nice simple proof of concept.

Running in the Java base simulator in windows - this is using JOGL currently cause I felt like a change. Hopefully use DGLES+JNA at some point soon:



And this is the same java code, passed through XMLVM into objc and compiled for the iphone. This is the iphone emulator on OSX:



Here's the code thats running it which I think looks reasonably like normal Java, except maybe the buffer usage. Thats simply because of my limited objc implementation of java.nio.*Buffer.

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  
package org.xmlvm.iphone.gl.nehelesson4;

import java.nio.FloatBuffer;

import org.xmlvm.iphone.CGRect;
import org.xmlvm.iphone.gl.BufferUtils;
import org.xmlvm.iphone.gl.GL;
import org.xmlvm.iphone.gl.GLView;

public class NeHeLesson4View extends GLView {
   private static final float TO_RADIANS = (3.14159f / 180.0f);
   
   private boolean viewSetup = false;
   private float zFar;
   private float fieldOfView;
   
   private float rtri = 0;
   private float rquad = 0;
   
   private FloatBuffer triVertices;
   private FloatBuffer triVertexColors;
   private FloatBuffer quadVertices;
   
   private float viewWidth;
   private float viewHeight;
   
   public NeHeLesson4View(CGRect rect) {
      super(rect);
   
      viewWidth = rect.size.width;
      viewHeight = rect.size.height;
      System.out.println("View: "+viewWidth+","+viewHeight);
     
               setOpaque(true);
               setClearsContextBeforeDrawing(false);
   }

   private void initViewGL() {
      System.out.println("Init view");
      triVertices = BufferUtils.createFloatBuffer(9);
      triVertexColors = BufferUtils.createFloatBuffer(12);
      quadVertices = BufferUtils.createFloatBuffer(12);
     
      triVertices.put(-1).put(-1).put(0.0f)
      .put(1).put(-1.0f).put(0.0f)
      .put(-1.0f).put(1.0f).put(0.0f);
     
      triVertexColors.put(1).put(0).put(0).put(1)
      .put(0).put(1).put(0).put(1)
      .put(0).put(0).put(1).put(1);
     
      quadVertices.put(-1).put(1).put(0)
      .put(1).put(1).put(0)
      .put(1).put(-1).put(0)
      .put(-1).put(-1).put(0);
     
      float zNear = 0.1f,
      zFar = 1000.0f,
      fieldOfView = 60.0f;
      float size;
     
      GL.glMatrixMode(GL.GL_PROJECTION);
      size = zNear * (float) Math.tan((TO_RADIANS * fieldOfView) / 2.0);
      GL.glLoadIdentity();
      GL.glFrustumf(-size, size, -size / (viewWidth / viewHeight), size /
               (viewWidth / viewHeight), zNear, zFar);
     
      GL.glViewport(0, 0, (int) viewWidth, (int) viewHeight);
      GL.glMatrixMode(GL.GL_MODELVIEW);
      GL.glLoadIdentity();
      GL.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
   }
   
   @Override
   public void renderView() {
      if (!viewSetup) {
         viewSetup = true;
         initViewGL();
      }
     
      GL.glClear(GL.GL_COLOR_BUFFER_BIT);

      GL.glLoadIdentity();
      // Triangle
     GL.glTranslatef(-2.0f,1.0f,-6.0f);
      GL.glRotatef(rtri,0.0f,1.0f,0.0f);  
      GL.glEnableClientState(GL.GL_VERTEX_ARRAY);
      GL.glEnableClientState(GL.GL_COLOR_ARRAY);
      GL.glColorPointer (4, GL.GL_FLOAT, 0, triVertexColors);
      GL.glVertexPointer(3, GL.GL_FLOAT, 0, triVertices);
      GL.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 3);
      GL.glDisableClientState (GL.GL_COLOR_ARRAY);
     
      // Square
     GL.glLoadIdentity();
      GL.glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
      GL.glTranslatef(2.0f,1.0f,-6.0f);
      GL.glRotatef(rquad,1.0f,0.0f,0.0f);
      GL.glVertexPointer(3, GL.GL_FLOAT, 0, quadVertices);
      GL.glDrawArrays(GL.GL_TRIANGLE_FAN, 0, 4);
      GL.glDisableClientState(GL.GL_VERTEX_ARRAY);
     
      rtri += 1.5f;
      rquad -= 2.5f;
   }

}


I still think this has quite a lot of potential.

Kev
Offline Ranger
« Reply #16 - Posted 2009-07-16 05:26:07 »

"Java base simulator in windows"?  Did you write this as well?  So effectively you can go from Java -> ObjC -> Java?
Offline stained

Senior Newbie





« Reply #17 - Posted 2009-07-16 09:17:53 »

The simulator is part of the XMLVM project. It's not java -> objc -> java. It's simulator rather than an emulator.

When you're writing the Java code to be compiled to objc you have to code against an API written in Java. This is what XMLVM call the compatibility library. They could have just left that API as exactly that, empty API methods for each of the iPhone SDK functions. However, instead they implemented the methods in terms of Java2D - so you end up with a way to test you Java code before you go to objc.

Kev
Offline Ranger
« Reply #18 - Posted 2009-07-16 09:33:06 »

Ah, yes.  That makes sense.  Very impressive stuff btw!
Offline gouessej
« Reply #19 - Posted 2009-07-16 10:14:39 »

Hi!

It is nice to see that you can write some source code in Java for IPhone even though it has to be converted into Objective-C, nice work, keep it up.

Running in the Java base simulator in windows - this is using JOGL currently cause I felt like a change. Hopefully use DGLES+JNA at some point soon:
What is wrong with using JOGL? JNA relies on Platform Invoke, doesn't it? Therefore, DGLES+JNA should be noticeably slower than JOGL 2. Some C# bindings for OpenGL rely on the mechanism of platform invoke and they are twice slower than JOGL, I think about Tao Framework for example.

Offline stained

Senior Newbie





« Reply #20 - Posted 2009-07-16 10:30:16 »

Nothing wrong with JOGL, but it doesn't provide me on a GLES interface on the desktop - while it does provide ES bindings it doesn't bind these to the API on the desktop since it GLES isn't present on the desktop.

At the moment I'm using OpenGL to simulator GLES, but that's not going to be accurate as actually providing a GLES stack on the desktop - which is what DGLES (another open source project) attempts to do.

Performance arn't much of a concern here since I'm simulator a phone's rendering performance on the desktop - if anything it being a bit slower is more accurate to the target platform.

Kev
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #21 - Posted 2009-07-22 23:16:56 »

Learning Objective-C really isn't that hard, though.

For most people - who just want to write stuff for iPhone (in addition to wahtever else they write for web) - it's only going to take a couple of days at most to learn ObjC.

Pretty much: learn how to use basic ref-counting, learn how to use Apple's rather crap @property syntax (and the bizarre rules about usage), learn the basic method calls for the Apple rendering libraries, and finally: learn how to write anythign at all in Xcode (the IDE you are forced to use).

I was shocked that it took me a mere 7 hours - from scratch - to write my first game on iPhone (including time taken to write my first hello-world App). It also took an extra 7 hours or so just to read various obj-c docs, so all in all I started one morning, and finished the following evening.

For comparison (I'm not a great nor an especially fast coder) that's about how long it took me to get my first game working with Slick.

So ... while I eagerly watch the experiments with Java->ObjC compilation, that really shouldn't hold anyone back from just learnign ObjC and going and writing some games *right now*. Especially given how easy it is to earn real cash from iPhone apps right now (it's very easy to earn a few thousand dollars per app; earning tens of thousands is hard, 100's of thousands very hard, and more than that is a lot of luck - even for huge dev teams (I know three teams that spent more than 400k dollars on iphone development and failed to make a profit)).

malloc will be first against the wall when the revolution comes...
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2
Exp: 14 years


Make it work; make it better.


« Reply #22 - Posted 2009-07-23 00:07:09 »

Learning Objective-C really isn't that hard, though.

For most people - who just want to write stuff for iPhone (in addition to wahtever else they write for web) - it's only going to take a couple of days at most to learn ObjC.

Pretty much: learn how to use basic ref-counting, learn how to use Apple's rather crap @property syntax (and the bizarre rules about usage), learn the basic method calls for the Apple rendering libraries, and finally: learn how to write anythign at all in Xcode (the IDE you are forced to use).

I was shocked that it took me a mere 7 hours - from scratch - to write my first game on iPhone (including time taken to write my first hello-world App). It also took an extra 7 hours or so just to read various obj-c docs, so all in all I started one morning, and finished the following evening.

For comparison (I'm not a great nor an especially fast coder) that's about how long it took me to get my first game working with Slick.

So ... while I eagerly watch the experiments with Java->ObjC compilation, that really shouldn't hold anyone back from just learnign ObjC and going and writing some games *right now*. Especially given how easy it is to earn real cash from iPhone apps right now (it's very easy to earn a few thousand dollars per app; earning tens of thousands is hard, 100's of thousands very hard, and more than that is a lot of luck - even for huge dev teams (I know three teams that spent more than 400k dollars on iphone development and failed to make a profit)).
Except 1 thing.  Unfortunately, I don't have over $1000US to by a Mac product to program on.

Offline stained

Senior Newbie





« Reply #23 - Posted 2009-07-23 20:59:57 »

Do what you like, I'm not trying to stop anyone learning ObjC. I learnt it first and hated it with a vengence. What I'm doing here is just interesting to me (and evidently someone here who posted originally).

Could you post your stats sources for your iPhone application sales btw, most of the anecdotal stories out there tell a pretty different tale. The market is mostly flooded now, most small apps make close to zero with a few special ones making plenty - little middle ground. 

So in an equally meaningless and off topic comment, don't let Blah^3 glowing profit analysis of the iPhone market jump to making your fortune there - if you're focused on nothing but cashing in the smart market might be Android, predicted 900% growth in 2009 alone. For that too you won't need XMLVM, but at least it's familiar territory.

Kev
Online kevglass

JGO Kernel


Medals: 118
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #24 - Posted 2009-08-08 01:03:00 »

A bit of an update, good news on the publishing stuff. The first game Fruity Pops using this stuff is now a dual release on Android and iPhone, which is pretty cool.

It's also available on the web as an applet using a web play password.

Kev

Offline brackeen

Junior Member





« Reply #25 - Posted 2009-08-08 05:47:22 »

Gratz on the release!

BTW how does XMLVM deal with iPhone's lack of garbage collection?
Online kevglass

JGO Kernel


Medals: 118
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #26 - Posted 2009-08-08 09:31:30 »

It uses AutoRelease pools (alot!)

I tend to code carefully to avoid GC as much as possible (since thats better on android anyway)

Kev

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11


Game Engineer


« Reply #27 - Posted 2009-08-10 04:58:20 »

You can pretty much emulate Java's garbage collector if you just follow a specific method of autorelease pools. The only difference is that you still need to call retain when creating the variable and release when you're done with it. But otherwise it works pretty well, you've just got to override dealloc methods in a smart way. I'll bet that would be pretty easy to mechanize.

See my work:
OTC Software
Offline steveyO
« Reply #28 - Posted 2009-08-26 01:13:17 »

Wow.. Very impressive Kev..  Downloaded aboid a couple of hours ago and manage to configure eclipse/upgrade to jdk6 and get your Demo applet running in couple of hours..  Downloading Eclipse 3.4 at moment to Test Android SDK Stuff...All seems pretty smooth so far..

Do you plan on releasing new versions/updates of aboid?  Am seriously considering writing a little puzzle game using this (cba with Obj C, looks like you and the xmlvm guys have done all the hard stuff)..

Quote
It's also available on the web as an applet using a web play password.
Congrats on the release too.. Hope goes well.. ps. Whats a webplay password? Your website has a textbox for this but no explanation on what it is or how to get it...

S

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Online kevglass

JGO Kernel


Medals: 118
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #29 - Posted 2009-08-26 02:10:36 »

aboid is still going on in the background. Hopefully news soon. The stuff that's been released already should be enough for puzzley things and I've just submitted a nice big patch back to XMLVM to add OpenGL support Smiley

We've yanked the Fruity Pops release off iPhone at the moment after finding a rather hideous bug in the XMLVM implementation of System.currentTimeMillis. We should be re-releasing Fruity Pops (along with a Lite version) to iPhone very soon now. There's also two more games (with both lite and full versions) ready for dual release on Android and iPhone - I'll post once they're live (assuming Apple don't shoot us first).

WebPlay is part of what you're getting when you buy the full version. It's nice to play on your phone on the bus, but once you're in the office wouldn't it be nicer to play the games as applets? Smiley The full versions come with a button that gives you a code to type into the website - that lets you access the lite versions of the games on the web.

In the mean time I'm hacking away at an RPG and then on to new stuff.. http://www.cokeandcode.com/rpgagain/dungeondesigner3.png

Kev

Pages: [1] 2 3
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (34 views)
2014-07-18 06:55:21

Zero Volt (30 views)
2014-07-17 23:47:54

danieldean (25 views)
2014-07-17 23:41:23

MustardPeter (27 views)
2014-07-16 23:30:00

Cero (42 views)
2014-07-16 00:42:17

Riven (44 views)
2014-07-14 18:02:53

OpenGLShaders (33 views)
2014-07-14 16:23:47

Riven (34 views)
2014-07-14 11:51:35

quew8 (30 views)
2014-07-13 13:57:52

SHC (66 views)
2014-07-12 17:50:04
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!