Want to make a web based game?

Look no further

  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »

98 Replies - 110745 Views - Last Post: 24 December 2010 - 10:37 PM Rate Topic: ****- 6 Votes

#8 snoj  Icon User is offline

  • Married Life
  • member icon

Reputation: 84
  • View blog
  • Posts: 3,564
  • Joined: 31-March 03

Re: Want to make a web based game?

Posted 14 August 2007 - 05:34 PM

*
POPULAR

This was originally posted by Martyr2. It will help you make your game.

Quote

Well the people who gave you that advice about using PHP CSS and MySQL were pretty wise. The better text based games on the net are done in a similar style. As for help doing the PHP, you can always ask here for specific questions you have. While we are not in the habit of just doing everything for you, if you make an effort to learn the language and provide some code where you get stuck we can certainly help. smile.gif

Now what you are going to need to develop this are the following:

1) paper and pencil - This is where you create the game on paper and think up how everything will interact with one another. For example in your mafia game (btw you are not the pope are you?) you will want to write out a story line, possible venue locations, unit types (thugs, dealers etc), how you simulate a battle, how scores are done, how do you advance in the game etc. Once you got all that written out, you can move onto the next thing.

2) You are going to need a web host that can supply you with MySQL databases, has PHP installed, and possibly has the ability to run cron jobs (schedule programs to run at certain times to update the environment for your game)

3) List out the pages you need based on what you wrote on the paper, put some flow charts together for your code. Maybe even write out your pseudocode for various events you have planned.

4) Read up and study the PHP language. Then you can start with simple things like the user login script and how to connect to your database (google for articles on the topics. Some books also cover these topics.)

5) Write and learn as you write. Work hard and the rest will be glorious!

Hope these tips help you with the development of your game.

And if you are the pope, let some admin know that you are the pope and want to start a mafia game (its an inside joke).

Good luck! :)

Was This Post Helpful? 6

#9 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4421
  • View blog
  • Posts: 12,286
  • Joined: 18-April 07

Re: Want to make a web based game?

Posted 19 August 2007 - 11:25 AM

I wanted to thank you hotsnoj for pinning that discussion. I also wanted to let people know that I am willing to entertain further discussions on PHP game development for the web. I have participated in the development of several online games and beta tested for others. Some of the games include...

1) Utopia (early stages)
2) Lords game (security testing)
3) And recently development for Age of Kings (working title.. next step in Eventide expansion)

HOWEVER, if the question is about gaming mechanics, please ask in the Game Programming forum. If the question is specific to PHP syntax or debugging, then post here.

Thanks.
Was This Post Helpful? 1
  • +
  • -

#10 Enortimus  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 23-August 07

Re: Want to make a web based game?

Posted 23 August 2007 - 06:51 PM

Wow you serious? Lords game? i played that!
Was This Post Helpful? 0
  • +
  • -

#11 dyne  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-August 07

Re: Want to make a web based game?

Posted 30 August 2007 - 11:28 PM

This is a very wise instruction!

When I started PHP about 5 or 6 years ago i soon began to code my first game.
I should be called "Magical Dale".
Every User has his own town and he can build up buildings, research technologies and build military units. Then they can start to attack free town or other users on the world map.
I spent much time for all the details. I created the world map with almost 200 towns - each with own name. I created a story, different races and a huge tech tree for each of them.
Then I started coding, and everything was sh*t.

I spent so much time for the code but didn't finish the game. If i tried to code that game again now, i finished it three times in that period.

My fault was not to use OOP which is essential for games like this! Users, Towns, Units CALL to be programmed as classes!
Unfortunatelly nowadays i don't have the time to code a game, and I fear if I ever come accross coding a game like this in 3 or 4 years no one on the globe is interrested in "PHP-Games".

This post has been edited by dyne: 30 August 2007 - 11:47 PM

Was This Post Helpful? 0
  • +
  • -

#12 Gakknor  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 08-September 07

Re: Want to make a web based game?

Posted 08 September 2007 - 05:08 PM

This post is very confusing and not really helpful for a real beginner to be honest. Anything more beginner material? I take beginner being never coded ever and wants to learn. What is this php mySQL and stuff?
Was This Post Helpful? 0
  • +
  • -

#13 Aerodizz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-September 07

Re: Want to make a web based game?

Posted 09 September 2007 - 10:10 AM

I was hoping that someone could help me make a text-based mafia game hehe because i have the problems with finding out how to code and stuff :angry:
Was This Post Helpful? 0
  • +
  • -

#14 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4421
  • View blog
  • Posts: 12,286
  • Joined: 18-April 07

Re: Want to make a web based game?

Posted 09 September 2007 - 02:54 PM

Well I can tell you that to get the best results you will want to explain what part of the game you are working on and then provide some code that attempts to do it. We need to see the effort first, we can't simply do the code for you.

Here is a great example of what I mean....

Topic: mafia game, why won't units deal damage?
Description: I am building a mafia game where units have street fights. Two characters engaged in battle deal damage to one another using this formula... abs((2*str) + ((level/.01) * random)), why does my character attempt to deal negative damage?

<show code here>


