Author Topic: New to Online Text-base Game coding/designing  (Read 1705 times)

Offline Wakish

  • Level 14
  • *
  • Posts: 111
  • Reputation: +0/-1
    • View Profile
    • Wakish Wonderz
New to Online Text-base Game coding/designing
« on: February 28, 2007, 03:38:52 PM »
Hello everyone..
I'm a lover of online games and have been playing many online games since 3years now..
I have always wanted to come with one of my own. Now i have an opportunity to really concentrate on it. How? I'm currently on my final year projects and my project is about creating an online-text base game.
I know this is a long way to dig in, but i'm ready to go thtough what it takes..

What type of game i want to create?

A game in the style of http://www.republic-online.net/. But with more advanced and nice features.
But i will change the concept. I will try to mix the story..etc..
I'm yet to go through the complete story, i,m thinking of my own story..

I'm very new to this type of programming. So all kind of help,guidance and hints is very appreciated.
I hope i came at the right "door"  :mib:

I have browsed a bit of this category and found these:
1) I should know how to 'play' with:
Smarty Template System http://smarty.php.net
ADODB Database Abstraction Layer http://adodb.sourceforge.net

But what's next.. i hope to find soon..

Kindly,
wakish

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: New to Online Text-base Game coding/designing
« Reply #1 on: March 01, 2007, 12:51:16 PM »
Welcome wakish :)
I would suggest to go slowly first, don't make your game too ambitious. Once you have the basic game down you can go on improving it.
And plan everything very carefully. It's alright to change your plans halfway through, even drastic changes, but make sure it is all well thought-out. This include what you're going to code, and how. Pseudo-code first might help a bit if you don't have a lot of coding experience.

Offline Marek

  • Level 18
  • *
  • Posts: 177
  • Reputation: +7/-0
  • XHTML, CSS, JS, PHP and MySQL are my pantheon.
    • View Profile
Re: New to Online Text-base Game coding/designing
« Reply #2 on: March 02, 2007, 08:13:30 AM »
Smarty and ADODB are "advanced" tools... in the sense that they give you more power (in templates and databases, respectively) but only if you're already comfortable with the basics.

The basic premise for games is that you have 1. a database storing the current state of the game, 2. a set of HTML forms, representing commands that the player can give, and 3. a set of php scripts that execute these commands by acting on the database...

So there's not much more to it than any other PHP application. To this, of course, you'll have to add a login system, and if you want to have events happen automatically at specific times, or at regular intervals, you'll need Cron jobs.

Offline Wakish

  • Level 14
  • *
  • Posts: 111
  • Reputation: +0/-1
    • View Profile
    • Wakish Wonderz
Re: New to Online Text-base Game coding/designing
« Reply #3 on: March 02, 2007, 02:06:10 PM »
ok.. so i keep those engines for later use after these steps:
Code: [Select]
1. a database storing the current state of the game,
2. a set of HTML forms, representing commands that the player can give, and
3. a set of php scripts that execute these commands by acting on the database...

Offline Sinzygy

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-0
    • View Profile
Re: New to Online Text-base Game coding/designing
« Reply #4 on: March 05, 2007, 02:38:44 AM »
pretty much yeah.

I still work without any kind on external help-eninges or templates, but that's just me.

Once you know what your game should look like, what it should do and how it should do it, then the implementation shoulnd't be too much of a hassle.

Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 589
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: New to Online Text-base Game coding/designing
« Reply #5 on: March 05, 2007, 05:25:10 AM »
Umm no I would not say ADODB is an option to be used later it is a necessity to start off with right away.. If for NOTHING else then the simple fact that it will help greatly in preventing SQL Injection attacks. Since you are a new coder of games your probably not going to know all the "tricks" script kiddies like to use and try when they find a new game to exploit.

Lets say you wanted to update the database based on user input.. Never trust information from the browser so you create a some sort of "scubber" to clean the data and then update said data...

Code: [Select]
mysql_query("UPDATE player SET cash = cash - $cost WHERE playerid = $pid");

What if your scrubber doesn't work as you thought it would and they find an exploit within it? With ADODB you have some added protection.. The code above, in ADODB, would look like so...

Code: [Select]
$db->Execute("UPDATE player SET cash = cash - ? WHERE playerid = ?", array($cost,$pid));

ADODB will automatically wrap the correct quote syntax around the variables which will prevent injection attacks.. Since it's wrapping the correct quote syntax around it the script kiddies can't force a union or update query to get piggy backed on top of another query ;)


Smarty, ya, I'll agree it is a bit more advanced to learn and I would of probably been lost trying to use it with my first web game. ADODB though is not that way and when I look back at all the games I coded and have online I wish I had used ADODB from the git go, it would of saved me hundreds of man hours tracking down exploits.




Creating online addictions, one game at a time:

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: New to Online Text-base Game coding/designing
« Reply #6 on: March 05, 2007, 06:07:47 AM »
Yeah, it would be a huge hassle to go through all your queries and change to adodb functions.
I've never used smarty before but templates have never been a big deal for me. A header and footer wrapper works fine.
ADODB has been really easy to learn and use and has also made coding easier/faster.

Offline Wakish

  • Level 14
  • *
  • Posts: 111
  • Reputation: +0/-1
    • View Profile
    • Wakish Wonderz
Re: New to Online Text-base Game coding/designing
« Reply #7 on: March 05, 2007, 11:26:40 AM »
codestryke thanks for this nice advice! And i think working with it right from the start, as you said, might be a better step..

About the security, can you guys give me some more advice, like pitfalls and hints.. Because attacks are very frequent for online games nowadays.. i have to account for this aspect in my project.

Thanks a lot guys, all your advice are very important! Thank you!

Offline Zeggy

  • Global Moderator
  • Level 35
  • *****
  • Posts: 1,187
  • Reputation: +13/-4
    • View Profile
Re: New to Online Text-base Game coding/designing
« Reply #8 on: March 05, 2007, 01:11:03 PM »
Codestryke wrote some great articles from his experience in writing games, you can find them here:
http://community.bbgamezone.net/index.php/board,48.0.html

I think most attacks on web games comes from exploiting bugs. Make sure you write all your queries properly, and try not to use hidden fields in forms as much as possible. Check everything that is submitted in forms for the correct data range/type, etc.
Test your game a lot, and enter all kinds of invalid entries into your forms. Enter the wrong data type, insert weird characters, exceed the number ranges (use large numbers and negative numbers) to make sure these errors are picked up.

Offline Wakish

  • Level 14
  • *
  • Posts: 111
  • Reputation: +0/-1
    • View Profile
    • Wakish Wonderz
Re: New to Online Text-base Game coding/designing
« Reply #9 on: March 13, 2007, 06:30:37 PM »
Thanks for the nice advice Zeggy!

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal