Adventure Game Studio

Community => General Discussion => Topic started by: aussie on Sat 15/04/2006 15:03:02

Title: A question for website design gurus
Post by: aussie on Sat 15/04/2006 15:03:02
Hi all,

Here's a question for the web design gurus.

Say I want to have a vote-based ranking system for a website. Nothing fancy.

For instance, say I have a list of ten games. I want my visitors to give a numerical mark (1 to 5) for each game in terms of plot, puzzles and music, and then I want the website to calculate the average of these values (much like the AGS games page does). Then I want an automated game ranking from the highest to lowest average. And also the possibility to retain IPs, so that people cannot vote twice.

I figure I would probably need to use PHP, but is that hard to do? How would you guys go about it? Maybe there are ready-made scripts? (I mean, there are heaps of websites out there that have this sort of stuff...)

I have some general programming experience, but my website design knowledge is restricted to placing text and pictures in dreamweaver. So I need advice for dummies.

Thanks in advance.
Title: Re: A question for website design gurus
Post by: SSH on Sat 15/04/2006 15:57:55
Personally, I'd go about it by asking CJ if I could borrow his PHP code from the AGS games page... ;)

You'll need a mysql backend, I guess, too.
Title: Re: A question for website design gurus
Post by: Radiant on Sat 15/04/2006 19:57:14
PHP is a standard programming language in the C family, by which I mean it is quite similar to C, C++, Java, C# and AGS, and quite easy to learn if you already know any of the above. Yes, PHP would be your best bet for writing something like this; Javascript doesn't cut it, and Flash is not needed.

You don't need SQL or indeed any databasing system (of course you could use that as well, but it requires learning SQL). The easiest to do is this:

Create a flat datafile that has several lines that go "name of game, amount of votes, average". Upon page load, read from that file into a STRUCT or CLASS and display the result as a HTML table. Upon receiving any votes, recalculate the averages ((cur_avg * amt_votes) + new_vote) / (amt_votes + 1), and overwrite the file with the structs in descending order of votes (sort on write is more efficient than sort on read). This is all just basic math and file IO, so you don't need to be a coding wiz to figure it.

Title: Re: A question for website design gurus
Post by: Rolf on Sun 16/04/2006 00:47:04
I find frill of the websites not longer.  As the InterNet to alot of the peoples if he transformed a puncture.
Title: Re: A question for website design gurus
Post by: Kinoko on Sun 16/04/2006 02:16:48
Okay Rolf, I find your posts the most entertaining thing on AGS right now, but...

Please, stop using Babelfish to translate them into to English! We can't understand you. Your posts don't make sense.

God, I hope that English was simple enough to get through. What language does he speak? Does anyone else speak it? I think someone needs to tell him.
Title: Re: A question for website design gurus
Post by: Rolf on Sun 16/04/2006 02:29:42
Kinoko I does not have to go in you to make it it useless posts completly dog stupid.  I never wait it post another time because you he makes me the shout as when I lost my mother.  I am going to assassinate it you bloody woman.  ;D
Title: Re: A question for website design gurus
Post by: Hammerite on Sun 16/04/2006 07:44:43
AN EXAMPLE!
Title: Re: A question for website design gurus
Post by: aussie on Sun 16/04/2006 09:58:00
Thanks SSH and Radiant. I take it, making a webpoll is "difficult". I guess I'll have to do a bit of work on my own and learn some php. Oh well.

