Advice on planning a text based browser game in PHP

  • (2 Pages)
  • +
  • 1
  • 2

22 Replies - 2493 Views - Last Post: 13 December 2012 - 12:52 PM Rate Topic: -----

#16 no2pencil  Icon User is online

  • Toubabo Koomi
  • member icon

Reputation: 5182
  • View blog
  • Posts: 26,886
  • Joined: 10-May 07

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 11:35 AM

I would suggest researching php classes.

// You are in a pub
$Character->settings['location'] = 'pub a';
// You now have a drink
$Character->items['drink'] = 'beer';



This would be why you want to plan first, the possibilities shouldn't be endless. You'll need to code for how much a character can obtain, & how to properly test for their items, locations, & so on.
Was This Post Helpful? 0
  • +
  • -

#17 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7571
  • View blog
  • Posts: 12,713
  • Joined: 19-March 11

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 11:53 AM

You're not just developing a game here. You're learning how to develop a game. As it turns out, the sort of game you're learning to develop is not a trivial application, and there's a lot of technique and a lot of theory that's assumed when we talk about this.
For example, when you talk about creating a "world" as a set of locations connected by "move" actions, you're talking about a graph, which is the term for a set of interconnected nodes which can be freely interconnected. (this is as opposed to a tree, which is a graph which is both directed and acyclic, or a linked list, which is a tree without branches)
There are standard ways of building and manipulating these primitives, and you don't know them. This means you're reinventing decades of work done by people, most of whom were extremely smart and did nothing but invent this sort of stuff.
How long does this take you? How long does it take you to invent calculus? How long does it take you to invent calculus and get it right? I don't want to discourage you, but you really should be aware that there's a reason modi sighs so much when he answers these questions.

Can I ask what is odd about it? Would it normally be done another way (or the way you mentioned).


Yes. And yes.

Quote

Would your way reduce the workload and be more efficient?


Yes, and yes. Simple example: Suppose you have three rooms, and each one has a list of exits. Do you prefer to rewrite the idea of "a list of exits" three times, or once? Well, it doesn't matter so much for three rooms. Now think of writing the same line of code a hundred times. A little more bothersome, but you can manage it.

Now think of changing something about that. Would rather have written it one time, or a hundred times?

Point clear now? Lesson: if write the same lines of code more than once, you will eventually hate yourself and want to die. Don't repeat yourself.

This post has been edited by jon.kiparsky: 13 December 2012 - 11:53 AM

Was This Post Helpful? 0
  • +
  • -

#18 theonlyone2012  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 12-December 12

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 12:04 PM

View Postjon.kiparsky, on 13 December 2012 - 11:53 AM, said:

You're not just developing a game here. You're learning how to develop a game. As it turns out, the sort of game you're learning to develop is not a trivial application, and there's a lot of technique and a lot of theory that's assumed when we talk about this.
For example, when you talk about creating a "world" as a set of locations connected by "move" actions, you're talking about a graph, which is the term for a set of interconnected nodes which can be freely interconnected. (this is as opposed to a tree, which is a graph which is both directed and acyclic, or a linked list, which is a tree without branches)
There are standard ways of building and manipulating these primitives, and you don't know them. This means you're reinventing decades of work done by people, most of whom were extremely smart and did nothing but invent this sort of stuff.
How long does this take you? How long does it take you to invent calculus? How long does it take you to invent calculus and get it right? I don't want to discourage you, but you really should be aware that there's a reason modi sighs so much when he answers these questions.

Can I ask what is odd about it? Would it normally be done another way (or the way you mentioned).


Yes. And yes.

Quote

Would your way reduce the workload and be more efficient?


Yes, and yes. Simple example: Suppose you have three rooms, and each one has a list of exits. Do you prefer to rewrite the idea of "a list of exits" three times, or once? Well, it doesn't matter so much for three rooms. Now think of writing the same line of code a hundred times. A little more bothersome, but you can manage it.

Now think of changing something about that. Would rather have written it one time, or a hundred times?

Point clear now? Lesson: if write the same lines of code more than once, you will eventually hate yourself and want to die. Don't repeat yourself.


Quote

Lesson: if write the same lines of code more than once, you will eventually hate yourself and want to die.


^^
Pretty extreme haha, but I understand what you're saying.
If the shoe was on the other foot, I'd probably sigh too!
But don't we all start off on the same skill level?, 0. (note: I'm not completely new to programming, I have made dynamic pages with user generated content that change depending on MySQL databases, but nothing too fancy.)

