2023-10-14 snapshot (Updated on 2023-10-29)

Post anything about MX Simulator here. Please. I'm begging you.
ktm161
Posts: 557
Joined: Wed May 15, 2013 3:03 am
Team: Underground RC

Re: 2023-10-14 snapshot

Post by ktm161 »

is there a way we can get /toggledecals back up and working again? its a real pain in the you know what just to save track then exit the game, pull the decals file out and then open the game back up just to put tile down haha
Image
Hayden_Scott
Posts: 142
Joined: Mon Oct 21, 2019 9:06 am
Team: District D|Brainsick
Location: Western Australia

Re: 2023-10-14 snapshot

Post by Hayden_Scott »

Is it a possibility to get 2 stroke smoke in the next update? Could be like a particle box in blender or something and it moves billboards that are the smoke texture inside that box? or could just some sort of box that is named in blender to assign with some script that is used when the game loads up and reads the bike frame.jm?
AtlasZoor
Posts: 338
Joined: Wed Aug 02, 2017 12:51 am
Team: Atlas Trackworks
Location: Corn

Re: 2023-10-14 snapshot

Post by AtlasZoor »

Hayden_Scott wrote: Thu Oct 19, 2023 2:41 pm Is it a possibility to get 2 stroke smoke in the next update? Could be like a particle box in blender or something and it moves billboards that are the smoke texture inside that box? or could just some sort of box that is named in blender to assign with some script that is used when the game loads up and reads the bike frame.jm?
so many other things that are needed other than 2 stroke smoke my guy ☠︎☠︎💀💀
Image
ScrubDatMx
Posts: 305
Joined: Wed Oct 08, 2014 1:25 am
Team: Late Night Crew
Location: San Diego, California

Re: 2023-10-14 snapshot

Post by ScrubDatMx »

Hayden_Scott wrote: Thu Oct 19, 2023 2:41 pm Is it a possibility to get 2 stroke smoke in the next update? Could be like a particle box in blender or something and it moves billboards that are the smoke texture inside that box? or could just some sort of box that is named in blender to assign with some script that is used when the game loads up and reads the bike frame.jm?
Would be a cool feature to have, just these little things will really freshen the game up nicely. Tread marking is already a great step.
Image
Hayden_Scott
Posts: 142
Joined: Mon Oct 21, 2019 9:06 am
Team: District D|Brainsick
Location: Western Australia

Re: 2023-10-14 snapshot

Post by Hayden_Scott »

ScrubDatMx wrote: Thu Oct 19, 2023 8:30 pm
Hayden_Scott wrote: Thu Oct 19, 2023 2:41 pm Is it a possibility to get 2 stroke smoke in the next update? Could be like a particle box in blender or something and it moves billboards that are the smoke texture inside that box? or could just some sort of box that is named in blender to assign with some script that is used when the game loads up and reads the bike frame.jm?
Would be a cool feature to have, just these little things will really freshen the game up nicely. Tread marking is already a great step.
thats what im saying i dont think it would be toooooo hard to do. But i am not a game developer so idk
jlv
Site Admin
Posts: 14931
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2023-10-14 snapshot

Post by jlv »

ktm161 wrote: Thu Oct 19, 2023 4:46 am is there a way we can get /toggledecals back up and working again? its a real pain in the you know what just to save track then exit the game, pull the decals file out and then open the game back up just to put tile down haha
Yes. I have a fix for it. I have one other thing to fix and I'll upload an update.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
jlv
Site Admin
Posts: 14931
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2023-10-14 snapshot

Post by jlv »

Hayden_Scott wrote: Thu Oct 19, 2023 11:44 pm thats what im saying i dont think it would be toooooo hard to do. But i am not a game developer so idk
It wouldn't be too hard to do but things like that turn into death by a thousand cuts. I want to focus on bigger things. The next big update will be the culmination of the terrain rendering optimizations. After that I'm not sure but probably shading via HDR environment maps.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Donut MX
Posts: 171
Joined: Wed Jul 06, 2016 2:21 am
Team: Privateer
Contact:

