View Full Version : Web Game Dev
Applewood
12-21-2004, 04:10 PM
Hi.
Is there a decent resource out there that explains exactly how to make a game written in C run in a browser, or at least appear to ?
I've found loads of technical stuff, but nothing that gives an overview to utter newbs at this.
Thx..
Dan MacDonald
12-21-2004, 04:42 PM
Generally you can't write a game that's written in C that runs in the browser. The Internet is based on standards that are platform agnostic, html, xml, http, tcp/ip etc. When you write an application that's compiled to a particular platform like Mac or WindowsPC you are breaking the web platform paradigm. That said, certain browsers have plugin architectures as a means to allow developers to write code that is specific to a given platform/OS. In the realm of IE this is ActiveX, Netscape/mozilla/firefox have a different plugin architecture. ActiveX of course works on Windows and wont run on mac or linux etc. If you use netscapes plugin architecture it won't work with IE. Essentially there is no way to make a browser game in C++, you can make a C++ game run in a specific browser but that's about the best you can do.
The closest you can get to a browser game with a slightly more sophisticated language the javascript is to use Java. Java 1.1 actually runs pretty well on netscape / IE and there's a suprising amount you can do with it. Even 3D Games.
Siebharinn
12-21-2004, 08:26 PM
If you want to limit yourself to Windows users running IE (only what, 95% of the market?), you can do ActiveX. There are hurdles, to be sure. But you can also do pretty much anything on that platform that you could do with a native Windows app. Take a look at the online version of Think Tanks (http://www.planetthinktanks.com/about-demo.asp) for a good example of what's possible. I'm suprised Dan didn't mention that. :rolleyes:
Java is another way to go. Not as much control, unless you go through many of the same hoops you'd have to go through with ActiveX, but it is much more portable. Of course, Java isn't C, which was your original question.
princec
12-22-2004, 02:11 AM
only what, 95% of the market?Turns out it's about 50% of the market - and 95% of the installed desktop user base. A subtle but extremely important point.
Cas :)
Applewood
12-22-2004, 06:17 AM
Yeah, I appreciate its basically learn Java or ActiveX and neither of those is 'pure' C development. I guess ActiveX offers the least amount of hassle as I can do the setup as needed then switch back to my more usual working method of functional programming. (Let's not go there again)
Java is clearly the best solution all round though, as at the end of the day it's user-base potential that matters. What scares me is that staying totally off the metal using a VM might be portable but it's hardly making the most of the power on *any* machine!
On a very real point, I have a library that runs on about 7 platforms and I'd dearly love to add 'browsers' as an 8th, but switching to Java will make that a real mess for all the others. I was hoping to not have to make a separate 'new' library but it I guess it'd look so different anyways I may as well use an established one if there is such a thing ?
Looks like I got a big decision to make...
Siebharinn
12-22-2004, 06:33 AM
- princec -
Turns out it's about 50% of the market
That's a good point. Well, for small indie games at any rate. Are there any stats of what the Mac percentage is for retail games? I know that indie games get a high percentage of Mac sales, but are there any numbers for the big companies. I'm just curious.
- Applewood -
On a very real point, I have a library that runs on about 7 platforms and I'd dearly love to add 'browsers' as an 8th
The Think Tank guys are using Torque (http://www.garagegames.com) for their game, and managed to wrap it up in an ActiveX control without too much effort. It's really just a demo, I think, not a sales channel.
Like Dan said, there is no way to support browsers generically, without rewriting in Java. And if you're already supporting a bunch of platforms, there really isn't a point to switching to Java, aside from browser support.
Just my $0.02.
Princec, you develop solely in Java do you not? What are the common pitfalls of developing online versions of your software with Java? (I do a little J2ME development for a mobile games company, so I am fairly familiar with the key elements of the language).
princec
12-22-2004, 07:21 AM
Common pitfalls are:
1. Relying on newer JVM features for functionality or performance.
2. Relying on MSVM.
3. Relying on decent performance in OSX; currently it's all software rendering.
4. Not displaying a stub applet with a loading bar in it (woops)
5. Not displaying "Applet not focused!" when it hasn't got keyboard focus (woops)
6. Not testing it on a few OSs and VMs
7. Failing to load resources correctly using Class.getResource methods
Cas :()
MSVM is a bit pap, but those issues aren't that bad considering the platform independence?
Siebharinn
12-22-2004, 08:33 AM
Cas, do you know what versions of the JVM are common for each brower?
Cas, do you know what versions of the JVM are common for each brower?
Dom from Crystalsquid has some stats about that.
>MSVM is a bit pap
Uhm. No. It's a steaming pile of ----. It's horrible broken for the most part, it's slow and really really old. It was already outdated back in 2000.
I suggest using 1.4, because it's pretty fast and the market penetration is ok (eg 100% of the macs and somewhat like 50-60% of PCs [rising]).
Using 1.0/1.1 is just painfull and the hardware requirements (for offsetting that) are a factor of 2-10 higher. It's that kind of Java which is to blame for that "java is slow" prejudice, you still have to deal with nowadays.
ggambett
12-22-2004, 09:36 AM
There's also the OSAKit made by a forum regular, it was being discussed in the forums very recently... it's the ActiveX solution, but already done.
Downloaded Super Dudester "Play Now" to see how painful it would be and now I'm addicted to the flashing lights ;)
Dan MacDonald
12-22-2004, 11:01 AM
Yes, here' s a link (http://forums.indiegamer.com/showthread.php?t=1397) to the thread where the OSA kit is announced. Essentially waht it does is use an activeX control to download your generic win32 game, and then pass you the hwnd of the activeX plugin so you can initialize your game in the activeX frame. At least that's how I guess it works :D
mkovacic
12-23-2004, 04:19 AM
Yes, here' s a link (http://forums.indiegamer.com/showthread.php?t=1397) to the thread where the OSA kit is announced. Essentially waht it does is use an activeX control to download your generic win32 game, and then pass you the hwnd of the activeX plugin so you can initialize your game in the activeX frame. At least that's how I guess it works :D
No, it actually works without any code modifications or recompilation (there are a few gotchas with window moving/resizing but I never ran into them). It's pretty cool.
Applewood
12-23-2004, 04:24 AM
I think I'm gonna check this out, if only as an interim before doing my own version of the same thing once I can get some results.
Yeah I know, but I'm just like that! :)
princec
12-23-2004, 04:33 AM
So what makes the OSA kit any less hassle than a Webstart link? Just curious...
Cas :)
Applewood
12-23-2004, 06:56 AM
I dunno yet, I just don't like relying on other peoples code - even if its better written than mine. I got bitten once this way and I won't let it happen again.
No disrespect at all to the author of OSA kit - I'm sure its a great product. I just need/like to be able to recompile bloody well everything if I need to in an emergency. With my contracting head on, this is often a contractual necessity too, so I may as well get it all together just in case.
vBulletin v3.6.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.