Mikal's Recent Forum Activity

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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/agecheck/app/2189860

    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.

  • Updates:

    fix (leaderboard)

    add Error condition and Error data

    add IsDlcInstalled

  • we should probably just put the latest version in the c3 addon repository, I'll do it this weekend unless someone beats me to it

  • Having fun making a (paid) 3D physics behavior that works with 3D Shape. Check it out here:

    kindeyegames.itch.io/construct-3-cannon

    Example:

  • Working on one, but using it on the server side in node.js

    However, I am testing it on client side with C3 for faster iterations.

    I am using a bt library and c3 js scripting for the bt 'tasks'. The library I am using accepts json for definition of the bt.

    github.com/Calamari/BehaviorTree.js

    The tasks could be c3 event functions with uid, so more event driven at least.

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

    Also updated with greenworks 0.15

Mikal's avatar

Mikal

Early Adopter

Member since 22 Apr, 2016

Twitter
Mikal has 107 followers

Trophy Case

  • 8-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • 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

20/44
How to earn trophies