Then we can go about showing why your formula might be returning a negative damage result and how you might get it to work better. Again we can only help put you in the right direction but at least you can say you did the work at the end and reap your own rewards.

But if you phrase it like that then we can see your errors, what you are trying to do and help you on your game development all at the same time.

Since each person's game is different, we can't write a "this is how you setup a game" type tutorial. Each game has its own features.

:)
Was This Post Helpful? 1
  • +
  • -

#15 Gakknor  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 08-September 07

Re: Want to make a web based game?

Posted 10 September 2007 - 11:44 AM

View PostMartyr2, on 9 Sep, 2007 - 02:54 PM, said:

Well I can tell you that to get the best results you will want to explain what part of the game you are working on and then provide some code that attempts to do it. We need to see the effort first, we can't simply do the code for you.

Here is a great example of what I mean....

Topic: mafia game, why won't units deal damage?
Description: I am building a mafia game where units have street fights. Two characters engaged in battle deal damage to one another using this formula... abs((2*str) + ((level/.01) * random)), why does my character attempt to deal negative damage?

<show code here>


Then we can go about showing why your formula might be returning a negative damage result and how you might get it to work better. Again we can only help put you in the right direction but at least you can say you did the work at the end and reap your own rewards.

But if you phrase it like that then we can see your errors, what you are trying to do and help you on your game development all at the same time.

Since each person's game is different, we can't write a "this is how you setup a game" type tutorial. Each game has its own features.

:)


Can you please help me? I been asking how I can learn how to code and no one is listening to me.
Was This Post Helpful? 0
  • +
  • -

#16 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1877
  • View blog
  • Posts: 20,284
  • Joined: 17-March 01

Re: Want to make a web based game?

Posted 10 September 2007 - 12:17 PM

Gakknor, you were told to look in to PHP and mySQL... did you google either of these technologies to find out more? Part of learning to program is being a little self sufficient. If you don't even know what the different types of languages are, you need to focus on learning that, and forget about the game for now. Baby steps.
Was This Post Helpful? 2
  • +
  • -

#17 msh7ar  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 5
  • Joined: 20-September 07

Re: Want to make a web based game?

Posted 21 September 2007 - 04:04 AM

Hello Mr.Martyr2 , Hello every body
i'm php programmer and i wrote the full script of mafia game
like the www.allmafia.com
but i still don't know the idea and mechanism of attack functions .

if any body help me and give me notes about function
or write the functions for me , i'll upload the full project for everybody
here .


and thank you all for this nice website.
plz contact me 4 any comments : msh7ar_01@yahoo.com
Was This Post Helpful? 0
  • +
  • -

#21 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4421
  • View blog
  • Posts: 12,286
  • Joined: 18-April 07

Re: Want to make a web based game?

Posted 14 October 2007 - 12:47 PM

*
POPULAR

Yeah attack functions are one of the trickiest parts of the actual game play. The idea is that you have to calculate the strength and defense of each player, army, unit whatever and how to assign that damage.

There is no magical one fix all attack formula since games have various factors. This formula will also be one of the most frequently tweaked algorithms in your game to make sure it is balanced. Here are a couple tips to look at when designing this functionality....

1) Base damage - What is the most basic amount of damage they can do. Usually this is determined by the strength of the character and weapon/its grade. Obviously the base "physical" damage of a level 20 male barbarian is going to be more than that of a level 10 female rogue. Of course he might be slower too.

For this I usually use a characters strength times a specific constant like level * .5. So if they are a level 20 character maybe their base damage is 10. Then I go about adding the weapon damage and its grade. Maybe an axe that deals 10 - 20 damage of the lowest grade might be (randomdamage(10,20) * 1) where we introduce our first sign of "randomness" Not always is your character going to land the best hit for maximum damage, but will at least hit for 10 and possibly up to 20. The number 1 in this formula would be a grade modifier saying that since it is the lowest grade, don't really apply damage amplification.

So if they hit for 15, they hit for 15. Now if they had a grade modifier of 1.2 they would hit for 18 (15 * 1.2).

So put together the base damage plus the weapon damage with grades you might see something like...

dmg = ((character level * .5) + (weapondamage(10,20) * gradeofweapon))

2) Modifying damage - Above shows you a little bit of the modification process with weapon grade, but you might have things like spells or certain circumstances where your character may have to hit for more or less than their normal base damage. These basically take the attack damage and either modifies the entire damage dealt or we effect a certain part of the damage formula... like make the weapon deal lower damage than it normally would.

Applying the modification to the total damage value has HUGE effects and modifying some part of the damage formula can have small or large effects depending on what it is applied to.

For instance, we had our axe which dealt 10-20 random damage plus a medium grade constant of 1.2. So a 15 pt hit would actually turn to 18 because of the better weapon grade. Now lets say we get into a battle and our enemy casts rust on our character. We could modify the 1.2 to instead be something like .8 which would turn our 15 point hit into something like 12.

Or we could modify the entire damage for large effects like maybe they cast something like weakness on us which knocks off 5 points of damage straight of our damage. So take the "dmg" variable above and subtract 5 points (if dmg < 0 then set dmg to zero) causing our character to hit for a possible 0 damage. Which makes sense if they can't even lift their heavy sword.

