Congrats2u's Forum Posts

  • This is the encoding script (the second one i included into the project)... the question is, if this two scripts are the only one i would need to encode values - but it seems to be so:

    (function () {

    // Shortcuts

    var C = CryptoJS;

    var C_lib = C.lib;

    var WordArray = C_lib.WordArray;

    var C_enc = C.enc;

    /**

    * Base64 encoding strategy.

    */

    var Base64 = C_enc.Base64 = {

    /**

    * Converts a word array to a Base64 string.

    *

    * param {WordArray} wordArray The word array.

    *

    * {string} The Base64 string.

    *

    *

    *

    * ExampLe

    *

    * var base64String = CryptoJS.enc.Base64.stringify(wordArray);

    */

    stringify: function (wordArray) {

    // Shortcuts

    var words = wordArray.words;

    var sigBytes = wordArray.sigBytes;

    var map = this._map;

    // Clamp excess bits

    wordArray.clamp();

    // Convert

    var base64Chars = [];

    for (var i = 0; i < sigBytes; i += 3) {

    var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;

    var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;

    var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;

    var triplet = (byte1 << 16) | (byte2 << 8) | byte3;

    for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {

    base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));

    }

    }

    // Add padding

    var paddingChar = map.charAt(64);

    if (paddingChar) {

    while (base64Chars.length % 4) {

    base64Chars.push(paddingChar);

    }

    }

    return base64Chars.join('');

    },

    /**

    * Converts a Base64 string to a word array.

    *

    * param {string} base64Str The Base64 string.

    *

    * {WordArray} The word array.

    *

    *

    *

    * ExampLe

    *

    * var wordArray = CryptoJS.enc.Base64.parse(base64String);

    */

    parse: function (base64Str) {

    // Shortcuts

    var base64StrLength = base64Str.length;

    var map = this._map;

    var reverseMap = this._reverseMap;

    if (!reverseMap) {

    reverseMap = this._reverseMap = [];

    for (var j = 0; j < map.length; j++) {

    reverseMap[map.charCodeAt(j)] = j;

    }

    }

    // Ignore padding

    var paddingChar = map.charAt(64);

    if (paddingChar) {

    var paddingIndex = base64Str.indexOf(paddingChar);

    if (paddingIndex !== -1) {

    base64StrLength = paddingIndex;

    }

    }

    // Convert

    return parseLoop(base64Str, base64StrLength, reverseMap);

    },

    _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='

    };

    function parseLoop(base64Str, base64StrLength, reverseMap) {

    var words = [];

    var nBytes = 0;

    for (var i = 0; i < base64StrLength; i++) {

    if (i % 4) {

    var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);

    var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);

    words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);

    nBytes++;

    }

    }

    return WordArray.create(words, nBytes);

    }

    }());

  • Hello there,

    i had a similar topic, but i want to ask you now for a more specific area.

    So i have to encode my score value with JSON Web Token library. I want to use the Crypto-js Library, because it uses the HS256 Algorithm i would need. I downloaded it on github : https://github.com/brix/crypto-js

    My question is how to achieve this. If i have a library - can i place it in the root folder of my project, and access this folder with a javascript, i created in construct3?

    When the player wants to submit his score, i request a secret from a URL, which is needet too synchronize the data. This secret has to be encoded by the library function too. So basically there are a score value and the secret value.

    • Now i have the following javascript in my project - this will (should) execute the process:

    var header = {

    "alg": "HS256",

    "typ": "JWT"

    };

    var data = {

    "id": 1337,

    "score": "254"

    };

    var secret = "My very confidential secret!!!";

    function base64url(source) {

    // Encode in classical base64

    encodedSource = CryptoJS.enc.Base64.stringify(source);

    // Remove padding equal characters

    encodedSource = encodedSource.replace(/=+$/, '');

    // Replace characters according to base64url specifications

    encodedSource = encodedSource.replace(/\+/g, '-');

    encodedSource = encodedSource.replace(/\//g, '_');

    return encodedSource;

    }

    var stringifiedHeader = CryptoJS.enc.Utf8.parse(JSON.stringify(header));

    var encodedHeader = base64url(stringifiedHeader);

    var stringifiedData = CryptoJS.enc.Utf8.parse(JSON.stringify(data));

    var encodedData = base64url(stringifiedData);

    var signature = encodedHeader + "." + encodedData;

    signature = CryptoJS.HmacSHA256(signature, secret);

    signature = base64url(signature);

    From the Library i took the enc-base64 script, i thought it would be the script which is needed to encode the values. The question is how to combine two extern javascripts with each other. Or if basically the complete library is still needed to access...

    • So the score and the secret are the only variables i have in construct, and i would have to complete in this javascript (Thats the first question, how can i use the command to set those values into the javascript).

    -The second question: The Javascript calls the CryptoJS.enc.Utf8 library, how can i setup the connection to a library, which isnt included in the project? Can i access it, when it is in the project folder? ( or in the root of the project)?

    And i would have to receive the encrypted value/string, which would look like this:

    eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTMzNywic2NvcmUiOiIyNTQifQ.xSv1wylmcO5VW5_bbWxrTmvnX9IaTbWWQbDNxjyuSL4

    (Header:Payload:Security)

    It would be so important, if someone could tell me how to achieve this... or if its possible to do that with construct3 - its my first time to using a library, or setup a connection between c3 and javascripts and libraries, which are not included in construct3.

    Thank you so much for your help!

  • Hello there!

    At first:

    Ive made a project which runs on every browser. I have windows 10 with edge where you can use ie 11 and emulate all other versions of ie. If i run it on my computer (and also on others in the office) it works.

    But our customer told us, that it doesnt work on their computer with ie11 (see specs below). He has only a black screen - no loading bar etc.

    And now the question:

    If the game runs on every browser (firefox, chrome, safari, edge and ie11) on all my machines i could test (the project is uploadet to a server, how it would be finally uploaded), what could be the general problem on his browser? I know this question is very general...but maybe someone knows what could be the problem, because i cant say.

    I think this could be a problem which has nothing to do with the browser. He told us he could load all other games but not this one.

    • Could it be the server we uploaded the project?
    • Or his hardware (the other games are similar, depending on the basic needed hardware specifications so i

    think this isnt the problem)

    • Could they have a browser setting which blocks the game?
    • Firewall? - but they dont get a message or a notification...

    Customer browser specs:

    Version 11.0.9600.18837

    Update-version: 11.0.48

    I know its difficould to say what it could be, without no application - but i think its something "out of the box" - like i said on my test machines the game runs perfect in all browsers...

    Maybe i have luck with this thread and someone will give me the final golden hint, i could ask them to take a look for.

  • Yea thats sad...the plugins where good.

  • dop2000

    okay - have to take a look how to do this - did you got some experience with that?

  • dop2000

    Thank you for the information - the plugin isn´t available for construct3 i guess. Do you know alternatives?

    Documentation Link:

    https://jwt.io/

    But the basic question i have is how to use this (i think there are several pages like i included above) method with construct3.

    It should be possible with get and post functions but to use this encoding it shouldn´t be a post command to an extern library, because this could be manipulated too (to avoid this is the basic function of this token), so i guess i would have to have a kind of library in my root folder and use a "encode my variable and send it to url" function...

    but iam absolutly not sure with my intention. Maybe i get something wrong in understanding this thing...

    Thats why iam asking for helping people like you <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Note: I saw, that the question is how to do this in construct2 but i made the project with construct3

  • dop2000

    Thanks for your answer!

    Its a third-party server, basically from our customer. Basically i have a reference, but iam not so deep in this topic - so i cant say who has to deliver what to get this to run.

    For excample: Do i need to integrate a java library, or do i have to implement something else...in the project, and can construct3 handle this, etc. Thats the main questions i wanted to start asking. Probably you did this in your project and you could tell me the "steps" i would have to pay attention on.

    That would be awesome to understand this materia.

    Thank you very much!

  • Someone?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley

    I completly get you. I didnt expected this issue - you know how i was messed up when relizing the project could not be loaded. I will try to avoid third Party plugins for the future as good as i can - but sometimes there are functions you would need in the Project because they could not be accomplished without those plugins. In this Project (you could recover and fix - by the way i cannot say enough thank you for this - it saved my ass) iam using litetween (perfect sprite tweening) and Rex touchwrap (because of the release at object function).

    Bad Wolf

    Think i will take a look to this - basically i have to learn JavaScript to became better on webprogramming (usually iam programming with C# in Unity3d)

  • Hello there!

    Is there a possability to create a Iframe (extern URL window) inside my game, using iframe? There was a plugin for construct2 but i could not find something for construct3

    Thank you very much

  • rexrainbow

    Thanks for your Feedback rex! I just had a heartattack this morning when i was relizing i could not open all of my versions (backups etc.). I thought i would have to start from zero with this finished project.

    So right now, if iam saving the project, it opens with the last version i added to the addon manager this morning. I think it was a missmatch between the current version and the older version i installed a month ago. but i didnt knowed that it was the plugin until ashley analyzed the project and thanks god he could recreate the project.

    Note to myself.....never clear the cache on chrome anymore until the projects are finaly done and uploaded Iam not sure if this problem will appear again if i would clear the cache and reinstall the plugins again - i dont want to find out - but in this current project your plugin was very useful for me so i had to let it in the project.

    Hopefully this will never happen again.....it was a really horrible feeling this morning...

    now i have your version 0.1.0.0 installed - is this version fixed? (it runs without problems at the moment - i can open the versions, wich ashley fixed)

  • Update:

    Ashley could fix this issue - it was the touch wrap plugin by rex, which caused this issue.

    The plugins were deleted, after i cleared the cache of chrome, which is basically the browser, construct3 runs in. I had to reinstall them - but after that construct3 could not be synchronized and the message appears.

    Thanks Ashley! Without your (fast) help it would be a nightmare, because it could not be fixed by myself.

  • Did you get the email?

    I tried to open it with other browser - same result...

  • I have 30 backups - But every file cant be loaded i think its not a file problem - please it means a lot to fix this i hope you fix this this is so important.

    I ve sended you the file via e-mail (wetransfer link).

  • Ashley

    I cant open my construct3 project - it says please check if its a valid construct3 project - it doesnt matter if its acutal or an backup

    "Failed to open project. Check it is a valid Construct 3 single-file (.c3p) project."

    its the same project i always open - there has nothing changed - all the previous backups are invalid....

    it doesnt matter in which browser it always says the project cant be open.....please i dont know whats the matter - it is a normal .c3p file (i have so many backups and every time the same message)

    PLEASE HELP!

    I only cleared the browser history (the project and construct3 werent open at this time (chrome))

    I had to reinstall the addons iam using (litetween and rex touch wrap)

    i cleared the browser again and on construct3 startup i get this message:

    Error report information

    Type: unhandled rejection

    Reason: Error: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. Error: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. at https://editor.construct.net/r81-2/main.js:2:3971 at

    Stack: Error: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found. at https://editor.construct.net/r81-2/main.js:2:3971 at

    Construct 3 version: r81.2

    URL: https://editor.construct.net/

    Date: Fri Jan 26 2018 10:24:02 GMT+0100 (Mitteleuropäische Zeit)

    Uptime: 480.9 s

    Platform information

    Browser: Chrome

    Browser version: 63.0.3239.132

    Browser engine: Blink

    Browser architecture: 64-bit

    Context: browser

    Operating system: Windows

    Operating system version: 10

    Operating system architecture: 64-bit

    Device type: desktop

    Device pixel ratio: 1

    Logical CPU cores: 8

    Approx. device memory: 8 GB

    User agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

    C3 release: r81.2

    Language setting: en-US

    WebGL information

    Version string: WebGL 2.0 (OpenGL ES 3.0 Chromium)

    Numeric version: 2

    Supports NPOT textures: yes

    Supports GPU profiling: yes

    Vendor: Google Inc.

    Renderer: ANGLE (AMD Radeon R9 200 Series Direct3D11 vs_5_0 ps_5_0)

    Major performance caveat: no

    Maximum texture size: 16384

    Point size range: 1 to 1024

    Extensions: EXT_color_buffer_float, EXT_disjoint_timer_query_webgl2, EXT_texture_filter_anisotropic, OES_texture_float_linear, WEBGL_compressed_texture_s3tc, WEBGL_compressed_texture_s3tc_srgb, WEBGL_debug_renderer_info, WEBGL_debug_shaders, WEBGL_lose_context

    please tell me you can fix this and make my project run again its a customer projcet and if its broken......omg.......please help

    I cant launch the project on other computers too....and it doesnt matter which project (backup) this is horrible - i did nothing except clearing the browser history and cache....it had nothing to do with construct3.....i cant imangine why now every version cant be open