Re: 2023-10-14 snapshot

Post by Donut MX »

i love this update - looks really clean. the number of turn tracks ive already carved out...

is there a way to toggle the tread decals on/off in-game?
jlv
Site Admin
Posts: 14931
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2023-10-14 snapshot

Post by jlv »

Donut MX wrote: Sat Oct 21, 2023 12:53 am i love this update - looks really clean. the number of turn tracks ive already carved out...

is there a way to toggle the tread decals on/off in-game?
You can set "treadmark limit" to 0 to disable dropping the treadmark decals. No way to hide/show already dropped treadmarks though.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
jgmtbike
Posts: 740
Joined: Sat Jun 08, 2013 5:24 am
Team: WiLdSiDesigns (JGMX)

Re: 2023-10-14 snapshot

Post by jgmtbike »

Great update JLV. Is there a way to save the treadmarks you create on the track like decals? I'd like to use them to make single track trails and actually save the marks for my next session.
-If you like riding my tracks please donate to the cause https://www.paypal.me/jgmtbike

-Thanks so much for all your support of my tracks.

Image
Jakob Hubbard
Posts: 1152
Joined: Fri Nov 24, 2017 3:16 am
Team: Phil's
Location: Cold
Contact:

Re: 2023-10-14 snapshot

Post by Jakob Hubbard »

jgmtbike wrote: Sat Oct 21, 2023 8:43 pm Great update JLV. Is there a way to save the treadmarks you create on the track like decals? I'd like to use them to make single track trails and actually save the marks for my next session.
I made a track script that essentially allows you to do this by logging the decals with their coordinates, angle, size, aspect, etc to lastlog.txt. You have to change what treadmark decals associate with what tile number.

You also have to get rid of the date logs, usually doing it with:

Code: Select all

grep -o '@@@<TREAD_NAME>.*@@@' lastlog.txt > treads.txt
where <TREAD_NAME> is the name of the decal in the track script. It will output to a file in the same directory named "treads.txt" Then you can remove the @@@'s in notepad or any other text editor. The only downside to this script is it doesn't have the customization that jlv's has with different speeds dropping different decals and choosing whether to do front or rear or both wheels (it only does rear wheel). I could easily modify the script to do this but not sure how useful it would be.

Here's the script if anyone wants to save treadmarks. If anyone actually uses this and wants me to modify it to meet jlv's treadmark code, then I can do that.

Code: Select all

// Position and velocity variables for riders rear tire
var rearTirePos = [], rearTireVel = [];

// Running order variable
var globalRunningOrder;