3) Randomness - This is the part you have to be very careful of and the part that usually needs the most tweaking. Always keep an eye on the lowest/highest value a random expression can give and make sure it makes sense in the formula. You don't want to be giving your character a weakness of random(100,200) if your characters damage never gets above 80 because then your character will never deal damage. You will also use randomness when determining if their attempt to attack will actually strike the player. Remember, people fighting can miss the person entirely. So use a random chance function to determine this.

4) Defense - This formula is going to be very much like your attack but instead of calculating damage you are calculating how much damage you can take safely with another possible calculation on the probability that they land a blow.

5) Assign the damage and determine the victor - Well you got one character with their attack damage formula, another with their defense formula... determine who wins. The idea is pretty simple...

damage to defensive player = attacker damage - defensive player protection.

For instance if the level 20 barbarian hit for 100 points (base damage plus weapon plus it did land) and the other person is a level 20 barbarian with defense of 80, the overall damage to the defensive barbarian is going to be 120 - 80 or 40 damage.

Lets say the defensive player got a better armor grade... they would then have something like.. 120 - 90 or 30 damage be dealt to the defensive player.


Now again these are only some basic formulas and may things can come into play calculating these formulas. They will need to be leveled out a little and perhaps you don't have spells, maybe you have various types of armor (like actual armor AND a protection enchantment). So you will need to add and modify formulas accordingly.

Hope this information can get you started with the attack.

Enjoy! :)

This post has been edited by Martyr2: 23 October 2007 - 02:01 PM

Was This Post Helpful? 6

#22 Realm Keeper  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 02-August 05

Re: Want to make a web based game?

Posted 23 October 2007 - 01:16 PM

View PostMartyr2, on 14 Oct, 2007 - 12:47 PM, said:

For instance if the level 20 barbarian hit for 100 points (base damage plus weapon plus it did land) and the other person is a level 20 barbarian with defense of 80, the overall damage to the defensive barbarian is going to be 120 - 80 or 20 damage.

Lets say the defensive player got a better armor grade... they would then have something like.. 120 - 90 or 10 damage be dealt to the defensive player.


i don't mean to be rude...
but err, last time i checked 120 - 80 != 20...
and 120 - 90 != 10

hehe, just a little checking to show i DO actually envisage whats happening in my mind. just pointin out there was a logic error in there somewhere, im guessing when the lvl20 barbarians dmg went from 100 to 120 :D

sorry, felt the urge to bring your mathematics to the tables, adn dissect it slowly and painfully like a flaming deoderant covered ant!
Was This Post Helpful? 0
  • +
  • -

#23 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4421
  • View blog
  • Posts: 12,286
  • Joined: 18-April 07

Re: Want to make a web based game?

Posted 23 October 2007 - 02:00 PM

Ooops! You are certainly right. I will have to change that then. I was in a bit of a rush to get the tips down and out there. Thanks for pointing it out. :)


Edit: There we go, everything should be fixed now. Thanks again.

This post has been edited by Martyr2: 23 October 2007 - 02:02 PM

Was This Post Helpful? 0
  • +
  • -

#24 fooboo  Icon User is offline

  • The king of Nynex
  • member icon

Reputation: 4
  • View blog
  • Posts: 3,107
  • Joined: 28-July 06

Re: Want to make a web based game?

Posted 06 November 2007 - 08:31 PM

Cool. I'm just about to start writing a web based game and learn PHP on the way so I checked in here and what do you know I found a post about the very subject.

I have begun to design the database on paper and have though through the back story but it occured to me there is one thing I don't yet know about PHP and that is what can be done with it on the backend side of things.

My game, like many I've played, will use timed attacks on citys. This needs to be syncronised (and put in a priority order if several attacks are sent) so that the attack happens at the same time for the attacker as the defender. Is this typically something I can do with PHP or will I need some backend application that PHP can connect to?
Was This Post Helpful? 0
  • +
  • -

#25 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4421
  • View blog
  • Posts: 12,286
  • Joined: 18-April 07

Re: Want to make a web based game?

Posted 07 November 2007 - 04:24 PM

*
POPULAR

Most anything that is done with timing is handled by scheduled jobs known as cron jobs. These are scheduled events that will run a designated program or run a file at the specified time. In this case it would execute a PHP script that would be used to update events, attack results, give gold or whatever. This is how websites would give a soldier gold each day without the admin having to run the query himself/herself.

I suggest you read up on cron jobs (if you are on a linux host otherwise you will have to look into scheduling jobs on a windows platform for windows hosts) and get a host that allows you to run these. The below link will get you started on the path to implementing jobs and getting the timing down as to what needs to happen when.

My suggestion, don't make too many objects of your game time dependent and dependent on one another or you are going to have problems the first time one of your jobs fails or is not working as you expect. It will cause other jobs to fail etc.

Here is the site... Enjoy! :)

What is a cronjob, and how do I use it?

"At DIC we be PHP gaming junkies!" :alien:
Was This Post Helpful? 5
  • +
  • -

  • (7 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »