Jump to content


Duck Hunt


20 replies to this topic

#1 TheNut

    Senior Member

  • Moderators
  • 1696 posts
  • LocationThornhill, ON

Posted 16 May 2011 - 09:00 AM

Posted Image


Description
Duck Hunt
For the past while, I have been working on porting my engine over to JavaScript WebGL. I decided to take what features I implemented so far and built a game with it. The result is Duck Hunt, a WebGL based game where you shoot down as many ducks as you can before they escape. You have 6 shots per clip before you must reload. The game gets faster and more difficult the more you shoot. Submit your score online and see how well you rank against others in the top 10 list.

Click here to play Duck Hunt.


Known Issues
The game was tested on Firefox 4.0.1 and Chrome 11.0.696.68. The game requires a computer with a WebGL compatible video card and drivers. There are some audio playback issues in both Chrome and Firefox. Chrome seems to have complications when you attempt to reset the audio position back to the beginning. It also doesn't handle multiple sounds very well. Firefox is almost flawless, except that it sometimes runs into a network issue and cannot load the game music, throwing a 404 error without an actual server response (say what?!).


Tech Stuff
The core Nutty WebGL Engine currently features:

1. High level OGL ES 2.0 classes to manage VBOs, FBOs, shaders, and rendering.

2. Particle emitters with support for injecting custom particle modifiers, making it really easy to experiment with various particle effects.

3. UI system with controls such as buttons, progress bars, images, lists, window frames, etc.

4. Loads resources and UI controls via XML files with support for custom elements.

5. Supports keyframe animations and storyboards, as well as sprite animations.

6. Various math routines, matrix and vector transformation classes, intersection testing, etc.


Next Steps
Skeletal animation is one of the last remaining features to be ported over. Following that, I'd like to build a couple more games and see how things go.


About WebGL
My development experience with WebGL has been a pleasant one so far. If you come from a background of OpenGL, you will find WebGL to be quite familiar and easy. If you don't have any experience, it makes for an excellent platform to learn from. For a good intro to WebGL, check out Leaning WebGL.

#2 roel

    Senior Member

  • Members
  • PipPipPipPip
  • 698 posts

Posted 16 May 2011 - 09:54 AM

Heh, the speeds get quickly insane. But I was lucky enough to hit the frog :)

#3 TheNut

    Senior Member

  • Moderators
  • 1696 posts
  • LocationThornhill, ON

Posted 16 May 2011 - 07:15 PM

Yeah, wildlife tends to do that when being shot at :lol:
http://www.nutty.ca - Being a nut has its advantages.

#4 Dia

    DevMaster Staff

  • Administrators
  • 1120 posts

Posted 19 May 2011 - 07:26 AM

Really nice game! This could make a good iPhone/Android game too :)

#5 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 19 May 2011 - 09:57 AM

Damnit, got 670, but after entering my name I accidentally pressed "cancel" instead of "submit". Oh well, I'm still #1 with my second score :)

Cool stuff :). To bad you can't reload when you're not out of ammo (clicking the ammo rounds even counts as a shot)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#6 bluecat

    New Member

  • Members
  • Pip
  • 1 posts

Posted 19 May 2011 - 11:34 AM

This is really cool. :) After some tries, I made it into the highscore. Can't be too long until someone has 2,147,483,647 points though. ;)

#7 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 19 May 2011 - 02:17 PM

Muhahaha 879 ;)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#8 TheNut

    Senior Member

  • Moderators
  • 1696 posts
  • LocationThornhill, ON

Posted 19 May 2011 - 07:48 PM

Nice :) I should almost implement a replay recorder so others can see how fast people play. Maybe even throw in that unreal commenter "mo-mo-mo-monster clicker!" :lol:
http://www.nutty.ca - Being a nut has its advantages.

#9 moe

    Valued Member

  • Members
  • PipPipPip
  • 276 posts

Posted 20 May 2011 - 11:09 AM

Nice game during work :)
Is is just me or do the ducks get faster more quickly if you replay?

