Last question, unless I think of more :p Framework or no? I heard talk of they help seperate the code into specific categories, but I don't get what that's about.
Printable View
Last question, unless I think of more :p Framework or no? I heard talk of they help seperate the code into specific categories, but I don't get what that's about.
I think that with "separate the code" they meant the MVC model(http://book.cakephp.org/view/10/Unde...iew-Controller).
Im using zend framework(http://framework.zend.com/) to make a website and its great, hard to get it at first, confused me for a while but when I got it, it made development a lot easier.
I would suggest learn good amount of php, then look into a framework to use and if you think it is better or not.
In my opinion by one side its good, make coding a lot faster and the code will probably have less bugs then using something you made because it is tested by lots of people :P
By the other side, you wont know what happens behind the scenes and you wont learn how somethings works.
That's the framework I keep hearing about. Thanks for the info, I'll test it out once I learn some more like you suggested.
Well, in my opinion you won't want a framework for making a browser based game, your probably going to find it constricts you a lot more. Your probably better off making your own classes (Database, session, settings, validation and game specific ones) to accomplish this.
In case you do go with a framework though i'll give you some pro's / cons, i've tried quite a few PHP frameworks.
Codeigniter: Probably the easiest to pick up, you'll have no problem picking it up once your versed in php(5).
CakePHP: Slightly bigger learning curve and there are restrictions on naming conventions, you need a Model (M in MVC) for every database table, even if it doesnt need one. But there is good documentation etc to help :)
KohanaPHP: A version of codeigniter thats been made more rigidly PHP5 orientated, its a steeper learning curve though.
ZendFramework : I've heard great things, yet it's a Zend product so no doubt hard to pickup for a beginner ;).
And javascript: You'll want jquery if you decide to use Ajax etc. Jquery makes ajax and effects a breeze.
@Nemorsa
If you know the basic about php, mysql then i will be prepared to help you if you like.
@EliteGM
you also learned some PHP out of our network age's ago ^_^
Way to go.. Ah shit!
Well I've got something to say anyway..
To the OP:
How good are you at PHP? Do you know OOP at all? That would really help you. Not many people make games via PHP, but it can certainly be done. I do think that's a good project to try some OOP. Trash the pre-made framework idea, IMHO, it's a diversion. You need custom classes anyway to localize the scope on certain variables, functions, and stuff like that. Also, OOP is meant to keep your code organized & easy to update. With a game, that's exactly what you want.
With most projects I'd suggest procedural programming, but in the case of games: OOP. Basically, separating code by classes turns a large project into a bunch of miniature projects within classes. When the time comes to update & improve, you'll probably just modify a class or two if you do it right. It makes development a bit easier for that reason.
I guess that's the point of a pre-built framework, too. The difference is, if you made the classes, you know & understand them more. You can also take a bit more pride in it, I think. Many opinions may differ, but you get the idea. :8:
Well i always use OOP it don't make sence to type everyting again in each file if you could add all in just one file or a few.
My knowlegde is quite advanced,
i am scripting about 3 years now in serveral web langueage's.
Started off with ;
HTML > CSS > XHTML > PHP > MySQL > Javascript > Ajax
and now i am starting off with Program development ;
VB.NET > C# > C++
Hope this is enough information for now.
it's hard to implement almost any game type for this basis. there are 2 possibilities at least, the game has to adapt the asynchronous timing of web-pages. however, if you are experienced of ajax, it gives you advantage of using a real-time presentation.
---------- Post added at 01:34 PM ---------- Previous post was at 01:17 PM ----------
also, include flash, and java.
Well you may have the wrong idea about the advantages/disadvantages of procedural programming vs object oriented programming. It's a very open debate, especially amongst professionals of PHP who started in versions 2-3. I started with PHP 4, but I talk to and *listen* to the higher-ups in my field~ just as a side-note.
Procedural Programming can always be better for performance, if you know what you're doing. OOP is meant to keep us organized.
You can avoid that with procedural coding pretty easily as well, actually. It's all a matter of functions & conditional statements before inclusions or code blocks.Quote:
Well i always use OOP it don't make sence to type everyting again in each file if you could add all in just one file or a few.
The best thing about OOP, (IMO), is that it helps keep everything from getting so cluttered. The big difference maker to me, is the local scope. Variables don't get as confused through OOP. Private instances, like variables/functions, are held only inside the specific class they're called. Nobody in the global scope, or even any classes connected to said class will have the right to talk to private instances. That means we can use a variable like { private $table='pageData'; }, in every class, and they can all be independent of one another. Also, protected instances are very useful as well.
Say for instance you have a class called 'MySQL_Connectors'. Inside that class, of course, you have a few 'private' variables and a 'protected' function called 'connect()', which takes the private variables like 'host', 'user', 'pass', and 'db', to connect, and can be used only within classes who extend 'MySQL_Connectors'. You can then have a few more protected functions that often get reused. Maybe make the 'connect()' function private, and create protected functions like 'load_assoc($query)', and 'load_row($query)'. Basically, those functions can run through mysql_query()->mysql_fetch_assoc()/mysql_fetch_row() automatically and simply spit out the array/variable needed. Or maybe take it a step further and create what I call, "Application Specific" functions, which are what they say: Specific to "said application". So you can say something like, {public function load_user_data($username,$password)}. Making it so one must enter username & password data in order to access any & all information on any user makes it a bit more secure.. At least until another function comes in and fucks that up for the rest of the application.. [Like one that leaks a MySQL injection through one of the other, 'protected' functions.]
For example, load_user_data() would utilize the load_row() function. load_user_data()'s job includes checking for MySQL injections *before* passing the query through to load_row() or load_assoc(). Just as it's job is to be secure, it could fail to do so and ruin the entire project.
I don't know how I ended up ranting & raving about OOP so much.. I love & hate the stuff...
Mostly, be aware of your surroundings, and try your best to use the best tool for the job, for the right reasons. :thumbup: