Author Topic: JavaScript Comp Proposal#2  (Read 5927 times)

0 Members and 1 Guest are viewing this topic.

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
JavaScript Comp Proposal#2
« on: July 20, 2007 »
Before I begin, my apologies to everyone - I am taking these rules down for a week while I discuss them with the Admins.
I'll leave the basic specification up as I'm guessing this won't change much.

Sorry for any inconvinience,

Tony.


Animated GIFs will be allowed, but Flash animations will not be allowed, and no part of the entry may be executable:

In short, the entries may only be composed of files with the following extensions:

.htm
.html
.js
.gif
.jpg
.png*
.mp3
.mid
.swf**

*Note that some people may have problems viewing .png files.
**Also note that, due to a request, I will allow the use of SWFs for audio only! I don't want to see any flash animations/buttons/grahpics/movies, etc.

You may compress your files into an archive, such as .zip, .tar.bz, or whatever you prefer.
Anyone running Windows XP with service Pack 2 or Windows Vista may be prompted to allow active content on their machines when viewing the entries - this should pose no problems to the actual running of the entries.

One further thing to bear in mind with JavaScript is that different browsers support different features of JavaScript - the Internet Explorer implementation of JavaScript may have extra/missing features when compared to Safari or FireFox, and vice versa.

And finally, the entries can be about anything. If there's any kind of explicit content, please put a warning on your entry - explicit content is highly discouraged.

You may produce either a technical demo or an interactive piece.

But most importantly, each entry must have in it, somewhere, a picture of, or a reference to either pie or 3.141... (or both).

Entries - Please post your entries on this board. You may zip them up, or compress them in whatever commonly available technology you have to hand.
« Last Edit: July 25, 2007 by combatking0 »
You are our 9001st visitor.
Challenge Trophies Won:

Offline p01

  • Atari ST
  • ***
  • Posts: 158
  • Karma: 51
    • View Profile
    • www.p01.org
Re: JavaScript Comp Rules
« Reply #1 on: July 20, 2007 »
A for effort, but I can't believe the template is IE-only.  :-\

Is it 1997 again ? The JS code is unreadable ( no indentation at all ), the HTML has no semantic whatsoever ( <center><font size=6 ><u ><b > seriously ? ), inline style and event handlers, no DOCTYPE, the global namespace is poluted.  :o I can understand such practices for a byte-tro but as a tutorial, hum ... my web developer sense is tingling.

Also as a tutorial for complete web newbies, some insights about DOM manipulation would be welcome.


Alright I'll fix the template today/tommorow.
« Last Edit: July 20, 2007 by p01 »

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: JavaScript Comp Rules
« Reply #2 on: July 20, 2007 »
Good time to rewrite and update my JSFBGL library. If time permits - you can count me in ...

//EDIT: What I don't get is - that the rules and the general outline of the contest are already
given ! So, why is the official start of the competition the 1st of August  ???
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: JavaScript Comp Rules
« Reply #3 on: July 20, 2007 »
To address the mistakes found in my original post:

I have now updated the templates to include indentation and doctype.

Unfortunately, I'm not that knowledgable about such things as the global namespace. Anyone who uses the template and knows what they're doing is welcome to modify it and improve it (and make it cross browser compatible) if they wish, but it has worked fine for two years, which is why it has never been written correctly.

Also, I have been swayed by Benny's logic and have decided to start the competition early.

I'll write some more on DOM manipulation over the weekend, and which keys are referenced in the keys[] array.

If anyone else spots any more mistakes, just give me a shout and I'll have them corrected as soon as possible.

BTW, I won't be back until Tuesday.
You are our 9001st visitor.
Challenge Trophies Won:

Offline p01

  • Atari ST
  • ***
  • Posts: 158
  • Karma: 51
    • View Profile
    • www.p01.org
Re: JavaScript Comp Rules
« Reply #4 on: July 21, 2007 »
Instead of 'fixing' combatking0's template, I made one from scratch. More code to look at can't hurt those who don't really know JavaScript  ;)

This puppy works fine in Internet Explorer 6, Firefox 2, Opera 9.2 and Safari 3 beta.

It captures the position of the mouse in the #gameArea, as well as the mouseWheel, the time the button was pressed and released, and the time various keys were pressed and released.

The Sprite class handles animations and zooming. The animations are made using an horizontal strip of frames like in 3D TOMB II ( see the Technical infos ) except the visual is more stable since it doesn't rely entirely on percentages ( which the browsers seem to round badly ).


In the example provided in the archive, one sprite follows the mouse ( in position and orientation ), and can be zoomed in/out using the mouse wheel. The 'game' can be paused and resumed using the well named [pause] key.


The code is not documented ad nauseum but it doesn't seem too obscure either. Don't hesitate to ask if something is unclear.


Hope that helps,
Oh, and I forgot ... :cow:


combatking0: Regarding the global namespace, notice that in my code the only global variable is the GAME_ENGINE singleton. Also using a (more) standard compliant browser will greatly help you improve your knowledge and skills in JavaScript, HTML and CSS.

Cheers.


Edit: fixed a problem regarding the resolution in the Sprite class, and a typo in this post :p
« Last Edit: July 21, 2007 by p01 »

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17423
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: JavaScript Comp Rules
« Reply #5 on: July 21, 2007 »
Appreciate your help for that p01, thank you and some good Karma was in order.

I hope that the competition attracts lots of good entries :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: JavaScript Comp Rules
« Reply #6 on: July 22, 2007 »
@p01:

Awesome stuff p01. Very advanced. Thanks a lot for sharing and your work !!!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline p01

  • Atari ST
  • ***
  • Posts: 158
  • Karma: 51
    • View Profile
    • www.p01.org
Re: JavaScript Comp Rules
« Reply #7 on: July 22, 2007 »
Thanks.

One serious improvement is to throw an exception in the Sprite constructor when the uid is not unique and when the image #imageStripId is not found.

But that shouldn't be to much of an issue for people reading/using my code.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17423
  • Karma: 499
  • evil/good
    • View Profile
    • My Homepage
Re: JavaScript Comp Rules
« Reply #8 on: July 22, 2007 »
This competition is not organised by me, it has been put together by Combatking, however I can see a few things that need clarifying before people start working on thier entries.

  • First of all how are the winning entries going to be chosen?
  • How long will there be for votes?
  • Will there be gfx sigs?
  • Who will draw them?
  • Where will entries be hosted?

The general guidelines give a good idea af the competition, these points above need clarifying. I will sponsor the competition as long as it is organised to my satisfaction.

As a future lesson to anyone wanting to hold a comp, please let common sense prevail and pm an admin about it with any proposals you have for it before you post it.

There is some time to get these things straightened out, CK please put a deadline on it for finalisation of rules for the competition, as I'd hate to see it continue like this. It's generally bad to change the rules once you have started something off, for example not having these things arranged first, changing start / end dates etc. p01 thank you very much indeed for fixing that framework, you probably saved a lot of frustration, CK, thank you for your enthusiasm, don't let this post dampen it, this competition needs supporting now as it seems to have started before I anticipated!
Shockwave ^ Codigos
Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: JavaScript Comp Rules
« Reply #9 on: July 23, 2007 »
I knew there was a reason I wanted to start the competition on the 1st of August.
Anyway, I won't change the start date around again, as this may be seen as unprofessional and could put people off.

To address your points:

  • First of all how are the winning entries going to be chosen?
There will be a poll in September, using the standard rules. The number of votes available will be rounded up from the number of entries divided by 5, so for example, 15 entries will give us 3 votes each, 16 entries will give us 4 votes each, etc
  • How long will there be for votes?
1 week.
  • Will there be gfx sigs?
Yes.
  • Who will draw them?
Me.
  • Where will entries be hosted?
On here if the admins give a thumbs up, and I'll pick a selection to go into my games workshop on my website once the competition is over.

I will post the finalised rules in the next five minutes. Thanks again to p01 for creating a better template - anything which furthers the development of programming is good.
« Last Edit: July 24, 2007 by combatking0 »
You are our 9001st visitor.
Challenge Trophies Won:

Offline p01

  • Atari ST
  • ***
  • Posts: 158
  • Karma: 51
    • View Profile
    • www.p01.org
Re: JavaScript Comp Rules
« Reply #10 on: July 24, 2007 »
Quote
The mButs variable stores a value between 0 and 7 depending on which buttons are held down.
When no buttons are pressed, the value is 0.
When the left button is down, 1 is added to the value.
When the right button is down, 2 is added to the value.
When the middle button is down, 4 is added to the value.
source: eventHandler.txt

Again this is IE specific and NOT the standard. The DOM Level 2 Event Model : Mouse Events says:
Quote
button of type unsigned short, readonly
During mouse events caused by the depression or release of a mouse button, button is used to indicate which mouse button changed state. The values for button range from zero to indicate the left button of the mouse, one to indicate the middle button if present, and two to indicate the right button. For mice configured for left handed use in which the button actions are reversed the values are instead read from right to left.
Although I agree that IE's approach makes much more sense, please, pretty please, people do NOT rely on non-standards things. In the gameEngineFramework I provided, all buttons are considered the same, for the simple reasons that : any decent browser can forbid access to right mouse button events, and that IE do not follow the standard.