Cheers.
Title: Re: A question for website design gurus
Post by: Ishmael on Sun 16/04/2006 13:51:55
Kinoko, as far as I have understood, he is Finnish. And bablefish doesn't do Finnish. I don't think I could get that sort of results with a dictionary either, tho. So it must be some other translating service. Automatic English - Finnish - English translations are always hilarious. Atleast what I've seen...
Title: Re: A question for website design gurus
Post by: Haddas on Sun 16/04/2006 14:06:23
It of it is logical none.  Babelfish is perfect.  I have it with some occasions used and all possible problems never have, which so indeed.
Title: Re: A question for website design gurus
Post by: Ishmael on Sun 16/04/2006 14:08:07
And my grandmother just ate poled dog in you.
Title: Re: A question for website design gurus
Post by: Radiant on Sun 16/04/2006 14:50:25
Babelfish fans, take your favorite poem or song text and plug it into The Babelizer (tm) (http://www.tashian.com/multibabel/)!


I'll bake a virtual pie for the first person that can identify the following lyrics...



_ he to be, that one applicable duration, that one this one in
zerbroeckeln to be also not to intercept that fuoriesce, its eye Vista
truth-to open to sky and ' m. to be right one deficient boy, necessary
each compassion possible Parce to see Sieht-Ich, that I to come
simple, extreme to go simple, all case strong storm, true of not
concerning one principle, little little one minimum, with me, first,
exact one to destroy, injector man to satisfy relative title, not to
lose mine version, to die hour, matrix, to regulate duration uniforms
to have to begin, but and everything has ooo GONE had meant the played
hour of WeitMammas, behind that of the calm this in the times of the
movements of the function tomorrow, as if it really did not do
anything that mattered in Trop delays, my moment it came, it transmits
more to brividi in the surface under possible of my horn of the thorn
by, of that erroneamente the whole hour, good bye the whole
Guardolo-Ich of the world of SEES ' you you form of the elasticity,
that much of the Aussenreise behind been able the vacations and ooo to
him of the breasts of the truth
Title: Re: A question for website design gurus
Post by: BOYD1981 on Sun 16/04/2006 15:05:06
hmm, for some reason i think it's Queen's "princes of the universe" song, the one from Highlander...
Title: Re: A question for website design gurus
Post by: Rolf on Sun 16/04/2006 17:08:10
As the challenge you all to make it examination of the piss it is of me.  I am going to assassinate Haddas.  bastard stupid.  You it is all the complete dog stupid. ??? ??? ???
Title: Re: A question for website design gurus
Post by: Tuomas on Sun 16/04/2006 18:08:55
Excuse me, but why dog stupid? dogs aren't stupid, in fact our dog was very clever. And please don't assassinate Haddas, that would mean that I would never get paid after all this job I've done on him.

And if you are suggesting that we should examine the urin that has come out of you, I'd say you need to set up a new thread and some samples for us...

Oh, and if you find it irritating that people are mocking you, try using this www.babelfish.altavista.com to make your text easier for us to understand, you know, it is really hard to get your point sometimes.
  How do I know it's not babelfish already? because it wouldn't write "peoples" in that way.
Title: Re: A question for website design gurus
Post by: skw on Sun 16/04/2006 18:12:35
Shuddup, Rolf!
Title: Re: A question for website design gurus
Post by: Rolf on Sun 16/04/2006 18:58:49
Do not tell me to shuddup? I will also assassinate you Tuomas and the Skurwy. You he is racist.  How much for the o urine goes sucks in its proper penis.  I hate what mock all me!  ??? ??? ??? ??? ??? ??? ??? ??? ??? ??? ???
Title: Re: A question for website design gurus
Post by: Hammerite on Sun 16/04/2006 19:20:11
please for the love of god just make your posts more understandable, we dont understand what you are saying, we are NOT mocking you, we are just noticing that your posts make almost no sense whatsoever!!
Title: Re: A question for website design gurus
Post by: skw on Sun 16/04/2006 20:51:43
Does your mummy know you're using such words, Rolf?

Hasn't it gone a little too far? Off-topic. I would delete the spam and ban Rolf forever.

It's pathetic, not funny. :-\

Quote from: Rolf on Sun 16/04/2006 18:58:49
Do not tell me to shuddup? I will also assassinate you Tuomas and the Skurwy.

Is there more than one Skurwy?
Title: Re: A question for website design gurus
Post by: Ishmael on Sun 16/04/2006 22:16:51
Quote from: Tuomas on Sun 16/04/2006 18:08:55
Oh, and if you find it irritating that people are mocking you, try using this www.babelfish.altavista.com to make your text easier for us to understand

Babelfish doesn't have Finnish - English.

And Rolf, I know my law enough that I can claim you've broken it. There's a paragraph for "Illegal threathenin" in the crime law...
Title: Re: A question for website design gurus
Post by: Radiant on Sun 16/04/2006 22:56:17
Quote from: BOYD1981 on Sun 16/04/2006 15:05:06
hmm, for some reason i think it's Queen's "princes of the universe" song, the one from Highlander...

Pretty close, but no cigar.
Title: Re: A question for website design gurus
Post by: aussie on Sun 16/04/2006 22:57:30
And to think this thread was just an innocent question about web polls...
Title: Re: A question for website design gurus
Post by: Kinoko on Mon 17/04/2006 01:22:46
Radient: The VERY first thing that popped into my head, before I even read the second line of the lyrics, was "Seven Seas of Rhye" by Queen. I went and re-read the lyrics to that song and I feel like I'm right, but... obviously, it's hard to tell :P
Title: Re: A question for website design gurus
Post by: Radiant on Mon 17/04/2006 13:04:23
I'm amazed that two individual people immediately recognize Queen; I would have thought that was impossible after all the babelized garbling.

Spoiler

The song was Bohemian Rhapsody, by the way.
[close]
Title: Re: A question for website design gurus
Post by: seaduck on Mon 17/04/2006 13:44:36
Quote from: Radiant on Sat 15/04/2006 19:57:14
You don't need SQL or indeed any databasing system (of course you could use that as well, but it requires learning SQL). The easiest to do is this:

Create a flat datafile that has several lines that go "name of game, amount of votes, average". Upon page load, read from that file into a STRUCT or CLASS and display the result as a HTML table. Upon receiving any votes, recalculate the averages ((cur_avg * amt_votes) + new_vote) / (amt_votes + 1), and overwrite the file with the structs in descending order of votes (sort on write is more efficient than sort on read). This is all just basic math and file IO, so you don't need to be a coding wiz to figure it.

This should work for the most part, but I'm afraid we have a race condition here. Keep in mind that if multiple users get the page at the same time, the web server will IMO launch the same script multiple times at once. The interleaved IO migh even corrupt the contents of the file in the worst case... So unless there is a file-locking feature in PHP (is there? I never heard of it) and you use it, this might go wrong once in a while.

With MySQL you can make sure the data stay consistent quite easily. It needs a very basic understanding of databases, but it's actually simpler than using file io...
Title: Re: A question for website design gurus
Post by: Radiant on Mon 17/04/2006 14:02:10
Quote from: seaduck on Mon 17/04/2006 13:44:36
This should work for the most part, but I'm afraid we have a race condition here. Keep in mind that if multiple users get the page at the same time, the web server will IMO launch the same script multiple times at once. The interleaved IO migh even corrupt the contents of the file in the worst case...

On any decent file system, this cannot and will not cause data corruption. However, it is true that if two users access the page simultaneously (as in, within a few milliseconds), then the vote of either of them might be lost. Given the speed and near-atomicity of the operation, this is exceedingly unlikely. I've ran a forum that worked like this for a year and never had a problem.

Still, for any professional or commercial site, SQL is the proper solution.
Title: Re: A question for website design gurus
Post by: Oneway on Tue 18/04/2006 11:53:09
In an effort to get this topic back to the actual topic:

hotscripts is your friend:
http://www.hotscripts.com/PHP/Scripts_and_Programs/Polls_and_Voting/index.html

You'll most definately need to learn some php coding to customize things, but the basics are there won't make you invent the wheel all over again.
Title: Re: A question for website design gurus
Post by: rharpe on Wed 19/04/2006 06:30:08
Quote from: Kinoko
Okay Rolf, I find your posts the most entertaining thing on AGS right now, but...

Please, stop using Babelfish to translate them into to English! We can't understand you. Your posts don't make sense.

God, I hope that English was simple enough to get through. What language does he speak? Does anyone else speak it? I think someone needs to tell him.
Kinoko, does it really matter? You can make it out to whatever you want him to say. I, too, find it entertaining! But he needs to say things in less words... that may help. (IE: I am hungry... or AGS is good... or I made game... or I leave now... etc.)

Rolf, keep it simple, you'll catch on.  (I feel like I'm teaching Encino Man.) ;)