Welcome to Dream.In.Code
Become an Expert!

Join 149,609 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,874 people online right now. Registration is fast and FREE... Join Now!




Browser-based RPG design choices?

 
Reply to this topicStart new topic

Browser-based RPG design choices?

viZion
26 Sep, 2007 - 08:14 PM
Post #1

New D.I.C Head
*

Joined: 26 Sep, 2007
Posts: 3


My Contributions
Hello,

I've decided to start writing a game just for the fun of it and to learn more PHP. I just can't learn by coding something I don't like. Anyway, I'm not a complete n00b (but pretty close I think). I've already created an online puzzle contest in PHP and MySQL with most of the code written from scratch. I've been looking at the source code for a bunch of different games like Dragon Knight, Legend of the Green Dragon, phpRPG, etc. I now have a good idea of where to start but I still need some opinions on these questions:

1) Just about all of these games are coded in PHP 4 and MySQL 4. I learned PHP 5 and MySQL 5. I've already learned that a huge difference between MySQL 4/5 is that MySQL 5 won't accept empty default NOT NULL fields. What are the differences I should be looking for from PHP 4 to 5? I don't want to use an idea from one of these old games and have it be the "wrong" way to do things in PHP 5.

2) Is it better to set up a template system or to just each script have its own HTML? Which is faster? What are the advantages and disadvantages of each style?

3) Is it worth using a lot of object-oriented PHP? Will it just make things needlessly complicated? I'm really interested in building the game for speed.

4) I'm planning to add an AJAX chat system. Is there anything else that AJAX might be useful for? I'm going for simplicity. There will be images and not just text but simplicity is still the key for me. I'm not looking to create anything like Nowhere Else and Beyond. For reference, I'm a grizzled 2+ year veteran of Kingdom of Loathing and that's the level of simplicity I'm looking for from the interface.

That's it. Any help you guys can provide would be appreciated.
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Browser-based RPG Design Choices?
26 Sep, 2007 - 10:25 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,655



Thanked: 313 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
1. There are several differences from PHP4 to 5. So many in fact that they recommend everyone look over their PHP4 scripts after converting to 5 to make sure nothing is broken. PHP5 does create a lot of structural language changes to be more in line with an object oriented approach including adding full constructors / destructors, adding interfaces and allowing them to restrict class usage, the ability to add set and get property "magic" methods and the introduction of new extensions / classes. That is in addition to a slew of ordinary upgrades and modifications.

This is not to say that all PHP4 scripts will break when going to 5, but there is significant changes which can affect your scripts.

2. Templates are usually a good idea for any system, not just a game. However the problem with a template is that if you make a mistake you have to usually correct several templates or templates which have been inherited from those bad templates. Sometimes they are a bit overboard with smaller streamlined games which you seem to want to make. The custom HTML pages are typically a nice dirty and cheap way of doing things, but down the road they can get tedious to upgrade and you will find yourself having to repeat an update over and over again for each "custom" page.

3. I always use moderation when it comes to developing object oriented projects in PHP or any web scripting language. Sometimes they are great for nice concrete things, adding design patterns etc. But not everything needs to be an object or contained in an object. Sometimes that nice little time difference function just needs to sit in an include file for later reuse.

4. AJAX is heating up in the PHP gaming market but at a slower pace than what some people would like simply because the good games out there were built in a more legacy code way and not very flexible to accept AJAX. You can certainly use it for different things than just a chat system. You could use it for minimap features, drag and drop weapons or armor to and from units, and even create somewhat animated game play with it.

I hope you find the tips useful in the future. Enjoy! smile.gif
User is offlineProfile CardPM
+Quote Post

girasquid
RE: Browser-based RPG Design Choices?
26 Sep, 2007 - 10:31 PM
Post #3

Barbarbar
Group Icon

Joined: 3 Oct, 2006
Posts: 1,294



Thanked: 18 times
Dream Kudos: 725
My Contributions
QUOTE(viZion @ 26 Sep, 2007 - 09:14 PM) *

2) Is it better to set up a template system or to just each script have its own HTML? Which is faster? What are the advantages and disadvantages of each style?


In my opinion, it's better to set up a template system. That way, your PHP code and your template code won't be intermingled; if you encounter an issue within your login template or something that needs to be changed, you won't have to go through your PHP code at all(which will reduce the risk of you accidentally breaking something in your PHP while fixing your template - I've done this before, and it sucks), you'll just have to open up your template file and make the tweak there.

If each script just has it's own HTML, you'll probably be able to add things on faster; you won't have to worry about the template or building a new one or anything, and you'll just be able to write the code and the HTML together, without needing to worry about remembering how the two are connected when you create your template file. That's about the only advantage to that approach I can think of, though.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 12:07AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month