Fengist's Forum Posts

  • Not sustainable? Bill Gates and Steve Ballmer made their money before all this rental bullshit and they are worth about $160,000,000,000 And that's just the top 2 guys.

    Correct. And how many versions of Windows and DOS have we had to purchase? I started on PC's with DOS 3.0. The MS guys also had something that Scirra doesn't, a virtual monopoly on OS's that started with IBM. Scirra is facing a market saturated with programming IDE's.

    The problem with the one-off model in a saturated market is that you have to WAIT for someone to WANT your product in order to make money off of it. In my occupation it's called the "break-fix" model. I have to wait for you to break it before I can fix it and charge you gobs of money doing so. The HUGE problem with that is, I never know if I'm going to be able to feed my self next week because I have no steady, consistent income. IF you have a monopoly on your product and do great marketing like DOS and Windows then yea, you'll make gobs of money just like they did. IF you're in a competitive market and you product or service isn't the only one out there, you have no idea if your business will be open next week or if you'll be sleeping in the gutter. That's ESPECIALLY true if you're a small indy company working in a garage (gee, I think Bill and Steve did that) with no financial backing.

    I for one have no problem with the subscription model. Ashley and Tom gain the confidence that their business is stable enough that they can hire more employees to give an even better product and even better service.

    A few years ago when I first purchased C2, you rarely saw any Scirra member on the forum. I'd post an issue and never get an official response. Now? I see them on here daily solving problems for their customers. THAT's the difference I'm willing to invest in.

  • Switching to c3 can be a solution for some users, for others this is not an option, c3 is a service with quite limited payment options, it is not a product like c2.

    For the same reason you can't buy Microsoft Office as an installable product any more. You have to 'rent' Office 365. It's not a long-term, sustainable method of income. I still see customers come into my computer repair shop running Office 2007. That's 12 years of using a product that needs to pay employees to keep it fixed and updated while making only one payment. The cost of maintaining such software over the long-haul exceeds the income of a one-time payment system.

    Get used to it. Windows as a service is coming.

  • Oh... I see what you're trying to do. You're trying to pass POST parameters to a URL AND open that page in the browser so that you can add the scores and player info.

    I don't even know if that's possible. You may be able to do that by opening the page in an IFrame inside the game but I've never attempted to pass a query that way.

    My initial thoughts would be to incorporate the save_score.php form into the Construct project and then pass the data from that form to a php that adds the data to the MySQL database via Ajax and either returns a success or failure.

  • OK This is a working version:

    Suggestion. Either use real_escape_string before doing a query

    php.net/manual/en/mysqli.real-escape-string.php

    or use the PHP prepare:

    php.net/manual/en/mysqli.prepare.php

    I realize this was just a basic example but it's a good habit to present even when demonstrating the basics.

  • Ajax is your only real option for working with PHP. The Browser go to url is designed to open web pages, not pass query strings with Get or Post.

    Go to URL

    "Navigate to a given URL. Note this uses the same window/tab as is showing the HTML5 game, so this action will end the game. The Target can be used to select which frame to redirect, which is only useful if the game is displayed within a frame (e.g. an iframe embed), and the frame has permission to redirect the parent "

    Here's the basic PHP CORS header that I use. It attempts to get a HTTP_ORIGIN from several possible sources. It then compares that origin to two URI's I have plugged in and accepts incoming AJAX requests from them (the host website and the preview editor). I modify this to whatever use I need and then 'include' it in any PHP files I'm making for the current project.

    A lot of people will simply put in:

    header("Access-Control-Allow-Origin: *");

    which allows anyone and everyone to access the php file. Since this is for a game and people will find ways to cheat/hack, this solution keeps that under control while allowing it to be expandable to more than one requester.

    The Allow-Methods describe what the AJAX requester can or cannot do. In my example, they can GET. You can find other options here:

    developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods

    Another thing it does is creates a small txt file in the same directory with the URI of the last request that came in. That way, you can test it from different sources and see what the origin is.

    error_reporting(-1); // reports all errors
    ini_set("display_errors", "1"); // shows all errors
    ini_set("log_errors", 1);
    ini_set("error_log", "php-error.log");
    
    $http_origin = NULL;
    if (array_key_exists('HTTP_ORIGIN', $_SERVER)) {
     $http_origin = $_SERVER['HTTP_ORIGIN'];
    } else if (array_key_exists('HTTP_REFERER', $_SERVER)) {
     $http_origin = $_SERVER['HTTP_REFERER'];
    } else {
     $http_origin = $_SERVER['REMOTE_ADDR'];
    }
    
    $myfile = fopen("origin.txt", "w") or die("Unable to open file!");
    $txt = $http_origin;
    fwrite($myfile, $txt);
    fclose($myfile);
    
    //No origin found, die gracefully
    if (!isset($http_origin)) {
     die();
    }
    
    if ($http_origin == "https://preview.construct.net" || $http_origin == "https://www.mywebsite.com") {
     header("Access-Control-Allow-Origin: $http_origin");
     header('Access-Control-Allow-Methods: "GET"');
    }
    

    One of the handiest things you can do when working with AJAX is to run in debug mode and keep watch on the Ajax.lastdata. That will show you the last information sent back by the website you're making requests to.

    Ajax and CORS is designed to limit who has access to the PHP file. If you're going to be transferring data via GET or POST, and then stuffing it into MySQL, which is very susceptible to injection and cross site scripting, you really want to know and limit who's accessing that PHP file.

    A quote to live by:

    "Writing software is easy. Making it idiot proof is nearly impossible."

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's either giving that or a 500 error.

  • I just rebooted both web servers, hopefully that will help in the short term.

    Seems it always goes nuts later in the UK evening. Just started this:

    Critical error

    This should not of happened. Please contact support.

    System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at C3.Code.Controls.Application.Caching.Redis.PubSub.PubSubController.OnSubscribed(RedisChannel channelName) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Redis\PubSub\PubSubController.cs:line 58 at C3.Code.Controls.Application.Caching.Redis.PubSub.PubSubController.SubscribeToCacheKey(RedisChannel cacheKey, Action`2 onMessageReceived) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Redis\PubSub\PubSubController.cs:line 46 at C3.Code.Controls.Application.Caching.Manager.Manager.Callbacks.OnGotten[T](String cacheKey, CacheType fromType, T objectGot) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Callbacks.cs:line 99 at C3.Code.Controls.Application.Caching.Manager.Manager.Get[T](String key, Func`1 getFromExternFunction, Boolean skipLocalCaches) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Manager.cs:line 136 at C3.Code.CachingNew.Get.ByID[T](Object objectID) in C:\Construct.net\Source\C3Alpha2\Code\CachingNew\Get.cs:line 118 at C3.Code.Helpers.SystemMessages.Reports.CreateSystemMessage(String title, String reportData, MessageType messageType, String ipAddress, Int32 cap) in C:\Construct.net\Source\C3Alpha2\Code\Helpers\SystemMessages\CreateReport.cs:line 41 at C3.Code.Helpers.Error.Functions.RecordError(Exception exception) in C:\Construct.net\Source\C3Alpha2\Code\Helpers\Error\Functions.cs:line 75 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  • > So, in my tests, bounce disabled made no significant difference.

    That's because you also have Pathfinding behavior with obstacles=solid and regenerating map on every tick.

    Originally, that project was a response to this thread:

    construct.net/en/forum/construct-3/how-do-i-8/artificial-intelligence-145117/page-2

    The pathfinding regeneration was added because the end user can right click to drop blocks with the solid behaviour as the test was running. It was just meant to be a crude example and I likely forgot and just left it in there. Thanks for helping define this problem though.

  • We identified performance degradation linked to the roll out of the new arcade (namely from significant increase in visitors including web crawlers). In response we've taken a few steps to significantly improve performance, and are upgrading our webservers to add additional capacity. From what I'm measuring, everything should be running a lot smoother now.

    It's back again.

    Critical error

    This should not of happened. Please contact support.

    System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at C3.Code.Controls.Application.Caching.Redis.PubSub.PubSubController.OnSubscribed(RedisChannel channelName) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Redis\PubSub\PubSubController.cs:line 58 at C3.Code.Controls.Application.Caching.Redis.PubSub.PubSubController.SubscribeToCacheKey(RedisChannel cacheKey, Action`2 onMessageReceived) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Redis\PubSub\PubSubController.cs:line 46 at C3.Code.Controls.Application.Caching.Manager.Manager.Callbacks.OnGotten[T](String cacheKey, CacheType fromType, T objectGot) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Callbacks.cs:line 99 at C3.Code.Controls.Application.Caching.Manager.Manager.Get[T](String key, Func`1 getFromExternFunction, Boolean skipLocalCaches) in C:\Construct.net\Source\C3Alpha2\Code\Controls\Application\Caching\Manager\Manager.cs:line 158 at C3.Code.CachingNew.Methods.GetCachedHashSet[T](String cacheKey, Func`1 getFromExternFunction) in C:\Construct.net\Source\C3Alpha2\Code\CachingNew\Methods.cs:line 115 at C3.Code.Caching.SystemMessages.MessageReportIDs.OnNewReportCreated(MessageReport newReport) in C:\Construct.net\Source\C3Alpha2\Code\CachingNew\SystemMessages\MessageReportIDs.cs:line 31 at C3.Code.Models.SystemMessages.MessageReport.PostCreated(DBContext db) in C:\Construct.net\Source\C3Alpha2\Code\ModelsNew\SystemMessages\MessageReport.cs:line 72 at C3.Code.BaseClasses.CachingNew.DatabaseBackedCachableModel`2.OnCreated(DBContext db, T newRec) in C:\Construct.net\Source\C3Alpha2\Code\BaseClasses\CachingNew\DatabaseBackedCachableModel.cs:line 217 at C3.Code.BaseClasses.CachingNew.DatabaseBackedCachableModel`2.CreateNew(DBContext db, T2 newRec) in C:\Construct.net\Source\C3Alpha2\Code\BaseClasses\CachingNew\DatabaseBackedCachableModel.cs:line 202 at C3.Code.BaseClasses.CachingNew.DatabaseBackedCachableModel`2.CreateNew(T2 newRec) in C:\Construct.net\Source\C3Alpha2\Code\BaseClasses\CachingNew\DatabaseBackedCachableModel.cs:line 209 at C3.Code.Helpers.SystemMessages.Reports.CreateSystemMessage(String title, String reportData, MessageType messageType, String ipAddress, Int32 cap) in C:\Construct.net\Source\C3Alpha2\Code\Helpers\SystemMessages\CreateReport.cs:line 67 at C3.Code.Helpers.Error.Functions.RecordError(Exception exception) in C:\Construct.net\Source\C3Alpha2\Code\Helpers\Error\Functions.cs:line 75 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

  • dropbox.com/s/qi2o2hzl5aji851/BulletAndSolid.c3p

    Much more refined than mine and the same results. Thanks for 'cleaning up' my test ;). My old laptop hit 5fps before 1000 ants.

  • Do you have "Bounce off solids" set in Bullet behavior? I can reproduce the same issue, but only when I set Bounce off solids=yes for ants.

    So it looks like a bug, I'm guessing Bullet still tries to check collisions with disabled solids.. (or rather it checks if Solid is enabled 300*300=90000 times per tick)

    EDIT: Ashley Here is my project, at ~1000 ants fps drops below 10. But if you remove disabled Solid behavior, it runs at 60 fps with 3000 ants.

    https://www.dropbox.com/s/qi2o2hzl5aji851/BulletAndSolid.c3p?dl=0

    I did have bounce enabled. So, disabled it and ran the tests again.

    Test 1: 17ms per tick w/3000 ants. 0 collision checks.

    Test 2: 22ms per tick w/3000 ants. 26,548 collision checks per tick which didn't change from 0->3000 ants!?

    I saw peaks of 1.5+ million checks per second.

    Test 3: 95ms per tick w/500 ants. 0 collision checks. Still the huge lag even with solid disabled.

    Test 4: 62ms per tick w/300 ants. 300,000 collision checks per tick witch hit the 5+ million/sec mark

    So, in my tests, bounce disabled made no significant difference.

  • Performance could well depend entirely on the specific events you're using, but unless you share an actual project file nobody can see that.

    twistedvoid.com/c3examples/collision1/Collision1.c3p.

    Do note there are some extra sprites and some checks for those sprites in the ant's wondering routine. I started with another test I created and just couldn't be bothered to remove them. But, because those checks are in all of the tests it still should provide a comparable baseline.

  • If you're running Windows ctl-alt-del and bring up task manager. Select the performance tab. Keep a watch on the charts as your app runs. If you're seeing some wild spikes in say disk activity or cpu usage, then it's likely a background process causing the stutter or even the browser itself.

  • One of the things I paid attention to while creating this test was collision checks when running in debug mode.

    In the first test with no 'solid' object to collide against, it still peaked at around 180 collision checks per tick. So, even though there was nothing to collide against, it still performed collision checks. I thought this was caused by the anthill which had 0 behaviours but enable collisions was ticked on. So, I set it's collisions enabled to false on the anthill and still got the 180 collision checks. No idea what it's checking collisions for.

    The second test, with just 20 blocks with solid behaviour... get this... 90,000 checks per tick at ~3000 ants. That was over 3.5 million checks per second. With collisions disabled on the block sprite, 0 collision checks.

    The third test... boggle... ZERO collision checks. I ran this test also with the collision enabled set to false and, as expected, zero collision checks and it ran smoothly. So even though it's saying zero collision checks, apparently it still is.

    The fourth test, expected but not this big, 500,000 collision checks per tick at peak. That's 1,666 collision checks per tick, PER ANT, 7.5 million per second. And, I ran this with collision disabled and it too has zero collision checks and ran smoothly.

    I ran one other test with the solid behaviour disabled on the blocks and, this was kinda unexpected but expected, zero collision checks.

    I'm pretty sure my test is accurate. I can't explain why the ants with solid disabled caused such lag but the block sprites with solid disabled didn't. My only guess is, that in the second test there aren't enough block sprites to make a visible difference. If you notice in the third test, it seems to run ok till ~100 ants are running around before the lag starts to hit.

  • No difference between tests 1 and 2 on my laptop, all the way to 3000 ants

    With solid behavior added to ants, things do deteriorate pretty quickly.

    Did you try running it with MS Edge? On my 8 core AMD in Chrome there was like a 3-5 ms drop in performance between the first and second but it stayed around 17ms. Running Edge... wow... it sucked.