// Change the name to your track folder
const trackFolderName = "@TRACKFOLDERHERE";
const decalsToLog = [
    {
        name: "tread",
        size: 6.000000,
        aspect: 1.0000000,
        texture: trackFolderName + "/decal/tread.png",
        spacing: 2.5,
        tileNumbers: [0, 1, 2, 3, 4, 5, 6, 7, 11],
        minSpeed: 5, // minimum speed needed to log a decal in ft/sec
        lastDecalLogged: [],
    },
    {
        name: "disturbed",
        size: 10.000000,
        aspect: 1.0000000,
        texture: trackFolderName + "/decal/disturbed.png",
        spacing: 10,
        tileNumbers: [0, 1, 2, 3, 4, 5, 6, 7, 11],
        minSpeed: 5,
        lastDecalLogged: [],
    }
]
function logDecals() {
    /* Since this loop goes through the running order, decals should overlap correctly. 
        If second happens to place a decal on top of one close to first's it will be on the layer above */
    for (var i = 0; i < globalRunningOrder.length; i++) {
        var slot = globalRunningOrder[i].slot;
        
        // Loop through each decal in the decals to log array
        for (var j = 0; j < decalsToLog.length; j++) {
            // if there is no coordinates stored for this slot and decal yet add them
            if (decalsToLog[j].lastDecalLogged[slot] == undefined) {
                const rearContactMade = mx.get_rear_contact_position(slot, rearTirePos);
                if (rearContactMade == 1) {

                    // Check to see if the tile number the rear tire is on matches the tile number in the decals to log tileNumbers array
                    const tileNumber = mx.get_tile_number(rearTirePos[0], rearTirePos[2]);
                    if (decalsToLog[j].tileNumbers.indexOf(tileNumber) === -1) continue;

                    // store the X and Z variables if the rear tire has made contact
                    decalsToLog[j].lastDecalLogged[slot] = [rearTirePos[0], rearTirePos[2]];

                    // get the rear contact tire velocity and use it as a normal vector for calculating the angle of the tire in world space
                    mx.get_rear_contact_velocity(slot, rearTireVel);
                    // Calculate the rear tire velocity and put it in range of 0 to 2pi and rotate 270 degrees counterclockwise
                    const rearTireAngle = ((Math.atan2((-1 * rearTireVel[2]), rearTireVel[0]) + Math.PI * 2) + (3 * Math.PI / 2)) % (Math.PI * 2);
                    mx.message("@@@" + decalsToLog[j].name.toUpperCase() + "[" + rearTirePos[0].toFixed(6) + " " + rearTirePos[2].toFixed(6) + "] " + rearTireAngle.toFixed(6) + " " + decalsToLog[j].size + " " + decalsToLog[j].aspect + " " + decalsToLog[j].texture + "@@@");
                }
            }

            const rearContactMade = mx.get_rear_contact_position(slot, rearTirePos);

            // if the rider is in the air we don't want to log a decal placement
            if (rearContactMade == 0) continue;

            // Check to see if the tile number the rear tire is on matches the tile number in the decals to log tileNumbers array
            const tileNumber = mx.get_tile_number(rearTirePos[0], rearTirePos[2]);
            if (decalsToLog[j].tileNumbers.indexOf(tileNumber) === -1) continue;

            // calculate distance from current tire contact vs last decal placed and check to make sure it's greater than the minimum distance between decals
            const differenceFromLastPlacement = distanceCalculation2D(decalsToLog[j].lastDecalLogged[slot][0], decalsToLog[j].lastDecalLogged[slot][1], rearTirePos[0], rearTirePos[2]);
            if (differenceFromLastPlacement > decalsToLog[j].spacing) {
                decalsToLog[j].lastDecalLogged[slot] = [rearTirePos[0], rearTirePos[2]];

                // get the rear contact tire velocity and use it as a normal vector for calculating the angle of the tire in world space
                mx.get_rear_contact_velocity(slot, rearTireVel);
                const magnitude = Math.sqrt(Math.pow(rearTireVel[0],2) + Math.pow(rearTireVel[1],2) + Math.pow(rearTireVel[2],2));
                if (magnitude < decalsToLog[j].minSpeed) continue;
                // Calculate the rear tire velocity and put it in range of 0 to 2pi and rotate 270 degrees counterclockwise
                const rearTireAngle = ((Math.atan2((-1 * rearTireVel[2]), rearTireVel[0]) + Math.PI * 2) + (3 * Math.PI / 2)) % (Math.PI * 2);
                mx.message("@@@" + decalsToLog[j].name.toUpperCase() + "[" + rearTirePos[0].toFixed(6) + " " + rearTirePos[2].toFixed(6) + "] " + rearTireAngle.toFixed(6) + " " + decalsToLog[j].size + " " + decalsToLog[j].aspect + " " + decalsToLog[j].texture + "@@@");
            }
        }
    }
}

function distanceCalculation2D(x1,y1,x2,y2) {
    return Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
}

function frameHandler(seconds) {
    globalRunningOrder = mx.get_running_order();
    logDecals();
}

mx.frame_handler = frameHandler;
Image
jlv
Site Admin
Posts: 14931
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2023-10-14 snapshot

Post by jlv »

jgmtbike wrote: Sat Oct 21, 2023 8:43 pm Great update JLV. Is there a way to save the treadmarks you create on the track like decals? I'd like to use them to make single track trails and actually save the marks for my next session.
No way to save them currently. It merges all the different treadmark textures into one atlas texture for the sake of efficiency. That makes it difficult to save them since it'd have to keep an index mapping the atlased textures back to their original files. I took the easy way out and just skipped saving them.