#10 Nick

    Senior Member

  • Members
  • PipPipPipPip
  • 1227 posts
  • LocationOttawa, Ontario, Canada

Posted 20 May 2011 - 02:36 PM

TheNut said:

The game requires a computer with a WebGL compatible video card and drivers.
Works well with SwiftShader too. Just drop the x86 d3d9.dll file in C:\Users\<UserName>\AppData\Local\Google\Chrome\Application

By the way, isn't it relatively simple to hack the high scores? :ninja:

#11 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 20 May 2011 - 03:34 PM

What, Nick, are you questioning my leetness? ;)
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#12 TheNut

    Senior Member

  • Moderators
  • 1696 posts
  • LocationThornhill, ON

Posted 21 May 2011 - 12:55 AM

I know the system is flawed. I'll fix it up if things get carried away. So far people are playing nice (knock on wood) :lol:
http://www.nutty.ca - Being a nut has its advantages.

#13 imerso

    Senior Member

  • Members
  • PipPipPipPip
  • 431 posts
  • LocationBrasil

Posted 22 May 2011 - 12:55 PM

Sweet. Just for you to know, it worked perfect here at home, but there at work I'm currently using a Mac with OSX Leopard, and there although the logic was working right, graphics were very weird, flashing a lot, etc. Buggy as hell on Chrome Mac. I guess it might be Chrome'a problem, just reporting.

#14 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 22 May 2011 - 08:40 PM

Worked fine on Chrome for Windows.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#15 touch_the_sky

    Valued Member

  • Members
  • PipPipPip
  • 155 posts

Posted 29 May 2011 - 02:18 PM

Same here, just fine on Windows with Chrome, cool btw;)

#16 moe

    Valued Member

  • Members
  • PipPipPip
  • 276 posts

Posted 30 May 2011 - 07:28 AM

I have been wondering how you determine the country for putting up a flag in the high scores. Is this a service you got from somewhere or is it homebrew? Would you mind giving some hints on how you did that?

#17 TheNut

    Senior Member

  • Moderators
  • 1696 posts
  • LocationThornhill, ON

Posted 30 May 2011 - 02:38 PM

moe, you can determine a person's location based on their IP address. Various companies database this information and provide it to the public, either for free or for a price. MaxMind GeoIP is one of the most popular IP lists out there. It's updated regularly and has a free version too. Once you have the list, it's a matter of populating a DB table with them and performing a look-up on the IP address (represented as a 32 bit integer, not as an IP string). If you're interested in how to do that, see this page.

As for the flags themselves, a complete listing is provided on wikimedia as well as OpenClipart. You can also download a compressed list of them here (look for flags-2.9-png or svg). The names of the images follow the same ISO 2-character country code as the IP list above, so it's pretty straightforward to display the correct flag. For best performance, you should build a sprite sheet with all the flags in it. You can see what that looks like here.
http://www.nutty.ca - Being a nut has its advantages.

#18 moe

    Valued Member

  • Members
  • PipPipPip
  • 276 posts

Posted 30 May 2011 - 03:10 PM

Awesome, thx for the info.

#19 .oisyn

    DevMaster Staff

  • Moderators
  • 1842 posts

Posted 30 May 2011 - 03:17 PM

Too bad that not all flags have the same dimensions.
C++ addict
-
Currently working on: the 3D engine for Tomb Raider.

#20 Nautilus

    Senior Member

  • Members
  • PipPipPipPip
  • 351 posts

Posted 08 June 2011 - 04:11 PM

There's a potential weakness in the country flags based on IP address.

Likely unheard of in other countries, but not too many years ago a few italian ISP had servers physically outside Italy.
For example, backtracing some IPs from north Italy would map to the Netherlands. Not kidding.

I ignore if this anomaly is still in use today (daring an answer I'd say No).
My current italian ISP is definitely within italian territory.

Cool game, btw!


*back to lurk mode*
-Nautilus

(readin' this? you ought to get out more)






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users