BobF

Members
  • Content count

    105
  • Joined

  • Last visited

About BobF

  • Rank
    Advanced Member

Recent Profile Visitors

1,073 profile views
  1. I prefer DigitalOcean, but if you want an even cheaper VPS then vultr.com offers a small VPS for $2.50/month that should be good enough for demo purposes.
  2. About game hosting

    You may want to check out Photon. I have not used them yet, but I probably will unless I decide to take the time to roll my own multi-player solution. You can make a one-time $95 payment that gives you 5 years of service as long as you stay under 100 concurrent users. That's a good price for what they provide, but once you need more than 100 CCU the price jumps to $95/month.
  3. Your use of an implicit return in an arrow function is invalid in both case 1 and 2. An implicit return in launch_player should look more like this: launch_player = (count) => count + 1; You can read more about using implicit returns with arrow functions here.
  4. Interesting idea! Out of curiosity, I tried to find ad space auctions on ebay but I didn't see anything. Maybe I wasn't searching for the right term.
  5. I suspect your first scenario is a tad faster because the JS engine does not have to look as deeply in scope to find the location of xSpeed as it does in the second scenario. The presence of xSpeed at the higher scope makes other variables at that same level a bit slower to find as well. But I agree with Matt, JS engine optimizations will almost certainly make any performance difference negligible. If update is the only function that references xSpeed then from the perspective of good design xSpeed should be declared within update.
  6. Experience with Photon Engine?

    I don't think I've ever seen anyone here mention that they use Photon. I have the feeling only a minority of people here are doing multi-player, and most of those seem to have rolled their own solution. I've looked at Photon with interest in the past and plan to take another look when I finally get around to adding multi-player capability. Photon seems pretty well established, and they run on Azure which should help with reliability and scalability. But Azure has also caused them a couple of bad outages which you can read about in their blog. I would enjoy rolling my own solution, and it would likely save money on monthly fees, but Photon is tempting since their turnkey setup should be solid and would save development time.
  7. Care must be taken when referencing "this" in a callback function because the value of "this" will likely not be the object you actually want when the callback is invoked. You can ensure the callback references the desired "this" object by using bind: canvas.addEventListener('mousemove', playerShootingModule.updateRotation.bind(playerShootingModule), true);
  8. You can't do anything like that because the JavaScript has to run in the browser, and the page hasn't even been delivered to the browser yet. The information you found stating ajax is necessary is correct (note that you could use jQuery's ajax since WordPress loads jQuery). Basically, you could write a simple PHP script that resides on your server and whose only job is to increment the game level value in the SQL database for a specified user. You would then add a bit of ajax code to your "storeNewData" function to call that PHP script. Note that you probably don't need ajax to read the game level from the database because the current game level value can be encoded directly into the page itself by your WordPress PHP code. You just need your JavaScript to write the game level to the database during game play, and you're on the right track in attempting to do that from storeNewData. Note that when using ajax to increment the game level, a clever user may dig through your JavaScript code and find the PHP URL used to do that. Without a deterrence, the user could conceivably use that URL to directly increment his game level without actually playing the game to do so. Just something to think about.
  9. Thanks. BlackMoonDev! One other question: Does Adsense for Games allow you to specify that you only want family friendly ads (i.e., no alcohol, no tobacco, no violent video games, etc)?
  10. Interesting. Is the ad revenue better than other ad networks you've tried? Have you found any significant advantages or disadvantages for HTML5 for Games that you can share?
  11. The browser provides your website's domain with a dedicated chunk of local storage that is shared by all of the pages on your site, including the Phaser game and the WordPress post (assuming they are in the same domain). So, somewhere in your game code you would have lines that look something like the following: localStorage.setItem('livesRemaining', player.livesRemaining); localStorage.setItem('currLevel', player.currLevel); Once that code has run within the game then the values will be shown in the game stats of your WordPress post (see my previous post) the next time the user loads that post in the browser. Note that some browsers may throw an exception when invoking setItem if private browsing mode is enabled or if cookies are disabled, so handle that situation. Also, browsers cap the amount of local storage available per domain, so stay under 5MB (2.5M characters) of data.
  12. I'm guessing your game's users don't have login accounts and you want to keep things simple. If that's the case then I would simply store lives, levels, and other user data in localStorage from within the game. Then you just need to include some JavaScript code with the DIV in your WordPress post to display that data. For example: <div id="game-stats"></div> <script> (function () { var statsDiv = document.getElementById('game-stats'); statsDiv.innerHTML = 'Lives remaining: ' + localStorage.getItem('livesRemaining') + '<br/>Current level: ' + localStorage.getItem('currLevel'); })(); </script> Some users may complain they don't see their stats and it will probably be because they have cookies disabled, they're in private browsing mode, or they cleared their browser history. I hope that helps.
  13. I think the "user-scalable" setting only works for mobile. Not all browsers are keen on allowing devs to disable an accessibility feature such as zooming, so you're probably going to have trouble finding a complete solution.
  14. WASM will be very useful for replacing chunks of high runner JS code that cause an app to become CPU bound. But beyond that I think JS will be preferable for most devs. Things to consider: C++ is *very* different from JS. Don't underestimate the challenges of things like memory and pointer management. C++ produces fast binaries, but it's also easy to hang yourself. Will there be an efficient means of debugging WASM code? If WASM code throws an exception will a usable stack trace be provided? Will WASM have access to the DOM? The internet? I'm glad WASM is available, but JS code will be more robust and maintainable, so I plan to be judicious with my use of of C++.