Jump to content
xisto Community
kc8ual

I Want To Create A PHP Text Based Web Game

Recommended Posts

Also before rushing off and getting a web hosting account it would probably be best just to setup Apache, PHP and MySQL on your own computer first, makes it easier to test your scripts.

WampServer (or XAMPP) is what you will want for this. Read more on the [a="http://forums.xisto.com/topic/90152-topic/?findpost=1064347555;]Important: Basics Of Using PHP And MySQL[/a]

I'm in the middle of making my own text-based MMORPG at the minute, but believe me, it's a MASSIVE project. I really should get some help in but I'm stubborn like that lol
Good luck!


The two of you ought to collaborate on this if you're both heading for the same goad and both need assistance.


Oh, and 23 replies isn't as far off now as it was before ;).
Edited by Jonnyabc (see edit history)

Share this post


Link to post
Share on other sites

WampServer (or XAMPP) is what you will want for this. Read more on the [a="http://forums.xisto.com/topic/90152-topic/?findpost=1064347555;]Important: Basics Of Using PHP And MySQL[/a]

Urgh no, Xampp is horrible. It's really just a tool for people who are complete novices at setting up server technology and have no wish to learn further about REAL server configuration. I know many people who use Xampp and are all just web development pretenders. If you want to do it right then you set it all up on a Linux machine and configure the entire lot yourself, not some pre-compiled garbage package!

Well, that's my thoughts on Xampp anyway, any takers?

Share this post


Link to post
Share on other sites

About using WampServer or Xampp, I agree that people who use it, really don't know a lot about setting up everything one by one, by installing and configuring Apache, MySQL and PHP.But when working locally, it's sometimes is just a waste of time, on localhost I don't need anything more than just Wampserver or Xampp, especially on a Windows machine, it's usually pre-configured very well and it saves time, whenever you're reinstalling your OS or installing a virtual machine, I was fed-up with doing it all over again, or while updating, it also was just a waste of time, you can just use Wampserver or Xampp.But what is funny, there are a lot of tutorials step by step how to install a server locally, but people have problems, also people have problems installing Wampserver or Xampp too, even though all you need is to click next next next..I remember I used to have a lot of problems with PHP4 on Windows machine, due to my server was a Linux one, but eventually I moved to MySQL all the way and practically don't use files and try to do everything that it would work on any machine. Sometimes it's good to check it somewhere in your script which OS is the script running on. ;)

Share this post


Link to post
Share on other sites
MySQL Database Inventory QuestionI Want To Create A PHP Text Based Web Game

hey guys, I've been coding a web-based text-rpg lately using javascript/jquery/php/MySQL andI have a question on how to best do something.

 I guess the question mostly has to do with mysql database setup. I have a table in my database called Players and in this the fields are userName, password, health, energy, strength, money...And so on..

Anyway, now I need every player to have an "Inventory", I can't have "Inventory" be a field in players, as each Inventory field will need to have multiple values (all weapons/items/stuff) that each player owns. My question is what would be the best way to do this database-wise? Will I need to create an Inventory_PlayerID table for every single player that registers? It seems like there should be an easier way to do it. Any insight will be appreciated.

Share this post


Link to post
Share on other sites
Its not....I Want To Create A PHP Text Based Web Game

Do you mean like SIMs? As I am also doing something like that but animal based. PHP is usually used as it is dynamic and it doesn't stay the same ! For example, users, they are all different, like ID, it always goes up and PHP changes all the pages with the user or animal, ect. So to make dynamic pages, use PHP. Use HTML and CSS for some bits and bobs and perhaps JavaScript. If I was you I would PM an admin on a SIM or text based game, and ask them what language they used.

And remember this requires deep pockets and time. Its not going to be done within a month, it'll be done perhaps in a few years, so be prepared ;D And good luck!

-reply by Subby

Share this post


Link to post
Share on other sites

MySQL Database Inventory Question

I Want To Create A PHP Text Based Web Game

 

hey guys, I've been coding a web-based text-rpg lately using javascript/jquery/php/MySQL andI have a question on how to best do something.

 

I guess the question mostly has to do with mysql database setup. I have a table in my database called Players and in this the fields are userName, password, health, energy, strength, money...And so on..

 

Anyway, now I need every player to have an "Inventory", I can't have "Inventory" be a field in players, as each Inventory field will need to have multiple values (all weapons/items/stuff) that each player owns. My question is what would be the best way to do this database-wise? Will I need to create an Inventory_PlayerID table for every single player that registers? It seems like there should be an easier way to do it. Any insight will be appreciated.


I had a hard time deciding on my inventory system, but I found the following to be the best way.

 

Decide on the size you want a users inventory to be and create a new table called inventory with the rows ID, USER, ITEM. In your php select all their inventory SELECT * FROM INVENTORY WHERE user=USERID, to get the amount of inventory slots used use mysql_num_rows(QUERY) so:

 

$invsize = 10;if (mysql_num_rows(mysql_query("SELECT * FROM INVENTORY WHERE user=USERID")) < $invsize){echo 'You still have inventory space';}else {echo 'Your inventory is full!';}

Hope that helps you!

Share this post


Link to post
Share on other sites

Trust 8ennett hes a pro at this stuff lol, yes it's very hard to start off making games and i have to say that mccodes is just horrible i hate it its impossible to do anything decent with it and anyways 8ennet has started releasing a tut so i would go check his out

Share this post


Link to post
Share on other sites

I had a hard time deciding on my inventory system, but I found the following to be the best way.
Decide on the size you want a users inventory to be and create a new table called inventory with the rows ID, USER, ITEM. In your php select all their inventory SELECT * FROM INVENTORY WHERE user=USERID, to get the amount of inventory slots used use mysql_num_rows(QUERY) so:

$invsize = 10;if (mysql_num_rows(mysql_query("SELECT * FROM INVENTORY WHERE user=USERID")) < $invsize){echo 'You still have inventory space';}else {echo 'Your inventory is full!';}

Hope that helps you!
This might be the best way to implement an inventory system. You can also make a friend system this way.

But for inventory, you should have a table for users and a table for items (by ID). Then you create a new table named inventory or something, with an ID column, then USERID (foreign to the userid column in user table) and itemid (foreign to the itemid column in the item table).

Then if you want to retrieve the inventory for user 1515, you just query the table items like this:
phpmysql_query("SELECT * FROM items WHERE userid=1515");

Share this post


Link to post
Share on other sites

If you want an example of a working inventory system, i'll be showing you in-depth how to construct one in my latest series of tutorials where by the end of them you will have a fully functioning text based web game.The inventory system is coming soon so keep an eye out for it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.