Games!
By Name
By Date Added
By Last Update
By Rating
By Type
[Advanced Search]
 
Register
Log in
News Submit a Game Forums About/FAQ
FAQFAQ SearchSearch MemberlistMemberlist
Log in to check your private messagesLog in to check your private messages

Web-based games
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Linux Game Tome Forum Index -> Game Development
View previous topic :: View next topic  
Author Message
GBGames
Newbie


Joined: 29 Oct 2006
Posts: 22
Location: Chicago, IL, USA

PostPosted: Mon Jul 28, 2008 12:59 pm    Post subject: Web-based games Reply with quote

I've been working with C++ for the past few years, but I'm thinking that I should switch languages to something that lets me deploy a game that runs in a web browser simply because I find that I don't download and install games as often as I bring them up in Firefox and I figure that it is probably the case for many others as well.

But since I do all of my development using FLOSS on Gnu/Linux, it means I can't use Adobe's Flash development tools. Then again, I know that they have provided some CLI tools that run on Gnu/Linux. I also know of someone's work on a compiler or some other tool that turns C++ code into Flash executables, although it isn't very complete as I understand it. Still, it would be nicer if Flash ran consistently on Gnu/Linux browsers as well as Win32 and Mac, but until it stops freezing up the browser simply by being on YouTube (you would think!), it seems like an unstable platform.

