Jump to content

Recommended Posts

Well some questions you can ask yourself are:

1. When is the game based?
2. Is it futuristic, modern, or medieval?
3. What can the player do?
4. What types of weapons or items can the player buy?

etc. etc.

If I were you I would write up a plan for it. Jot down all your ideas and even brainstorm with friends on some ideas.

Oh, and another question is...
Will it be text based?

If your doing PHP then it will most likely be text based. You can use images etc but the core of the game would be text.

Another thing...
Once you start something, like adding in a feature, finish it before you move onto the next one! And!! Make sure that it is working properly before continuing...

There are also some tutorials around for making a PHP game, just google search it.

Hope this cleared some things up for you,
Good luck!!
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-131968
Share on other sites

Ya i wrote a lot of stuff down.  Its kinda looking like Earth 2025 but the problem i have is when they attack someone i cant make it to add the defense into the attack equation im trying to make it so when they attack it will attack and if it has a high number of defense it will do less damamage and what not if u guys know what i mean
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132151
Share on other sites

Heres what im going off of
Game Name Fire Fight 2060

RESOURCES------
Glod, Metal, Food, Wood
Gold = Building Researching, Purchasing
Food = Feed Units
Metal = Building, Purchasing
Wood = Building

UNITS------
Light Tatical Troops = 50 gold + available housing
Heavy Tatical Troops = 100 gold + available housing
Light Jet Pack Troops = 100 gold + available housing
Heavy Jet Pack Troops = 150 gold + available housing
Spies = 75 gold + available housing
Jet = 500 gold + available space in the Hanger
Tank = 400 gold + available space in the Hanger

BUILDING------
Residence = 100 gold + 50 metal
Barracks = 300 gold + 100 metal
Farms = 200 gold + 50 metal + 100 Wood
Hangers = 500 gold + 200 metal
Research Labs = 400 gold + 150 metal
Mine = 200 gold + 50 metal + 100 Wood

RESEARCH------
Farms = 100 Gold
Training Center = 100 Gold
Factory = 100 Gold
Residence = 100 Gold
Metal Gathering = 100 Gold


Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132231
Share on other sites

