Nepeo's Recent Forum Activity

  • The "drawing canvas" plugin is implemented in "WebGL". Whereas Chart.js uses the "canvas 2D" API. Both WebGL and canvas 2D utilise the HTML Canvas element, but in different modes. You cannot use more than 1 mode with a canvas, or swap between them.

    As such the best way to use Chart.js would be to create a second canvas for your chart and float it over your game. There are several core plugins ( button, iframe ) that use this technique with HTML elements.

    The example that Chart.js gives has the canvas within the HTML file, and then uses JS to get a reference to the canvas. Instead of this you can create a new canvas element with JS and insert it into the document programmatically. I've adjusted the example to demonstrate how you can do this.

    // create the html <canvas> element
    var canvas = document.createElement('canvas');
    // set the size of the <canvas> element
    canvas.width = 400;
    canvas.height = 400;
    // insert the <canvas> element into the <body> element
    document.body.appendChild(canvas);
    // set the canvas to "2D" mode and get the rendering context from it
    var ctx = canvas.getContext('2d');
    // create the chart using the rendering context
    var myChart = new Chart(ctx, {
     type: 'bar',
     data: {
     labels: ['Red', 'Blue', 'Yellow', 'Green', 'Purple', 'Orange'],
     datasets: [{
     label: '# of Votes',
     data: [12, 19, 3, 5, 2, 3],
     backgroundColor: [
     'rgba(255, 99, 132, 0.2)',
     'rgba(54, 162, 235, 0.2)',
     'rgba(255, 206, 86, 0.2)',
     'rgba(75, 192, 192, 0.2)',
     'rgba(153, 102, 255, 0.2)',
     'rgba(255, 159, 64, 0.2)'
     ],
     borderColor: [
     'rgba(255, 99, 132, 1)',
     'rgba(54, 162, 235, 1)',
     'rgba(255, 206, 86, 1)',
     'rgba(75, 192, 192, 1)',
     'rgba(153, 102, 255, 1)',
     'rgba(255, 159, 64, 1)'
     ],
     borderWidth: 1
     }]
     },
     options: {
     scales: {
     yAxes: [{
     ticks: {
     beginAtZero: true
     }
     }]
     }
     }
    });
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Unfortunately the consent SDK doesn't actually store if the "ad free" option has been chosen. While we could pass through through the response immediately after the user has chosen "ad free" we can't pass through that value on subsequent runs. Additionally there is a slight frustration that you cannot display the dialog outside of the EEA, I filed a request with the Admob team quite some time ago about this but they haven't responded. So if you wanted to offer an "ad free" option outside the EEA you would need a separate flow. Which is frustrating, the option is mostly exposed because the SDK offers it...

    But if you did want to use it I would say the best route would be to initially check if the user has paid for ad free, or whatever restriction you've decided on. If they haven't check what the user personalisation state is. This should be loaded before the runtime starts, so the only ways it could be "UNKNOWN" are if the user consent hasn't ever been shown or if Ad free was selected. So show the user consent dialog, once it's completed the "Configuration complete" condition will trigger. If the value is still "UNKNOWN" then they chose the "ad free" option.

  • The option basically allows for a "pay for no ads" model in your app. When the user consent dialog is shown ( European Economic Area only ) it will contain the "ad free" option if you have enabled it. When selected by the user it sets the user personalisation state to "UNKNOWN" which prevents adverts from being shown.

    It's up to you as a developer if you want to offer an ad free option and what the restrictions are.

    EDIT: the documentation could probably do with updating... I'll put it on the TODO list.

    In R156 we have updated the Mobile Advert plugin on Android to use version 18 of the AdMob SDK. This change is due to hit the stable channel soon, and after talking to a few confused users I wanted to clarify a problem they have been experiencing.

    With this update to the SDK comes the requirement that the AdMob App ID must be specified at build time. To comply with this it is now required that you specify your Android App ID in the Mobile Advert plugin properties. If you do not specify it the project will fail to build ( this may change ) and if you choose an invalid value for your app ID the application will be crashed by the SDK on startup.

    Edit: For reference your "Admob App ID" is not the same as the value you use with Google play known as the "app ID" or "package ID". The sample ID that admob gives is "ca-app-pub-3940256099942544~3347511713" so it should resemble that. Admob provides this support article on finding your Admob app ID.

    Some of you will be using the "Configure" action to set up the plugin, while it is not marked as so yet this is effectively depreciated going forwards. The plugin will perform this step for you at start up if the application ID is specified. I know some people have been using this to avoid showing the user consent dialog to users immediately, if you want to avoid this then you can change the "Locations to show user consent dialog" property to "nowhere" and call the "Show User consent dialog" action when you wish to trigger it.

    Versions prior to r156 are not affected by these changes and will not be changed by future revisions. For those of you also building for iOS we haven't updated the SDK version on iOS yet, but it will have a similar requirement once we have. Once the update for iOS is completed it will not affected releases of construct prior to that update being published.

    We intend to add additional checks to the editor to improve the experience around this going forwards, but this will occur during the next beta cycle.

    You can read about the change to the Admob SDK here. If you have any issues with the change, or questions then let me know.

    Edit: on the first of July we updated the build server to give a more descriptive warning if your application ID is absent. This will only warn you if it is absent, not if it is invalid. Additionally we resolved an issue where iOS builds did not work unless the Android App ID value was specified.

    Tagged:

  • Please check again now

  • You can already expand/collapse blocks by selecting the arrows in the gutter bar on the left. If you are next to an open { you can press Ctrl+q or Cmd+q on MacOS to toggle the fold.

    I may also add a context menu option for this as well, but it would only work if the cursor is next to the opening brace at the moment.

    Folded code will be unfolded when you click away from event sheet script blocks, as we convert back to a basic text representation in this situation for performance reasons. You can't collapse a whole event sheet script block at the moment but I think this is something we will do in future.

    Text editor views won't clear fold state when you click away, but you will find code unfolded when you close & reopen files.

    Please add an item on the feature tracker if it doesn't exist yet. At the moment you can probably edit existing files with an external editor just by opening them with that editor. I'm not sure if we have a mechanism for auto reloading files that change on disk though, so you might want to ensure the project is closed in C3 when your editing it.

  • I'm not familiar with how construct resolves variables, as I haven't worked directly on that code, but language design and compilers are a bit of a hobby of mine so I can probably cast some light on it. I will say the performance cost is probably negligible, it's rarely an optimisation that is worth thinking about in most languages as well laid out code tends towards the more optimal version anyway.

    Short answer: it will either have no difference, or it will be faster the closer the variable is to the current scope.

    Long answer: Event sheets are basically interpreted like a scripting language. They have some rather unique specialisations and optimisations, but for this example we can consider them the same. Resolution of variables in an interpreter typically involves walking from the current scope to the top scope while searching for a matching variable name. The closer to the current scope it is the less scopes need to be checked and the less work needs to be done. However, it's more common for an interpreter to resolve the location of a variable before beginning code execution and store it for later. So instead of searching for the scope which contains the var on each get/set it know which scope contains it, and hence can modify it straight away. In that situation there is basically no performance difference between scope levels.

  • Your correct that C3 doesn't have a push notifications plugin at the moment. Setting up push notifications generally requires signing up to a service or writing your own server, so they aren't particularly easy to use for not technical developers.

    If you want to encourage users to have the latest version of your app installed I can think of a relatively easy way. Have a simple web server set up with a service like AWS, and place a text file on it that contains the current version number for your app. Then in the app have it request this file from the server when it's started, and check it against it's own version number. If they don't match then display a message to the user saying an update it available for the app. It requires the user to have a network connection to check, but then so does sending a push notification and updating the app.

  • I'm not sure what the reasoning is for the restriction, but it dates back to very early version of C3 according to our version control. Either it was to avoid a bug discovered during the development of C2, and hence C3 doesn't have any notes around it, or it was an arbitrary choice.

    Interestingly 144 appears to be a reference sizing for the modern pt size, being exactly 2 inches in height.

    Either way it appears if you use the "set font size" action it ignores the limit, and you can make your font as large as you want. If this value was chosen because of a bug, this might cause problems, but it appears to work for me.

    Ashley might remember the reasoning.

  • Another useful technique is that the Chrome developer tools includes a device emulation tool. This allows you to test touch interaction, different screen sizes and network throttling. Of course it's not a true replacement for testing on an actual device, but it's quick to access.

    https://developers.google.com/web/tools/chrome-devtools/device-mode/

  • I've posted a new version to the build server that corrects this issue.

    I've also rolled back a couple of versions of the admob SDK ( only on iOS ) as there's been some additional changes there which I didn't appreciate. Shouldn't cause any issues though.

    I will make the changes to get compat. with the latest version, but it needs another C3 release. Given where we are at the moment it will likely have to wait a couple of weeks for the next beta cycle to start. If anyone really wants the latest version of the SDK then I can probably walk them through upgrading manually.

  • Thanks for the feedback LukeW looks like a typo from a last minute change, I should be able to patch it with a maintenance update.

    I'll take a proper look now.

Nepeo's avatar

Nepeo

Member since 8 Mar, 2016

Twitter
Nepeo has 583,792 followers

Trophy Case

  • 8-Year Club
  • x4
    Coach One of your tutorials has over 1,000 readers
  • x3
    Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Great Comment One of your comments gets 3 upvotes
  • Email Verified

Progress

13/44
How to earn trophies

Blogs