This thread has already taught me some valuable lessons and given
me ideas as to how to approach this game. It may seem repetitive to you
to repeat the same old techniques and give advice to new programmers,
but it is greatly beneficial for me and I appreciate every word in every response
I get.
Was This Post Helpful? 1
  • +
  • -

#19 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7571
  • View blog
  • Posts: 12,713
  • Joined: 19-March 11

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 12:12 PM

Glad to help. Again: don't mean to be discouraging, but this is not an easy project. Take this as "proceed with caution", not as "stop"
Was This Post Helpful? 0
  • +
  • -

#20 theonlyone2012  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 12-December 12

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 12:31 PM

View Postjon.kiparsky, on 13 December 2012 - 12:12 PM, said:

Glad to help. Again: don't mean to be discouraging, but this is not an easy project. Take this as "proceed with caution", not as "stop"


I have been very cautious so far, I have even come close to opening up notepad++,
I won't start work on this until I am sure that I won't fail. Right now I am trying to familiarize
myself with classes in PHP as clearly they are going to be vital to my game working efficiently.

Apart from classes, could you suggest another important thing for me to learn?
If all the locations/actions are controlled by classes, and the data is all stored in a database,
what else is needed for basic things like entering a new area? (lets say I already understand classes and
functions and databases.)

Eventually I want two players to be able to communicate with short messages, but that's for another day I guess.

Would you advise me to start on the project even if I don't exactly know how I'm going to implement some of the advanced features
(like the communication functionality) as long as I know how to code the games basic functions?
Was This Post Helpful? 0
  • +
  • -

#21 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7571
  • View blog
  • Posts: 12,713
  • Joined: 19-March 11

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 12:37 PM

I would suggest you write it on the whiteboard first. Sketch out everything that you're going to want, put all the pieces together, see if it makes sense.

Then build a throwaway prototype and see what works. Three rooms, a few objects to pick up and carry around. See how that feels. Imagine extending it to 100, or 1000 rooms. Does the idea hurt? If so, start over. It's easier and cheaper to scrap a week's rough draft work and redo it than to try to fix it later.

No matter what you do, your second project will be better than this one - that's called learning from experience. What we're suggesting here is just ways to make the first project worth learning from.
Was This Post Helpful? 0
  • +
  • -

#22 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 8939
  • View blog
  • Posts: 33,517
  • Joined: 12-June 08

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 12:45 PM

Quote

Can I ask what is odd about it? Would it normally be done another way (or the way you mentioned).
Would your way reduce the workload and be more efficient?

Yes - typically there is more care to codify similar functionality along rooms, but what evs - it is your design.

Quote

Just out of curiosity, how long would it typically take you to complete a large game?
(I'm assuming you're adept in the field.)
I just want to figure out a time frame for myself to finish the game.

That's darn impossible to tell without having a design doc in front of me.

Quote

I won't start work on this until I am sure that I won't fail.

That's always a large possibility for any project. Accept it and take any failure as a learning experience.
Was This Post Helpful? 0
  • +
  • -

#23 theonlyone2012  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 11
  • Joined: 12-December 12

Re: Advice on planning a text based browser game in PHP

Posted 13 December 2012 - 12:52 PM

View Postmodi123_1, on 13 December 2012 - 12:45 PM, said:

Quote

Can I ask what is odd about it? Would it normally be done another way (or the way you mentioned).
Would your way reduce the workload and be more efficient?

Yes - typically there is more care to codify similar functionality along rooms, but what evs - it is your design.

Quote

Just out of curiosity, how long would it typically take you to complete a large game?
(I'm assuming you're adept in the field.)
I just want to figure out a time frame for myself to finish the game.

That's darn impossible to tell without having a design doc in front of me.

Quote

I won't start work on this until I am sure that I won't fail.

That's always a large possibility for any project. Accept it and take any failure as a learning experience.


I don't want it to fail because, the game itself, (if I could manage to create it perfectly) is quite a genius game.
I think it would be really successful/addictive and it has a unique way of generating revenue. (I haven't posted to much info about how it would work but this game would be very unique.)


Of course it can't be successful if it doesn't exist.

Which is what brought me here.

I feel I know more about what is required today than 2 days ago, so posting here has been worthwhile.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2