Looks like Jakob has a pretty good way to get the same effect.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
jgmtbike
Posts: 740
Joined: Sat Jun 08, 2013 5:24 am
Team: WiLdSiDesigns (JGMX)

Re: 2023-10-14 snapshot

Post by jgmtbike »

Jakob Hubbard wrote: Sat Oct 21, 2023 11:39 pm
jgmtbike wrote: Sat Oct 21, 2023 8:43 pm Great update JLV. Is there a way to save the treadmarks you create on the track like decals? I'd like to use them to make single track trails and actually save the marks for my next session.
I made a track script that essentially allows you to do this by logging the decals with their coordinates, angle, size, aspect, etc to lastlog.txt. You have to change what treadmark decals associate with what tile number.

You also have to get rid of the date logs, usually doing it with:

Code: Select all

grep -o '@@@<TREAD_NAME>.*@@@' lastlog.txt > treads.txt
where <TREAD_NAME> is the name of the decal in the track script. It will output to a file in the same directory named "treads.txt" Then you can remove the @@@'s in notepad or any other text editor. The only downside to this script is it doesn't have the customization that jlv's has with different speeds dropping different decals and choosing whether to do front or rear or both wheels (it only does rear wheel). I could easily modify the script to do this but not sure how useful it would be.

Here's the script if anyone wants to save treadmarks. If anyone actually uses this and wants me to modify it to meet jlv's treadmark code, then I can do that.

Code: Select all

// Position and velocity variables for riders rear tire
var rearTirePos = [], rearTireVel = [];

// Running order variable
var globalRunningOrder;

