Hi there! The method you use depends on you, how your app is built and the frequency new data needs to be exchange between the clients and the server.
I made a couples of games, chat and other apps with APE. I usually use the method you’re describing: using PHP for the game logic and APE to propagate the changes in real time, an example is one of my turn-by-turn game. Why PHP in the case? Because it’s simpler. PHP already knows everything about the users, the system, the database, etc. It’s simpler for me to write the game engine in PHP, update the HTML completely using AJAX and use APE to tell the other user that the game need to be updated using AJAX. In that case, it works great as there’s only two player per game, no more than 5 games at the same time and maybe one update every 30 seconds. If you’re planing of having more traffic or more frequent updates, as with a multiple user chat system, having APE handling the server-side logic is a way better design. For a multiuser chat for example, you can have more than one message per second distributed to dozen of clients. You don’t want 20 clients asking PHP for the same info for every messages every second, resulting in 20 query every second (Been there, done that. BAD IDEA). Even using PHP only for the one sending the message (1 query every second) can lead to problems because the PHP server may or may not handle that much informations. It may also crash your entire website (Been there, done that…). APE server on the other hand can do it and shouldn’t slow down in the process (Assuming the server side code is well written). tl;dr depending of your traffic and number of request per minute, PHP may be ok for you :) - Louis > Le 2015-04-26 à 13:36, Sándor Volenszki <[email protected]> a écrit : > > Why php? Good question. > > I need to store some data in database and I get some data from database. But > if I am sure, APE also can handle database. > > In any case I will rethink the controller (the game logic), can you help me > with some information about how to send data to APE insted of sending to php > with AJAX request? > > Thank you for your opinion and your help! > > 2015. április 26., vasárnap 19:26:58 UTC+2 időpontban Nicolas a következőt > írta: > It is more direct this way. But of course, you need to program your game > logic in Javascript. I do it without any problem. The only think I had to do > (after realizing it 3 years later) was to recompile APE with a bigger memory. > Indeed, the basic APE can't handle more than 70,000 arrays and it was a > limitation for me (then it crashed without notice!) > > > > On Sunday, April 26, 2015 at 7:25:23 PM UTC+2, Nicolas wrote: > Hi, > > I suppose it works like this, but why use PHP for the game logic? > > On my board gaming platform (www.happymeeple.com/en/ > <http://www.happymeeple.com/en/>), the game logic is on the APE server side > too. So when a user makes a move, he sends the information to APE directly, > which sends relevant information back to him and the other players. > > Good luck with playing with APE! > > > > On Sunday, April 26, 2015 at 7:05:03 PM UTC+2, Sándor Volenszki wrote: > Dear All! > > Today I am very happy with APE Server, finaly I did all the configurations > and started the joyfull play with it! :) > > In an hour I sketched up a HTML5 board game, and in 6 more hours, I made it > operable. It's not perfect, but functionally sufficient. > > After a few tests I started to theroize, did I realy used all the facilities > of APE in my project, and now I want to know, what you think! > > What I did: > > I made a HTML5 boardgame for 4 players. > When the game started, and a player click on the board, then a jQuery AJAX > request interact with a php file, to make the game logic. > After the php finished, with inlinepush I return data to all 4 payers, and in > each client with jQuery I make all the neccesary changes. > > Is this a correct way to use APE in HTML5 app, or I need to learn more? > > Thank you for your opinion in advice! > > Sandor > > -- > -- > You received this message because you are subscribed to the Google > Groups "APE Project" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/ape-project?hl=en > <http://groups.google.com/group/ape-project?hl=en> > --- > APE Project (Ajax Push Engine) > Official website : http://www.ape-project.org/ <http://www.ape-project.org/> > Git Hub : http://github.com/APE-Project/ <http://github.com/APE-Project/> > > --- > You received this message because you are subscribed to the Google Groups > "APE Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- -- You received this message because you are subscribed to the Google Groups "APE Project" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ape-project?hl=en --- APE Project (Ajax Push Engine) Official website : http://www.ape-project.org/ Git Hub : http://github.com/APE-Project/ --- You received this message because you are subscribed to the Google Groups "APE Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