I keep hearing discouraging words about using Java applets (although to be honest, I can't remember any specific arguments other than that they are "terrible"), but it seems like the best option for me so far. I also know of the Processing language which is kind of like a simplified wrapper for Java, as I understand it, which should help with prototyping.

Are there any really compelling reasons NOT to use Java applets? I always kind of looked at applets and Flash in my browser as similar in the sense that they are both plugins and both let me have regular-ish applications in a browser. The main differences to me: Java is open source now, there has always been a compiler available for Gnu/Linux, and I've already used it in the past, so there will be less of a learning curve here than with Flash development. I think I read that Flash is much more prevalent, but is there really a significant problem with Java penetration?
_________________
--
GBGames' Blog: An Indie Game Developer's Somewhat Interesting Thoughts http://www.gbgames.com/blog

Staff Reviewer for Game Tunnel: The Independent Underground http://www.gametunnel.com
Back to top
View user's profile Send private message Visit poster's website
shevegen
Happypenguin Regular
Happypenguin Regular


Joined: 14 Dec 2004
Posts: 185

PostPosted: Mon Jul 28, 2008 3:15 pm    Post subject: Reply with quote

I dont have much time so i be short but I can add one thing to this here:

Quote:
I keep hearing discouraging words about using Java applets (although to be honest, I can't remember any specific arguments other than that they are "terrible"),


The biggest problem is that it requires the client to have Java installed.
And I dont know, I seem to be too stupid to install Java.

And since I dont use Java, but there are many web games that do NOT require Java, I see absolutely no point at all in downloading Java just so I can use Java Applets and play a game...

Flash is already annoying enough, but there is no way that I will have both flash and java. Flash apps at least look nice too, even though I am not a fan of flash.

But I think the time of java applets is +4 years ago already ...
Back to top
View user's profile Send private message
carlosm7
Mewling Newbie


Joined: 06 Jul 2008
Posts: 1

PostPosted: Mon Jul 28, 2008 3:24 pm    Post subject: Would you like to try it? Reply with quote

Hi.

If you can make an Atari 2600 emulator in Java, then you certainly can make games in Java.

If you want to try it:

jstella
Back to top
View user's profile Send private message
Ajapted
Newbie


Joined: 01 Feb 2007
Posts: 43
Location: Tasmania

PostPosted: Mon Jul 28, 2008 8:24 pm    Post subject: Reply with quote

Flash is a proprietry platform, for that reason alone you shouldn't use it if your a FLOSS kind of guy, otherwise you're simply helping it become more entrenched.

A few years ago I was working on a rogue-like game as a Java applet. I limited myself to Java 1.1 which was the only version you could rely on back then (especially for Windows IE), but things have probably moved on since then....

One issue I remember is that an applet's size is fixed in the webpage (the APPLET or OBJECT html tag must specify the exact size). That's a pain if you want to make it work on any browser window size. My solution was a little Java applet that determined the window size and when the user cliked the "Play" button, it redirected the browser to another page (containing the full applet) and passed the window size using PHP variables.

AWT (Abstract Window Toolkit iirc) is the Java API which applets use for input events and drawing. It took me quite a while to get used to its system of drawing. Instead of drawing stuff when and where you want, you have to do all your drawing when your applet's Paint() method gets called by the runtime.

There might be a better toolkit than AWT by now...

Another issue was focus, if the user does something like use the scrollbar in the browser, then the applet loses focus (won't get keyboard events) yet there is nothing to indicate this. My solution was to wait a little while after losing focus and then show a message that the applet has lost focus and need to click on it to continue.

Finally, I remember that you can't rely on getting all keyboard events, keys like ESCAPE, TAB and even the cursor keys would work on some platforms and not others (Windows IE was the worst in this regard). Again that situtation has probably improved by now.

P.S. I should add that despite these minor issues it did run pretty well, it could draw a 640x480 game screen (made of 32x32 tiles and some text) plenty fast enough for a turn-based game, even on slow computers back then.
Back to top
View user's profile Send private message
fireside
Happypenguin Veteran
Happypenguin Veteran


Joined: 05 Jan 2005
Posts: 211

PostPosted: Mon Jul 28, 2008 10:23 pm    Post subject: Reply with quote

I'm just learning java applets. The setup is a little awkward. Netbeans is a nice editor and has decent tutorials. One limitation that they are just getting rid of now is that an applet can only be about 64 meg or something like that. It's not proprietary, It's GPL and Ubuntu will soon be able to carry the Sun version.
For 2D games, take a look at JGame.
For 3D, JMonkey engine can do applets but it's pretty big. I'm using a free proprietary engine called jpct. Very nice and small, about 200 k for the software renderer, and it's pretty fast. Java is constantly getting faster so the applets are, of course, getting faster, too.
Try out some of the demos, I think you'll find they work very well. Flash is too expensive. Java is also working on a scripting type deal like flash called javafx and they plan on including Opengl bindings in the JRE. They're really starting to focus on making applets better.
Back to top
View user's profile Send private message
god64
Happypenguin Regular
Happypenguin Regular


Joined: 07 Feb 2005
Posts: 74
Location: Germany

PostPosted: Mon Jul 28, 2008 11:27 pm    Post subject: Re: Web-based games Reply with quote

GBGames wrote:

Are there any really compelling reasons NOT to use Java applets? I always kind of looked at applets and Flash in my browser as similar in the sense that they are both plugins and both let me have regular-ish applications in a browser. The main differences to me: Java is open source now, there has always been a compiler available for Gnu/Linux, and I've already used it in the past, so there will be less of a learning curve here than with Flash development. I think I read that Flash is much more prevalent, but is there really a significant problem with Java penetration?


i was a java developer for quite some time and here are quite a few things that drove me back to other languages:


  • its not multi platform, it just runs on solaris, linux, windows, mac and maybe a few bsd's, i am currently developing a plain c cross platform game framework which currently runs on 11 platforms (thanx to sdl), try this with java ;)

  • its slow... yes it is... it is not as slow as most people think, but it is slower than c. i know... using things like jmonkeyengine, which is a great engine, i have to admit, a lot of game stuff is done directly in the graphics hardware, but compared to plain c, java is slow(er), so why go for the slower thing, especially in games programming?

  • it's a hell of a version mess. java compiled with 1.6 does not run on 1.5, even if it does not use specific 1.6 features. there are millions of different versions out there and you can't really force all that users to upgrade every time they want to play a game

  • you'll have to change your code quite some times. sun changes the java api on a regular basis and you'll end up using functions that were not deprecated when you started your project but are now. although i dont know any function that was ever removed, i think these are just compiler warnings

  • the java syntax slowly has progressed from a clean syntax to ugly c++ish mess, so why not use the original mess ;)



thats all of i can think of for now, i'll let you know if my very bad in remembering brain reveals a few more ;)
_________________
winning a internet discussion is like winning the special olympics - you might win, but you're still a retard
Back to top
View user's profile Send private message Visit poster's website
GBGames
Newbie


Joined: 29 Oct 2006
Posts: 22
Location: Chicago, IL, USA

PostPosted: Tue Jul 29, 2008 4:01 am    Post subject: Reply with quote

Wow, thanks for the comments! I didn't know about the version hell issue with Java. I'm kind of having the same problem with C++/GLIBC, and I also find that there is a difference between compiling my games on Ubuntu and compiling them on Debian. What a pain.

I remember how much effort I had to go through to get Java on my computer AND in my web browser. I would hope that these efforts are easier now.

So it seems my options are to make games for a proprietary platform, or to make games for a platform that is really multiple platforms and is hard to install. B-( This is a sad state.
_________________
--
GBGames' Blog: An Indie Game Developer's Somewhat Interesting Thoughts http://www.gbgames.com/blog

Staff Reviewer for Game Tunnel: The Independent Underground http://www.gametunnel.com
Back to top
View user's profile Send private message Visit poster's website
fireside
Happypenguin Veteran
Happypenguin Veteran


Joined: 05 Jan 2005
Posts: 211

PostPosted: Tue Jul 29, 2008 5:27 am    Post subject: Reply with quote

Java maintains backward compatibility at least for a very long time so you don't really need to worry about that much. It's a little slower than c, but it has a lot of useful libraries. Setup is only going to get easier as Ubuntu and other distribs put it in. On the web, it will automatically load the updated versions of packages to the client. C has more setup problems than java because you have to constantly compile everything for the platform. If you're interested in the web, it's the best open source choice for doing 3d or 2d around. You can also use the Google Web Toolkit to write your complete ajax pages with it. Not sure if their Linux version is done yet. It really is a good cross platform environment. No special versions for each OS. I've been off an on with a lot of languages, but I think java will end up being what I use most except for some quick scripting with python. I've never liked c++, though. I just used it because it was the only thing fast enough for games for a while.
Back to top
View user's profile Send private message
mrsneeze
Mewling Newbie


Joined: 03 Nov 1999
Posts: 7

PostPosted: Mon Aug 04, 2008 9:03 am    Post subject: Reply with quote

I've taken to programming for flash lately for probably a similar set of reasons to you - it seems a lot more sensible to just have games that run in browsers. I use linux exclusively for development, and there's not a problem for me in terms of the flash player - (although it's not libre) the recent versions of the official plugin from Adobe seem fine. If you don't want to use the official Adobe tools to make the flash files, you can use HaXe (http://www.haxe.org) which is open source and works well enough for me.
Back to top
View user's profile Send private message Visit poster's website
unavowed
Newbie


Joined: 27 Apr 2006
Posts: 15

PostPosted: Mon Aug 04, 2008 2:02 pm    Post subject: Reply with quote

Just to make the discussion clearer:

1. Java is fast enough for graphics-intensive 3D games (see Tribal Trouble and jake2), it will likely never beat C/C++ in potential for performance, but depending on what's most important to you the advantages of using Java can outweigh the cost in speed.

2. There is no version mess because when compiling you can pass -source <version> and -target <version> to the compiler telling it what the source version is and what the bytecode version it should be compiled for. It makes sense to use 1.5 (maybe 1.4) for the target, as most people seem to have at least 1.5 installed. With this you can use for example Java 1.6 to compile programs which will work with all versions starting with the one you specify (like 1.4 or newer, but then be careful not to use library parts only introduced in later versions).

3. Functions indeed get deprecated but it is not a huge maintainance pain, and in practice they still get included in future versions.

4. Check out JNLP (WebStart) for an alternative to using applets when you want to start a game in a browser. It is quite simple (the aforementioned jake2 uses it for one) and it can take just 1 or 2 clicks to start playing a game.
Back to top
View user's profile Send private message
GBGames
Newbie


Joined: 29 Oct 2006
Posts: 22
Location: Chicago, IL, USA

PostPosted: Mon Aug 04, 2008 2:22 pm    Post subject: Reply with quote

I'll have to look at jake2. My experiences with Webstart have been painful, and that was as a user of someone else's game.
_________________
--
GBGames' Blog: An Indie Game Developer's Somewhat Interesting Thoughts http://www.gbgames.com/blog

Staff Reviewer for Game Tunnel: The Independent Underground http://www.gametunnel.com
Back to top
View user's profile Send private message Visit poster's website
god64
Happypenguin Regular
Happypenguin Regular


Joined: 07 Feb 2005
Posts: 74
Location: Germany

PostPosted: Tue Aug 05, 2008 1:52 am    Post subject: Reply with quote

unavowed wrote:

2. There is no version mess because when compiling you can pass -source <version> and -target <version> to the compiler telling it what the source version is and what the bytecode version it should be compiled for. It makes sense to use 1.5 (maybe 1.4) for the target, as most people seem to have at least 1.5 installed. With this you can use for example Java 1.6 to compile programs which will work with all versions starting with the one you specify (like 1.4 or newer, but then be careful not to use library parts only introduced in later versions).


didn't know of that, but the fact remains: what if you do use 1.6 features? want to force everyone in the world to update, especially the browser plugin, which can be a pain on amd64 platforms and is afaik not available at all for other platforms like ppc, arm, mips, sparc (linux only), etc.

Quote:

3. Functions indeed get deprecated but it is not a huge maintainance pain, and in practice they still get included in future versions.


if you like reading senseless compiler warnings and in consequence maybe overlook the important compilerwarnings, you can ofcourse live with it.
_________________
winning a internet discussion is like winning the special olympics - you might win, but you're still a retard
Back to top
View user's profile Send private message Visit poster's website
unavowed
Newbie


Joined: 27 Apr 2006
Posts: 15

PostPosted: Tue Aug 05, 2008 10:26 am    Post subject: Reply with quote

god64 wrote:

didn't know of that, but the fact remains: what if you do use 1.6 features? want to force everyone in the world to update, especially the browser plugin, which can be a pain on amd64 platforms and is afaik not available at all for other platforms like ppc, arm, mips, sparc (linux only), etc.


Naturally you have to choose: either constrain yourself to 1.n features or prevent users of older versions from being able to play. This isn't a particular shortcoming of Java: every game has some library dependencies and there are often incompatibilities between versions. Usually the issues with C/C++ are more serious: you need to think about API and ABI-level compatibility. Java has the plus of not breaking backwards-compatibility at least.

It's true that Sun doesn't provide a amd64 browser plugin; but IcedTea does, and other free VMs do too (kaffe, for example). However, I don't think it's unreasonable to expect that support for amd64 will appear in sun-jvm-1.7, and ports of Sun's VM to other architectures in the future. Even now other VMs run on non-x86 architectures. The situation with portability is not perfect, but really, apart from the amd64 plugin/webstart issue not many gamers use these.

SDL is very portable (in practice more so than Java, I admit it), but it is hardly the only library a game will use, and it will need maintainance for every architecture/OS/package format, and will not run in a sandbox in a browser.

At the moment if you want to write a portable game which will remain playable in the future without the need to recompile, a game launchable from the browser, with a view to it being playable on other architectures once there is good VM support, with minimal effort on your side, IMO, the best choice is Java. Of course, for other things C/C++ will be better, but it all depends on your priorities.
Back to top
View user's profile Send private message
god64
Happypenguin Regular
Happypenguin Regular


Joined: 07 Feb 2005
Posts: 74
Location: Germany

PostPosted: Tue Aug 05, 2008 11:38 am    Post subject: Reply with quote

unavowed wrote:

SDL is very portable (in practice more so than Java, I admit it), but it is hardly the only library a game will use, and it will need maintainance for every architecture/OS/package format...


shameless self advertising ahead:

you could use sge2d: http://www.zefix.tv/sge2d

Quote:
...and will not run in a sandbox in a browser.

At the moment if you want to write a portable game which will remain playable in the future without the need to recompile, a game launchable from the browser, with a view to it being playable on other architectures once there is good VM support, with minimal effort on your side, IMO, the best choice is Java. Of course, for other things C/C++ will be better, but it all depends on your priorities.


if you want explicitly develop browser based games (which i dont understand, because i personally think browser games suck) c/c++ is for sure not the 1st choice. there is java and if you have windows to programm, you should also give stonetrips ston3d a chance (linux client on the way, search the forums) http://www.stonetrip.com this is a development environment i like very much, but as told, development takes place currently under windows only (shiva), clients can be windows, mac, mobiles and soon linux - x86 based ofcourse, as all commercial linux applications :-/

and by the way: java is disabled by default on my browser, as tor (http://www.torproject.org/) 'encourages' you to do in favour of privacy, and i bet i am not the only one out there.
_________________
winning a internet discussion is like winning the special olympics - you might win, but you're still a retard
Back to top
View user's profile Send private message Visit poster's website
fireside
Happypenguin Veteran
Happypenguin Veteran


Joined: 05 Jan 2005
Posts: 211

PostPosted: Wed Aug 06, 2008 8:16 am    Post subject: Reply with quote

Security is pretty tight for java if you use an applet and you want it unsigned. It took me forever to figure out how to read another file in the jarfile archive I made without getting security shutdowns. It's been a little bit of a slow go for me getting an applet to work, but it's like that for everything really. I think java is a lot more fun to program in than c++. Let's face it, c++ is one of the most exploitable languages there is for buffer overflows, etc, so please don't mention security around it.

Here's my first applet running software rendering in 3d:
http://fireside.myhosting247.com/

If you keep things somewhat simple, software 3d rendering is doable. Hardware rendering is no problem at all.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Linux Game Tome Forum Index -> Game Development All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
News Submit a Game Forums About/FAQ

Copyright © 1999-2005 Bob Zimbinski. Feedback to staff@happypenguin.org. All comments and posts are copyright their respective authors. Powered by phpBB © 2001, 2005 phpBB Group