// Change the name to your track folder
const trackFolderName = "@TRACKFOLDERHERE";
const decalsToLog = [
    {
        name: "tread",
        size: 6.000000,
        aspect: 1.0000000,
        texture: trackFolderName + "/decal/tread.png",
        spacing: 2.5,
        tileNumbers: [0, 1, 2, 3, 4, 5, 6, 7, 11],
        minSpeed: 5, // minimum speed needed to log a decal in ft/sec
        lastDecalLogged: [],
    },
    {
        name: "disturbed",
        size: 10.000000,
        aspect: 1.0000000,
        texture: trackFolderName + "/decal/disturbed.png",
        spacing: 10,
        tileNumbers: [0, 1, 2, 3, 4, 5, 6, 7, 11],
        minSpeed: 5,
        lastDecalLogged: [],
    }
]
function logDecals() {
    /* Since this loop goes through the running order, decals should overlap correctly. 
        If second happens to place a decal on top of one close to first's it will be on the layer above */
    for (var i = 0; i < globalRunningOrder.length; i++) {
        var slot = globalRunningOrder[i].slot;
        
        // Loop through each decal in the decals to log array
        for (var j = 0; j < decalsToLog.length; j++) {
            // if there is no coordinates stored for this slot and decal yet add them
            if (decalsToLog[j].lastDecalLogged[slot] == undefined) {
                const rearContactMade = mx.get_rear_contact_position(slot, rearTirePos);
                if (rearContactMade == 1) {

                    // Check to see if the tile number the rear tire is on matches the tile number in the decals to log tileNumbers array
                    const tileNumber = mx.get_tile_number(rearTirePos[0], rearTirePos[2]);
                    if (decalsToLog[j].tileNumbers.indexOf(tileNumber) === -1) continue;

                    // store the X and Z variables if the rear tire has made contact
                    decalsToLog[j].lastDecalLogged[slot] = [rearTirePos[0], rearTirePos[2]];

                    // get the rear contact tire velocity and use it as a normal vector for calculating the angle of the tire in world space
                    mx.get_rear_contact_velocity(slot, rearTireVel);
                    // Calculate the rear tire velocity and put it in range of 0 to 2pi and rotate 270 degrees counterclockwise
                    const rearTireAngle = ((Math.atan2((-1 * rearTireVel[2]), rearTireVel[0]) + Math.PI * 2) + (3 * Math.PI / 2)) % (Math.PI * 2);
                    mx.message("@@@" + decalsToLog[j].name.toUpperCase() + "[" + rearTirePos[0].toFixed(6) + " " + rearTirePos[2].toFixed(6) + "] " + rearTireAngle.toFixed(6) + " " + decalsToLog[j].size + " " + decalsToLog[j].aspect + " " + decalsToLog[j].texture + "@@@");
                }
            }

            const rearContactMade = mx.get_rear_contact_position(slot, rearTirePos);

            // if the rider is in the air we don't want to log a decal placement
            if (rearContactMade == 0) continue;

            // Check to see if the tile number the rear tire is on matches the tile number in the decals to log tileNumbers array
            const tileNumber = mx.get_tile_number(rearTirePos[0], rearTirePos[2]);
            if (decalsToLog[j].tileNumbers.indexOf(tileNumber) === -1) continue;

            // calculate distance from current tire contact vs last decal placed and check to make sure it's greater than the minimum distance between decals
            const differenceFromLastPlacement = distanceCalculation2D(decalsToLog[j].lastDecalLogged[slot][0], decalsToLog[j].lastDecalLogged[slot][1], rearTirePos[0], rearTirePos[2]);
            if (differenceFromLastPlacement > decalsToLog[j].spacing) {
                decalsToLog[j].lastDecalLogged[slot] = [rearTirePos[0], rearTirePos[2]];

                // get the rear contact tire velocity and use it as a normal vector for calculating the angle of the tire in world space
                mx.get_rear_contact_velocity(slot, rearTireVel);
                const magnitude = Math.sqrt(Math.pow(rearTireVel[0],2) + Math.pow(rearTireVel[1],2) + Math.pow(rearTireVel[2],2));
                if (magnitude < decalsToLog[j].minSpeed) continue;
                // Calculate the rear tire velocity and put it in range of 0 to 2pi and rotate 270 degrees counterclockwise
                const rearTireAngle = ((Math.atan2((-1 * rearTireVel[2]), rearTireVel[0]) + Math.PI * 2) + (3 * Math.PI / 2)) % (Math.PI * 2);
                mx.message("@@@" + decalsToLog[j].name.toUpperCase() + "[" + rearTirePos[0].toFixed(6) + " " + rearTirePos[2].toFixed(6) + "] " + rearTireAngle.toFixed(6) + " " + decalsToLog[j].size + " " + decalsToLog[j].aspect + " " + decalsToLog[j].texture + "@@@");
            }
        }
    }
}

function distanceCalculation2D(x1,y1,x2,y2) {
    return Math.sqrt(Math.pow(x2-x1,2) + Math.pow(y2-y1,2));
}

function frameHandler(seconds) {
    globalRunningOrder = mx.get_running_order();
    logDecals();
}

mx.frame_handler = frameHandler;
Thanks a bunch bro!!!!!! :D :D :D
-If you like riding my tracks please donate to the cause https://www.paypal.me/jgmtbike

-Thanks so much for all your support of my tracks.

Image
jlv
Site Admin
Posts: 14931
Joined: Fri Nov 02, 2007 5:39 am
Team: No Frills Racing
Contact:

Re: 2023-10-14 snapshot

Post by jlv »

Updated 2023-10-23:
  • Fixed toggledecals.
  • Fixed upsampling to use bilinear filtering when treadmark color/norm/spec maps have mismatched sizes. Previously used point sampling
Windows users: https://mxsimulator.com/snapshots/mx-2023-10-23-1662.exe
Linux users: https://mxsimulator.com/snapshots/mxbin-2023-10-23-1662
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: 2023-10-14 snapshot

Post by yzmxer608 »

This does look great after seeing it on the Owens Valley track!

I had some flashbacks, somehow still had it bookmarked. Is this related to this old script? https://forum.mxsimulator.com/viewtopic ... 332#p73332
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
Post Reply