this is what my user db table looks like does it look okay?
-- phpMyAdmin SQL Dump
-- version 2.9.1.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 29, 2006 at 12:09 PM
-- Server version: 5.0.27
-- PHP Version: 5.2.0
--
-- Database: `firefight2060`
--

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` bigint(100) NOT NULL auto_increment,
  `emperorname` varchar(100) collate latin1_general_ci NOT NULL,
  `email` varchar(100) collate latin1_general_ci NOT NULL,
  `password` varchar(100) collate latin1_general_ci NOT NULL,
  `first` varchar(100) collate latin1_general_ci NOT NULL,
  `last` varchar(100) collate latin1_general_ci NOT NULL,
  `cityname` varchar(100) collate latin1_general_ci NOT NULL,
  `lt` varchar(100) collate latin1_general_ci default '100',
  `ht` varchar(100) collate latin1_general_ci default '75',
  `ljpt` varchar(100) collate latin1_general_ci default '50',
  `hjpt` varchar(100) collate latin1_general_ci default '25',
  `spies` varchar(100) collate latin1_general_ci default '20',
  `jets` varchar(100) collate latin1_general_ci default '5',
  `tanks` varchar(100) collate latin1_general_ci default '5',
  `torrents` varchar(100) collate latin1_general_ci default '5',
  `gold` varchar(100) collate latin1_general_ci default '20000',
  `wood` varchar(100) collate latin1_general_ci default '10000',
  `metal` varchar(100) collate latin1_general_ci default '10000',
  `food` varchar(100) collate latin1_general_ci default '50000',
  `rfarms` varchar(100) collate latin1_general_ci default '5',
  `rtcenter` varchar(100) collate latin1_general_ci default '5',
  `rfactory` varchar(100) collate latin1_general_ci default '5',
  `rresidence` varchar(100) collate latin1_general_ci default '5',
  `rmetalg` varchar(100) collate latin1_general_ci default '5',
  `status` varchar(100) collate latin1_general_ci default 'noob',
  `signupdate` timestamp NULL default CURRENT_TIMESTAMP,
  `bm` varchar(100) collate latin1_general_ci default '1',
  `bf` varchar(100) collate latin1_general_ci default '1',
  `population` varchar(100) collate latin1_general_ci default '500',
  `br` varchar(100) collate latin1_general_ci default '5',
  `bb` varchar(100) collate latin1_general_ci default '1',
  `bh` varchar(100) collate latin1_general_ci default '1',
  `brl` varchar(100) collate latin1_general_ci default '1',
  `turns` varchar(100) collate latin1_general_ci default '100',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

--
-- Dumping data for table `users`
--
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132250
Share on other sites

I have a game I made at work for our production department to play with.

Like others I started small. You can do basic attacking etc (which I still havent been able to balance properly) but aftger I get the attacking/defending done then I'll get into the bonuses and other features etc.

Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132296
Share on other sites

OK, the following looks like you're actually storing the players units in the user table, is this accurate?
[code]
  `lt` varchar(100) collate latin1_general_ci default '100',
  `ht` varchar(100) collate latin1_general_ci default '75',
  `ljpt` varchar(100) collate latin1_general_ci default '50',
  `hjpt` varchar(100) collate latin1_general_ci default '25',
  `spies` varchar(100) collate latin1_general_ci default '20',
  `jets` varchar(100) collate latin1_general_ci default '5',
  `tanks` varchar(100) collate latin1_general_ci default '5',
  `torrents` varchar(100) collate latin1_general_ci default '5',
[/code]

If so, you may need to really rethink your database optimization. Well, I guess that would depend on the type of game... I'm a little surprised that it wasn't mentioned earlier. Are you doing a MMORPG, RTS or a Tactics style game? Each one of those styles will need to be handled differently when it comes to player units. Also, as with RTS or Tactics games, a player could legitimately have multiple games going on at once, so you don't want to limit them by keeping their units tied to their username, but rather tied to their individual games instead.

Hope this helps give you some more direction. As others have said, start small... get your classes set up to where you can have a one on one unit battle and get the desired outcome. If you have a generic unit class set up that handles all the attack, defense and stats, then all you have to do is add the customized armor, strength, defense, etc to the child classes, and the rest will take care of itself as you begin to battle them together. Also, think up scenarios that you may need to keep in mind: no matter what your armor is like on something like tanks versus light infantry, you really [b]never[/b] want to allow a light infantry unit to destroy an armored vehicle of some sort, so you need to assign classes accordingly.

Basically, keep in mind all the additions you may want to add on, and write your code open ended.

Good luck!
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132303
Share on other sites

well just make another table called units or something and make sure it has a userid field. this table will store all the users units, so to access it just use the current users id.

[code=php:0]
$userid = $_SESSION['userid'];
$units = mysql_query("SELECT * FROM units WHERE userid='".$userid."'");
[/code]

etc etc. Do that for most tables so that your users table isnt so big.
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132609
Share on other sites

[quote author=chriscloyd link=topic=116669.msg475987#msg475987 date=1164842206]
i honestly dont know the differences between the two can you pm me and tell me and help me with an idea of how to set up the db
[/quote]

Well, rather than a PM, I figure this is as good a place as any to discuss it, simply because there may be others that have the same question, and I'd rather other people have a discussion to reference for their questions, too.

Here are my thoughts: if you're having something like a MMORPG and your users can have [i]x[/i] number of units (of different types, of course), your setup will work fine. However, if you are wanting to do something like [url=http://awbw.amarriner.com]Advance Wars By Web[/url] or another online tactics style game where people can set up boards to play on, and possibly even have multiple boards or games going at one time, you've got to tie the individual units to the game itself rather than strictly to the user. This is the idea of a basic schema that may help you understand what I mean:
[code]
CREATE TABLE users (
  id INT(11) AUTO_INCREMENT PRIMARY KEY,
  username VARCHAR(20) NOT NULL UNIQUE,
  password VARCHAR(50) NOT NULL
);

CREATE TABLE units (
  id INT(11) AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(255) NOT NULL UNIQUE,
  attack INT(4) NOT NULL DEFAULT 1,
  defend INT(4) NOT NULL DEFAULT 1,
  -- Put the rest of your base stats here --
);

CREATE TABLE games (
  id INT(11) AUTO_INCREMENT PRIMARY KEY,
  player1 INT(11) REFERENCES users(id),
  player2 INT(11) REFERENCES users(id)
);

CREATE TABLE game_units (
  game_id INT(11) REFERENCES games(id),
  user_id INT(11) REFERENCES users(id),
  unit_id INT(11) REFERENCES units(id),
  qty INT(2) NOT NULL DEFAULT 1,
  PRIMARY KEY (game_id, user_id, unit_id)
);
[/code]

As you can see, this simply sets up a relationship between the user, game and individual unit types. The way I have suggested doing the unit table will allow you to have the base statistics for each type of unit declared in the table itself. At that point, if a character picks up a powerup of some sort, or armor or whatever bonus you want to talk about, you can simply modify that character's base stats accordingly. This is where creating classes to handle all your units comes in handy. If you build your classes to handle bonuses, you can build your bonuses in such a way to modify specific stats. Then, when you create that unit, you can store in a [i]bonuses[/i] table what that character has, and with a couple well formed queries, you can recreate an entire playing field with everything stored in your database.

One thing I haven't touched on yet is grid locations of units. Whether or not your game is going to be graphical, you need to have a plane that the characters are set on. If you don't, at least mentally, handle the [b]location[/b] of your characters, you could run into problems down the road. If you think about it, even old text based adventure games kept track of where on the map you were, and you had only certain directions you could go. It's no different here. You need to keep track of [b]where[/b] each unit is, whether that is through a 2D or 3D grid or just a generic map location of your creation.

Obviously, there is a lot to think about. I hope this has helped to point you in the right direction for planning. Let me know if there is anything else you need clarification on.
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-132641
Share on other sites

haha, thats odd because kingsofchaos is a fairly large text-based game. they are fun and good for people that dont have high internet speeds. Java is good but requires a lot and lot of time and you really need a large team to work on it.
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-133274
Share on other sites

[quote author=ProjectFear link=topic=116669.msg476838#msg476838 date=1164957507]
haha, thats odd because kingsofchaos is a fairly large text-based game. they are fun and good for people that dont have high internet speeds. Java is good but requires a lot and lot of time and you really need a large team to work on it.
[/quote]
Lies! lol, but seriously, text based games can't really compete with current games.  Java is not hard at all to learn, it took me sitting around on a computer an hour a day for 4 days to be able to write some nice applets, it's really a simple language.  If you really want to make some good stuff, go C/C++ though, it is a beautiful language ;)
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-133279
Share on other sites

[quote author=ProjectFear link=topic=116669.msg476838#msg476838 date=1164957507]
haha, thats odd because kingsofchaos is a fairly large text-based game. they are fun and good for people that dont have high internet speeds.
[/quote]
Very good point. Text based games are awesome to the imaginative mind. I still go back to some of the old text based adventures like Zork for a change every once in a while. Comparing text based games to a graphical one is sort of like comparing reading a book to a movie. Text based games leave so much up to your imagination that they can be much more enjoyable than graphical games to someone who is willing to take the extra effort required to play them.

[quote author=ProjectFear link=topic=116669.msg476838#msg476838 date=1164957507]Java is good but requires a lot and lot of time and you really need a large team to work on it.
[/quote]
Actually, that isn't the case any moere: there are so many core apps and engines out there to build off of, you could quite easily come up with a decent GUI for a game on your own using Java. There are so many tutorials and code samples as well as classes and modules to build from that you could have a pretty hefty app built by yourself in a relatively short amount of time. Plus, if you do it right, someone doesn't need much of an internet connection at all to play (dial-up works just fine with well-written apps) since it should be run as a desktop application that simply taps the internet for updates of opponents positions. Turn based games would be especially low on requirements since you don't need to hit the net for an update except for once every turn.

Another very viable option is to use for a graphically enhanced game is Flash. If you get good at your coding, build your game engine in PHP, and then use that to interact with ActionScript and generate your characters visually. I believe that is what they do with http://www.tacticsarena.com, and it's beautifully done.
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-133385
Share on other sites

[quote author=Dobakat link=topic=116669.msg476852#msg476852 date=1164958107]
I am building my own game from scratch... maybe we could join. I am trying to do it with some AJAX. :)
[/quote]

I've played a few with AJAX, but I've not seen any that have really used it to an extreme. I'd love to see one that uses Javascript animation along with AJAX for some visual effects. I've toyed around with a chess game that actually animates piece movement and updates everything via AJAX, but I've got a little ways to go yet. The cool thing about using AJAX is that you can see your opponent's moves without refreshing the page as well... cool concept, at least ;)
Link to comment
https://forums.phpfreaks.com/topic/28820-help-web-based-game/#findComment-133410
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.