Nepeo's Forum Posts

    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.

  • All of these JS based crypto-mining libraries cost more to run than they make, the trick being that the person making the money isn't the one paying the electricity bill. The user pays the electricity bill, and the developer gets the cash.

    Normally they are run in a separate process, so they might not directly slow down the game if it's not using all the CPU cores ( most games don't ). However, they do put a lot of pressure on the CPU and generate a lot of heat. Which can cause the CPU to throttle, slowing itself down so that it doesn't overheat and fail.

    You can normally pick out websites doing this, as your CPU fan will spin up. But I expect users will just blame the game for being inefficient.

    As a form of monetization they are particularly unpleasant, as users often don't know it's happening and the developer is effectively just draining their money (inefficiently). Add in the environmental damage of the electricity used and this isn't going to win you any fans. I've no idea how much money you'd make per user, but it can't be much.

  • Hah yeah it's perhaps not the easiest introduction to procedural generation! Did you make any progress?

    I've been thinking about how I would go about doing this, which is perhaps not the simplest way but I guess you could remove/modify some steps to make them simpler.

    For positioning there's a technique I've been trying out recently called "Poisson disc sampling" which allows you to randomly place objects in an area, but ensure they aren't too close to each other. Here is a good animated explanation of how it works. There's also this video by Sebastian Lague.

    I plumbed some of my code into an example project for you to take a look at. I used inline JavaScript to do the Poisson instead of event sheets, hopefully that isn't too scary. For the other parts I used normal events, as scripting doesn't have access to some of the properties we need.

    For planets I used round(random(min, max)) to get a count, then placed them at a random distance/angle from the star. We have a behaviour called "Orbit" that makes them move, and "pinned" it to the star so it follows it. Then used more random calculations for the properties.

    Naming things is a little more complicated, there's a technique called Markov Chains which can be used for this. I've never written one but it looks quite easy, you can hold the name fragments in an array. There's a built in tool called the "array editor" which can be used to create and edit array files, which you can then load into an array object at runtime.

    As you can see quite a lot of this can be done without arrays, you can just use loops and local variables. If you want your code to be able to show the relations between planetary systems, suns, planets, moons you might have to create an array for lookups.

    There's plenty more that can be done from the demo project, hopefully it shows you enough to figure out the rest.

  • Glad to hear. Have fun and let us know if you have any feedback. Bear in mind that both the feature and documentation are still beta at the moment.

  • Hey sizcoz that's great news! I guess it included a fix for something.

    LukeW The condition is in the next release.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure if you've found it yet but the scripting documentation tells you how to do this.

    You can get a reference to the object class with

    const Sprite = runtime.objects.Sprite; // Sprite object class
    const first = Sprite.getFirstInstance(); // first instance of Sprite
    const instances = Sprite.getAllInstances(); // all instances of Sprite
    

    Not all types have full interfaces yet, the ones that so are listed under the "Plugin interfaces" section in the documentation menu. However, there are a set of common methods for object classes and instances that exist for doing things like creating new instances, destroying old ones and moving them around the layout.

  • I've updated the construct-mobile-ads plugin to use the latest version of the Admob SDK. Due to requirements for the SDK changing it requires a C3 release so you should be able to see the change when the next release goes out. While I was at it I also added in a new condition for checking if the device is in the EEA.