Mikal's Recent Forum Activity

  • 1.7.0

    Add very basic steamworks network messaging for testing. Requires correct SteamID to communicated between clients.

    To get the correct SteamID: In the Steam desktop application, select your Steam username in the top right corner of the screen. Select ''Account details''. Your Steam ID can be found below your Steam username.

    Networking must be enabled before communication. In the example project click on 'Enable Networking' this enables polling each tick for incoming messages.

    In the example app, the steamId should be added to the top box and the message to the other box (right now a random number is appended in the example project, easy to change.)

    When communication first happens between two clients, the receiving client must accept the connection before messages can be sent between them. The example project automatically accepts all incoming connections/sessions. Right now the channel number is hardwired to 0, but will change. Please try it out and let me know your experiences!

  • 1.6.0 Add GetFriendPersonaName

  • Ah, could be an issue with what version of JS the C2 export supports or it could be async nit supporyed at top level, not in module. Does it still work without async?

  • Added to C3 addons, so we don't lose access to this awesome tool:

    construct.net/en/make-games/addons/1140/easystar

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah, yes this is a traditional canvas. I assume this function will be used multiple times, so I would also suggest creating a single canvas outside of the function and pass it to the function to be reused (so you are not creating a canvas per function call.)

  • I can give the basics, but I don't use c2 anymore. Here's generally how I would do it (untested):

     async function GetFriendAvatar(e) {
     return new Promise((resolve, reject) => {
     const requestResult = this._greenworks["requestUserInformation"](e["steam-id"], false);
     console.log('*** INFO *** domSide.js _OnGetFriendAvatar requestResult', requestResult);
     console.log('*** INFO *** domSide.js _OnGetFriendAvatar', e);
     var handle = this._greenworks["getSmallFriendAvatar"](e["steam-id"]);
     console.log('*** INFO *** domSide.js _OnGetFriendAvatar handle', handle);
     var data = this._greenworks["getImageRGBA"](handle);
     console.log('*** INFO *** domSide.js _OnGetFriendAvatar data', data);
     var size = this._greenworks["getImageSize"](handle);
     console.log('*** INFO *** domSide.js _OnGetFriendAvatar size', size);
     const result = {size, data};
     resolve(JSON.stringify(result));
     });
    	const e = {"steam-id": "483094812098"}
    	const result = await GetFriendAvatar(e);
    
    function createImageDataUrl(pixelArray, width, height) {
     // Create a canvas element
     const canvas = document.createElement('canvas');
     canvas.width = width;
     canvas.height = height;
    
     // Get the 2D context of the canvas
     const ctx = canvas.getContext('2d');
    
     // Create a new ImageData object
     let imageData = ctx.createImageData(width, height);
    
     // Set the pixel values
     for (let i = 0; i < pixelArray.length; i++) {
     imageData.data[i] = pixelArray[i];
     }
    
     // Put the image data onto the canvas
     ctx.putImageData(imageData, 0, 0);
    
     // Convert the canvas to a data URL and return it
     return canvas.toDataURL();
    }
    
    const imageData = result
    const height = imageData.size.height
    const width = imageData.size.width
    const pixelArray = imageData.data.data
    
    const dataURL = createImageDataUrl(pixelArray, width, height)
    
    console.log('dataURL', dataURL)
    

    replace this._greenworks with your pointer to greenworks

    I can help debug, if you try and it is not working for you. Just post the code.

  • Another interesting note in terms of my implementation, I got the function for creating a data URI from the original array, by describing the data format in my first post and then asked chatgpt4 to create the function for me in JS and the result worked w/o any changes, pretty nice!

  • Ok, got something working. Though, I am doing it for local user who's avatar may already be cached. So it may require another ACE to get the userInfo, wait for that to be available, then getFriendAvatar.

    The test project includes the function to change the data to a dataURL which a sprite can load.

    Let me know if you have any questions - it's a basic test case.

    I find that I need to use the steam ID from looking at my profile on steam website my profile URL.

    (Put the steam ID in the top text box, then press Get Avatar button. Need to export as nw.js 0.82 and add steam_appid.txt to the usual spot.

    construct.net/en/make-games/addons/244/greengrinds

  • It looks like it provides the handle (just an int tag) to be used by another greenworks function greenworks.getImageRGBA(handle); which returns a color 1d array, arranged in byte order of a[idx] = R, a[idx+1] = G, a[idx+2] = B, a[idx+3] = A.

    You can combine these together to make a RGBA color, using c3 expressions and write them into a C3 canvas for example.

    That's the theory at least :) I'm going to try it out, by adding the call to Greengrinds.

  • FYI here's some other features supported:

    3D Shape: Box, Wedge, Corner-in, Corner-out, Prism, Pyramid

    Apply impulse

    Immovable / movable

    World gravity setting

    3D raycast, skipface, collision filter group / mask

    Set mass

    OnCollision trigger

    CollisionData (from the OnCollision trigger)

    Set velocity

    Set linear, angular damping

    Set collision filter group

    Set collision filter group mask

    Apply force

    Apply torque

    Support 3DShape full 3D rotation using Rotate 3D Behavior (normally only z axis rotation)

    Add Trigger for raycastResult available (synchronous now anyway, but future may be async)

    More raycast modes (all, any closest - default)

    Add expression for x,y,z velocity

    Heightfield shape

  • Added a new feature to my Construct 3D Physics Addon - heightfields. It makes it possible to use a square sprite mesh (w/ fixed x,y spacing) to create a heightfield shape for 3D physics:

    Subscribe to Construct videos now

    Available on itch (paid)

    kindeyegames.itch.io/construct-3-cannon

  • store.steampowered.com/app/2189860/Outer_Terror

    Outer Terror mixes 2d w/ 3d (C3 game)

    Uses 3DShape and 3DObject (my addon) for 3D

    Some scenes are just flat, but others have buildings, 3d garbage piles, 3d cars, etc.

Mikal's avatar

Mikal

Early Adopter

Member since 22 Apr, 2016

Twitter
Mikal has 103 followers

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Popular Game One of your games has over 1,000 players
  • Regular Visitor Visited Construct.net 7 days in a row
  • Steady Visitor Visited Construct.net 30 days in a row
  • RTFM Read the fabulous manual
  • x10
    Great Comment One of your comments gets 3 upvotes
  • Delicious Comment One of your comments gets 10 upvotes
  • Email Verified

Progress

19/44
How to earn trophies