Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Program a online fantasy gaa game

  • 09-12-2008 9:27pm
    #1
    Registered Users, Registered Users 2 Posts: 3,620 ✭✭✭


    I was wondering about how a online game like www.xperteleven.com would be programmed, the basic idea is like championship manager:

    you're a manager,
    you must buy,train fictional players,
    games are played weekly against other people around well.. Ireland,
    selling players is allowed,
    Money aspect etc....

    having only done some Java and other programming it's unlikely that I'm going to tackle a project like this soon. But I like to look into stuff randomly!

    I'm guessing Html and MySql would be necessary.


Comments

  • Registered Users, Registered Users 2 Posts: 515 ✭✭✭NeverSayDie


    Yeah, you'd have some HTML (output by your code) at the very front of it for the UI, and something like MySQL or an equivalent at the very back for storing and keeping track of all the data. In between though, there'd be lots of Java (for instance) or code in another language running all the logic and behaviour.

    You could look into something like Ruby on Rails (a popular framework for putting interactive web stuff together in a hurry) or Microsoft's Web Developer Express Edition (a free version of one of their Visual Studio IDEs for doing ASP.NET web apps using C#, which you'd probably find pretty similar to Java). If you want to go with Java, J2EE is apparently what they use for web apps, though I don't know much more about it, sounds decent enough once you get it up and running. Other popular options include PHP or Python.

    While a big site of this sort would indeed be a pretty serious amount of work, you could always start off with something smaller and build it up with bits and pieces over time. (might not lead to a very well-built system unless you have enough experience of this sort of thing to design it all in advance, but a perfectly fine approach for learning and experimenting with the whole area)

    Getting something basic out with the web frameworks mentioned above - say a list of teams linked to lists of players, and buttons to shift the players between teams - is fairly easy without needing large amounts of prep work, and pretty rewarding if you're into that sort of thing (software development, that is).

    Those tools;
    http://www.rubyonrails.org/
    http://www.microsoft.com/express/vwd/


  • Registered Users, Registered Users 2 Posts: 3,620 ✭✭✭Grudaire


    Hmmm, it's interesting. Having taken out a book on Ruby (passing by the library), I'm thinking that you won't see this game out anytime soon. I mean you're able to get substring by more then one command:eek: Why amn't I spoonfed anymore:(

    Into software development is an overstatement- I'm more a maths student who enjoyed that year of Java, and Matlab is more fun then a pen and paper! Thought I'd enquire and give the programmes a break from solving college assignments ;)

    By the way, since web pages can be written through ruby/html (rhtml if you will) how do you save things as entered in a web page (in general!)


  • Registered Users, Registered Users 2 Posts: 515 ✭✭✭NeverSayDie


    Well, the web page itself will be just HTML, regardless of whether it was Ruby, Java or something else that generated it and handles its input. In order to get user input back from the page, in HTML you'd use a <form> element, with some controls in it - say a button and a text box. See here for a description of that;
    http://www.w3schools.com/html/html_forms.asp

    How you access that data on the backend really depends on the framework and language you're using. The user's browser submits the data from the form back to the web server in a standard way (when the user clicks the submit button or something similar), and the environment your code is running in will give you access to whatever data came back, when the code for that "page" gets called (that would usually be determined by what address the user submitted the form to, as stored in the HTML). This could be done through a "query string" object of some sort, which wraps up access to data the user sent to you in the query string from their browser. For an example, see the boards.ie URL in your address bar - it has some stuff stuck on after the site address, that's extra data that the PHP code that powers Boards will have accessed on the backend. It might specify which thread you wanted to load (based on you clicking on a link in this case, not a form). Once you've got that data, you can save it to a database, pass it back to the user, do stuff with it, anything really. It's not really much different than working with data in the Java code you've written before. (issues of maintaining state between page calls aside)

    Something to note there is that the user could have sent up all sorts of dodgy stuff, not just what you were expecting, so you need to be careful of data obtained that way.

    Best to set up Ruby on your PC (plenty of resources online for that) find a good online tutorial, or use that book if it's a beginner's one, and follow along one step at a time, you'll gradually build up a good idea of how to do stuff. I don't use Ruby/Rails myself (Perl and ASP.NET here), so I can't give you many specific pointers, but it seems to be a good bet - it's popular at the moment and seems pretty easy to get going with. This post should help clarify what's what;
    http://rushi.wordpress.com/2006/09/24/ruby-on-rails/


  • Closed Accounts Posts: 25,848 ✭✭✭✭Zombrex


    Cliste wrote: »
    By the way, since web pages can be written through ruby/html (rhtml if you will) how do you save things as entered in a web page (in general!)

    There are three components in a modern web application, the client, the web server and the database.

    The client is your web browers (Firefox, IE or what ever). When you select a URL (Universal Resource Locator, aka a web address such http://www.boards.ie) what you are actually doing is downloading the HTML, Javascript and CSS files associated with that URL. Your web browser down loads these, reads them and then draws your web page.

    In the good old days of the web the HTML for each page was written by hand by a programmer and saved to a file. The web server simply opened this file and passed the contents to your web browser.

    These days as web sites have got more complex and often host dynamic content this has become unmanagable, it would be impractical for a programmer at Facebook to sit down write and save a HTML page each time someone logs in.

    So what a lot of websites use is a server side language to generate the HTML for each page dynamically. Instead of the web server getting a HTML file sitting on a hard drive some where that some human created and saved a while ago, the web server now gets the text from the scripting language, which is generating it on the fly.

    That is where something like Ruby comes in. Ruby is a general purpose scripting language (others include ASP, PHP, Python, Perl) that can be used for all sorts of things, but one thing it can be used for is generating text files dynamically, such as HTML files.

    What happens on the web server (the machines sitting in Facebook, or Google, or Boards.ie) is that a request for a web page comes in from the client (your browser) and the scripting language, such as Ruby, looks at what you have requested (say you want to view a thread on Boards.ie), goes off and accessed the database to get the actual data, pulls all the data together, and then generates the HTML text on the fly, hands this over to the web server which then sends them back to your web browser.

    Now that is not to say that all web design is now done by computers.

    The server side scripting language would base each HTML page on a template that has been designed by a real person to look nice, but with the actual specific data not included in the template. The server side program takes the HTML template that is saved by a real person, gets the data from the database, puts the data into a copy of the template at specific points (defined by the web designer) and sends it down to you.

    So for example, the template for a Boards.ie page wouldn't include the name of the user that is currently logged in, but it would have some kind of marker in the HTML template file. When the server is processing a request it will get the user's name from the database and replace the marker with the actual name before it passes the HTML text over to the web server.

    So for example the scripting language grabs a template file written by a web designer that contains something like this
    <p>%username%</p>
    

    telling the scripting language that is where the username should go, and on the fly turns it into this
    <p>Wicknight</p>
    

    which is sent to my web browser.

    The scripting language on the web server can also handles data coming the other way.

    Web pages can contain forms, such as the Boards.ie log in form. The form is defined in the HTML code, your web browser draws it and also handles data input. This data is then passed by your web browser back to the web server. The scripting language can access this data then, so for example it can check if the password you entered matches the password in the database.

    So anywhoo, hope that is a good introduction, apologies if you already knew some of that stuff.

    To sum up, to create a dynamic website you need a web server (such as Apache) which can serve your web pages (it is possible to start a web server just on your local PC, you don't need an actual physical server out in a data farm or anything) and you need to pick a server side scripting language such as Ruby or PHP (PHP might be easier for someone starting off, though it can be easy to pick up bad habits). You can get the scripting language to start out putting HTML text to your web browser pretty much from the start.

    Search for a tutorial on how to set up Apache with PHP or Ruby and you will be serving web pages on your PC (just to yourself mind) in 15 mintues

    Enjoy :D


Advertisement