Game Development & Artificial Intelligence With PHP Game Development & Artificial Intelligence With PHP php php

Game Development & Artificial Intelligence With PHP


Yes, PHP is Turing complete, so in theory you can create any kind of application you desire. It doesn't mean you should, though, and there are far more suitable tools out there.


While it is possible to implement Artificial Intelligence and Games in PHP it's not optimal to do so. PHP is designed for effective Server Side web programming and as such isn't the most optimal platform to be developing Artificial Intelligence and Games on.

That said, it also depends on how you define AI, if you mean games that have AI again, it's possible but not optimal.

Programming languages are a way to express a concept, different languages are better at expressing different types of concepts. For PHP it's very good at expressing online server side scripting concepts, however it is less suited to expressing concepts like Video Games compared to more general languages such as C, C++, Java, C#, etc... (There are far more, this is just a shortlist)

If you really want online games you should consider Java which has excellent web integration while providing a better medium for creating games.


I know there was a marked solution, but here's some more links that will be very useful.

http://ann.thwien.de/index.php/Main_Page

http://neuralmesh.com

http://www.tremani.nl/open-source/neural-network

There actually has been more work with AI using PHP than most people realize and it is quite possible. The neuralmesh.com site spoke about a Connect 4 game and how the computer got smarter the more games it played (though they don't provide any kind of live demo of that game, they do have a demo of their system which looks very finished off and nice).

I'm not going to say that PHP is the most efficient language to be doing this in...I would suspect C++ or Java to be much better alternatives if you aren't exactly on board with jumping into PROLOG or LISP, but there's also FANN which is a library for neural networks and has bindings for various languages (including PHP, but it doesn't seem to work with PHP 5.3 and appears to no longer be maintained, but I'm sure it's still great for other languages).

However...I am going to say that it's not a dumb idea to create AI using PHP or some sort of simplistic neural network. The reason being is that the internet really accounts for a lot of our computer usage these days. In fact, most people probably wouldn't have much need for a computer that didn't connect to the internet. So when you realize that and realize that PHP is one of the most popular and easiest to learn and free and all the other benefits....It's a pretty common "go to" language.

It's funny that people like to say how "slow" PHP is, but we've already taken care of that issue. Computers today are much much faster and we can network them. Also, people still think of PHP 4 when they say it's slow. They don't even know about PHP 5.3 or the new features and speed increases. Imagine a distributed database for your neural network in "the cloud." Think of how much of a benefit that is for holding data and even processing it (even if it's less efficient, hardware is cheap). Now think about how fast you can set that up using PHP compared to some other language. Some other language where you'd either pray to find all the libraries needed to even connect to the internet, let alone actually getting the data and then displaying data to the user in such a convenient way as a web browser.

What if you don't want the end user to download and install anything?

Anyway, you get the idea, I'm not going to go on with it...But it's definitely not absurd to think about something like this for PHP.

Again, this also depends on what you're going to do with your "AI" if it's to play a simple Connect 4 game...or Battleship...or chess. Then you train it for a bit (the long processor intensive part) and then you're (mostly) done. So it doesn't really matter what language you're using.