11 Oct, 2010, vuryal wrote in the 1st comment:
Votes: 0
Good afternoon one and all!

I've designed a game (www.katarra.net) that is browser based, text-only, and written in php4/mySQL backend.

I would LOVE to create a new game that still has the same features (turn-based, real-time chat, turn-by-turn combat, etc.) but in a more "modern" (a la easier) language.

I've looked at OOP/PHP5. Is that the way to go? What about Python?

All responses are appreciated!
11 Oct, 2010, David Haley wrote in the 2nd comment:
Votes: 0
Plenty of games and applications are written in PHP and plenty of games and applications are written in Python. You can write good code in both and bad code in both. Was there something in particular that was pushing you to switch even though you've already finished a project?
11 Oct, 2010, vuryal wrote in the 3rd comment:
Votes: 0
Upgrading from version 1 to version 2. Didn't know if there were new ways to write stuff that would make it more compiled and less "messy" coding.

I'm even considering redoing a new game based upon this code, just rewriting it.

It stems, though, primarily from the fact that I'm an intermediate PHP coder at best, and I've gotten to the point where I have to keep looking up stuff on how to code "this or that", whatever project I'm working on.

I'd like to keep learning things on my own, though if someone wanted to be "unbored" and help me out, that'd be cool too. (not asking for that, though, but if people are interested…)

My primary question was just if there is something that would make me learning more advanced stuff easier, such as a new language or making it run quicker (aside from getting a VPS).

11 Oct, 2010, David Haley wrote in the 4th comment:
Votes: 0
Well, no matter what language you choose, you'll still have to learn stuff, look things up, etc. Personally I find Python to be a nicer language than PHP, but of course if you don't know it yet you'll have to start over in terms of learning. Like I said earlier, you can write messy code in pretty much any language; code messiness is often a factor of the coder, not the language. :smile: The best suggestion I have there is to be disciplined and just try to write cleaner code.

As for running faster, changing languages probably won't really help you, at least not dramatically. You can speed things up by improving code and algorithms; my guess is that your algorithms/data structures are where slowness is coming from, not the language itself. A common example is using searching a list for a single object many times, instead of using a set data structure of some sort (that might use a BST, hash table, or something else).
11 Oct, 2010, vuryal wrote in the 5th comment:
Votes: 0
Alright, thanks!

Any thoughts on converting from PHP4 to something newer? Or just stick to PHP4?
11 Oct, 2010, David Haley wrote in the 6th comment:
Votes: 0
I would stick with what you know unless you have a compelling reason to change. You might want to try some Python (or any language) on the side to get a feel for it and see how you like it. You might find that you really like some other language, in which case changing might make sense. Just watch out for the "grass is greener" syndrome: make sure that you aren't preferring something just because it's different.

As for how you might actually rewrite the code, you can either try a literal piece-by-piece translation, which will probably be easiest but lose some of the gains. A harder approach, but better in the long run (probably), is to rewrite it from scratch having learned what you've learned. Just make sure you know the target language before you do this, or you will end up writing messy code as you learn that you will have to fix later.
11 Oct, 2010, vuryal wrote in the 7th comment:
Votes: 0
Cool, thanks a lot!
11 Oct, 2010, Runter wrote in the 8th comment:
Votes: 0
Considering you're using php I can certainly understand wanting to switch. I think saying python is nicer than php is an understatement. That being said I agree with david and the notion that your code is probably the source of the problem. Not the language. Often times elegant and easy to read code is near-optimized code. So I suspect both of your problems are related. Or at least once you're writing better code some of these problems disappear. I won't discourage you from learning many languages, though.
11 Oct, 2010, vuryal wrote in the 9th comment:
Votes: 0
I'm getting a book on OOP/PHP5. I'm hoping that can help me clean up some stuff.

I've never experienced python, but I wanted to create a game that can be played using a browser and not telnet in.
11 Oct, 2010, David Haley wrote in the 10th comment:
Votes: 0
PHP is likely to be faster than Python for web server applications because more servers have it built-in. If you use Apache, make sure you use mod_python (mod_php more or less comes by default) – it embeds Python directly into the server so that it doesn't have to start up separate processes each time, which can make a very big difference for performance.

Note that if you're using a browser as a client, you could be writing a game in one of several ways…
- a Flash/Silverlight client
- standard HTML that talks to a web server using CGI
- HTML that talks to a web server using AJAX (a JavaScript tool)

In most cases, there will be a mix of programming language involved, for example Javascript in the browser and something server-side to implement the CGI.

You might also consider Ruby, Lua, or even something like Java. Java is heavier and harder to deploy on a web server, though, and usually requires a fair bit of extra stuff like Tomcat. Regardless of the language you choose, it will be very useful if you either have control over the web server in question (to install modules like mod_python) or have a system administrator who is friendly to requests for installing stuff.
13 Oct, 2010, JohnnyStarr wrote in the 11th comment:
Votes: 0
Like David was saying, AJAX is probably a must for your site.
Also, I would consider making your commands non case sensitive, having to type "Who" instead of just "who" is sort of
annoying as far as long term. My only other suggestion would be to allow the user to hit the return/enter key to send
instead of having to click submit each time. There is a simple javascript for that you could add to "onclick".

Other than those two things, I really like your idea.
05 Sep, 2012, Shaitan wrote in the 12th comment:
Votes: 0
You may be best off sticking with what you know, there will be a big time investment in learning something new.

Having said that… I've been having a good experience using Ruby on Rails for my early stage mud at apathydrive.com.

The Rails' MVC pattern helps me keep things organized. I'm also using websockets via the websocket-rails library which lets my mud feel like a telnet mud.

If you do decide to dive into learning something else there would be worse options than Ruby. It may even help you better organize your PHP code in the future.
05 Sep, 2012, JohnnyStarr wrote in the 13th comment:
Votes: 0
Shaitan said:
You may be best off sticking with what you know, there will be a big time investment in learning something new

I would have to disagree with this assertion. In fact, I think that learning multiple languages / frameworks will only
aid your efforts. Learning the basics of web development is the most important part. Design patterns like AJAX are
available using these same basic web components. The same can be said for Ruby, PHP, .Net, etc. Of course, that doesn't
mean that you shouldn't choose the right tool for the job.

By just sticking with "what you know", you might be limited. For example, if you decide to use long polling, PHP may not be your friend.
05 Sep, 2012, Runter wrote in the 14th comment:
Votes: 0
It's great to learn cool stuff, but it's even better to balance learning cool stuff with building cool stuff with what you've learned.
06 Sep, 2012, plamzi wrote in the 15th comment:
Votes: 0
I <heart> node.js since last Tuesday. Still love PHP, but my heart is big.

My next project is very similar to yours, with the main client being an iOS app (but a browser app is inevitable).

Wish you luck no matter what stack you choose.
17 Sep, 2012, Deimos wrote in the 16th comment:
Votes: 0
@JohnnyStarr: Why would PHP be any worse than any other language with respect to long-polling?