Modern Pooling Principles in Unity C#

When developing software, performance is one of the most important facets, especially if targeting a platform like web/mobile.

Creating and Destroying objects requires a lot of memory and processing power relative to our other game actions, but we can reduce the impact of Instantiation in Unity by simply reusing them.

In Unity, we can do this by Instantiating all of the objects first, then storing references to them.

We will explore this concept in an example open source game I created ‘slashdot’, which also contains shaders from the last two posts.

https://github.com/gen3vra/slashdot

Setup

We will begin creating the class which will actually handle our pooled objects. When working with pooled GameObjects vs simply Instantiating and Destroying them, we want to be careful of a few key concepts. Firstly, we want to disable most properties for reuse later as opposed to destructing them. Rarely you will need to create and destroy components on initialization, but the vast majority of components or the GameObject itself can be disabled and enabled.

public GameObject enemyPrefab;
public Queue<Enemy> PooledEnemies;
public List<Enemy> TrackedActiveEnemies;

Assign an enemy through the inspector. Next we will create our pools.

Creating the Objects

Call the setup function in the Awake of the class to setup the pool.

void SetupPools()
{
    for (int i = 0; i < 100; i++)
    {
        var enemy = Instantiate(enemyPrefab, Vector3.zero, Quaternion.identity);
        PooledEnemies.Add(enemy.GetComponent<Enemy>());
        enemy.SetActive(false);
    }
}

This will Instantiate all of the objects and keep a reference for us.

Using the Objects

Now, when we want to use a GameObject we can simply call our function in our class from our instance to return a GameObject for us to manipulate.

A super simple implementation might look something like the below.

public GameObject GetEnemy()
{
    GameObject enemy = PooledEnemies.Dequeue();
    return enemy;
}

If only using the <Queue> type and planning for one enemy. However, we want to use multiple enemy types. We can make our pooled enemies a list to have more flexibility. An example implementation for this logic would be an EnemyType enum that the GetEnemy function checks, like so.

public List<Enemy> PooledEnemies = new List<Enemy>();
public GameObject GetEnemy(Enemy.EnemyType enemyType)
{
    foreach (var enemy in PooledEnemies)
    {
        if (enemy.CurrentEnemyType == enemyType)
        {
            PooledEnemies.Remove(enemy);
            return enemy.gameObject;
        }
    }
}

Now we can simply use this as we would an instantiated object.

randomEnemyType = Random.Range(0, 3) == 0 ? 1 : 0;
var enemy = GetEnemy((Enemy.EnemyType)randomEnemyType);
enemy.transform.position = new Vector3(Random.Range(0,100), Random.Range(0,100), enemy.transform.position.y, 0f);
enemy.SetActive(true);
var enemyComponent = enemy.GetComponent<Enemy>();
enemyComponent.Init();
TrackedActiveEnemies.Add(enemyComponent);

Returning the Object to the Pool

We can use a function like the one below to return a used object to the pool after we are done with it.

public void RemoveEnemy(Enemy enemy)
{
    enemy.gameObject.SetActive(false);

    TrackedActiveEnemies.Remove(enemy);
    PooledEnemies.Add(enemy);
}

Simply call RemovePooledEnemy() wherever needed.

Manager.Instance.RemoveEnemy(this);

Re-using Objects

Most of the quirks that you’ll encounter from pooling GameObjects like this stem from figuring out how to reset everything nicely. Unity doesn’t run most code on disabled objects; it’s usually preferable to reset things on Init to avoid unexpected behavior.



Source

Itch.io


It helps me if you share this post

Published 2024-02-07 06:00:00

Unity Shaders Intro Part 1: Shader Graph | Creating Player Highlight / Obscuring Area Effect Mask Shader

Shaders can be a useful way to enhance the visual presentation of your project through subtle or otherwise effects. Beyond code, the engine provides a built in visual scripting tool to create shaders from version 2019 onwards.

We will create an effect that allows us to highlight the player and obscure the rest of our stage. With scripting, we can also modify our exposed shader properties to adjust the intensity of the transparency effect, and transition to having no highlight. Examples will be shown later in the post.

Prerequisites

Ensure you have the Shader Graph package installed in your version of Unity. I am using 2022.3.17f for this post.

Creating the Shader

Right click in your Unity Project and do Create > Shader Graph > Blank Shader Graph

Now that we have a Shader Graph file, simply open the editor by double clicking it.

Let’s add some basic shader properties first. Navigate to the Graph Settings and add Built In as a target. We want the ability to control the transparency of our pixels, so also add the Alpha property to our fragment.

In order to properly utilize the Alpha property, we will need to edit the Built In settings Surface Type to Transparent.

Shader Inputs

The first thing to consider is the Player’s world position. Since we want the highlight effect to follow the player, we’ll need some sort of input into the shader.

In the Shader Graph editor, ensure the ‘Blackboard’ option is checked and visible, then click the plus button on the left side of the editor to create an input variable. Make it a Vector3 category. The ‘Name’ is for visual purposes, and the ‘Reference’ field will allow scripts access to the property. Give that some value like “_PlayerPosition” and drag it into the stage.

Since that’s simply a Vector, we need to translate that into something usable for our shader. We need to subtract the input player position from our world position so we can get the individual area to affect.

Right click, and create a Position and Subtract node.

Connect the player position and world position node to the subtract node. At this point your graph should look similar to below.

Next we will need a Length node to translate our position into a distance.

At this point, if we connect the output of our length to our Base Color on our Fragment, we can see a strange divine light.

How can we control the actual effect size?

We need a multiply node and some additional input here to control the highlight amount.

Let’s create a new Multiply node, and a Float input.

Name the Float input something like _EffectStrength, and feed the length output into the new multiply node.

You should have something similar to this, and the shader will go black again. This is simply because we haven’t given it an effect strength yet.

Save this Shader Graph asset and assign it to an object in our scene if you haven’t already.

Notice the warning. This refers to the fact that we aren’t rendering a sprite. This is correct, and can be safely ignored.

Assuming a reference to the sprite renderer component, we can then use the material set property functions to pass along our game values in an Update function or whenever needed.

RevealBG.material.SetVector("_PlayerPosition", position);
RevealBG.material.SetFloat("_EffectStrength", highlightingPlayerAmount);

Set the effect to something visible like 1 for now. We can also set a default through the Shader Graph editor.

All of this grey is pretty boring, so let’s add some color. The ability to edit our colors through scripting is pretty important, so let’s create two new Color variables.

The shader will lerp between these two colors for the highlight effect. We could use only one color considering our goal of mixing the effect with transparency, but the additional color gives more control over the effect appearance.

Create a Lerp node. Connect the output of the previous multiply node to the lerp T input, and the two new colors to the A and B inputs, respectively.

I set BGColor to blue, and PlayerRevealColor to red through the graph inspector to clearly show the shader effect.

If all goes well, you should have a circular gradient in the input colors you’ve specified.

And something like this in your Shader Graph.

That gradient isn’t really the look we want. Instead, we want a tight circular highlight around the player position.

To achieve this, we can add a Step node.

Insert it between the multiply and lerp node at the end, and it will produce a gated circular output.

Adjusting the EffectStrength should make the circle appear larger. Try values from 0 -> 1. Above 1 will make the highlight smaller.

0.5 effect setting
EffectStrength at 0.5
EffectStrength at 0

Now we just need to connect our transparency logic.

Add another Multiply node that we will use for the Alpha property on the Fragment. The input should be our previous multiply node’s output, before the Step node. This allows control over the strength of the highlight fade. I went with 1.5.

You’re pretty much finished!


We can adjust the colors to do screen wave effects like this that could be enhanced with particle effects.

Or as a game over effect where you hide the rest of the stage and highlight the player. I added a purple background sprite behind the player to show the masking effect.

Force fields, lights for dark mazes etc all follow a similar concept.


Source


It helps me if you share this post

Published 2024-01-21 06:00:00

Pure JavaScript Asteroids Clone with Enemy Ships Source Code

There are many acceptable JavaScript game engines out nowadays, but often you can get good performance from writing your own simple engine or renderer depending on your use case. The code for this project will be on my GitHub linked below.

What goes into writing a game engine?

Ideally, we want to handle a few important things.

  1. States, whether that be states of objects (alive, dead, moving, the type of enemy)
  2. Rendering
  3. Spawnable objects (with previously mentioned states)
  4. Input
  5. Save data

We approach this task with an object-oriented mindset instead of a functional programming mindset. Although there are a few global variables such as the overall running game state or the object pool arrays, most of the memory or information we need to remember occurs on a per-object basis.

We will be using a ‘Canvas‘ to draw our simple asteroid graphics. Writing a 3d renderer in JS is a much more complex task, although libraries like threeJS exist to get you started.

To begin with, we want to define a Vector2D class that we can reuse throughout our game. I’m familiar with Unity so I imagine an implementation similar to their engine’s GameObject setup, but any class that can read / write an X and Y will work.

var Vec2D = (function() {
var create = function(x, y) {
        var obj = Object.create(def);
        obj.setXY(x, y);

        return obj;
    };

    var def = {
        _x: 1,
        _y: 0,

        getX: function() {
            return this._x;
        },

        setX: function(value) {
            this._x = value;
        },

        getY: function() {
            return this._y;
        },

        setY: function(value) {
            this._y = value;
        },

        setXY: function(x, y) {
            this._x = x;
            this._y = y;
        },

        getLength: function() {
            return Math.sqrt(this._x * this._x + this._y * this._y);
        },

        setLength: function(length) {
            var angle = this.getAngle();
            this._x = Math.cos(angle) * length;
            this._y = Math.sin(angle) * length;
        },

        getAngle: function() {
            return Math.atan2(this._y, this._x);
        },

        setAngle: function(angle) {
            var length = this.getLength();
            this._x = Math.cos(angle) * length;
            this._y = Math.sin(angle) * length;
        },

        add: function(vector) {
            this._x += vector.getX();
            this._y += vector.getY();
        },

        sub: function(vector) {
            this._x -= vector.getX();
            this._y -= vector.getY();
        },

        mul: function(value) {
            this._x *= value;
            this._y *= value;
        },

        div: function(value) {
            this._x /= value;
            this._y /= value;
        }
    };

    return {
        create: create
    };
}());       

This will allow us to reference positions easier. It’s vital to implement a few capabilities for our renderer. One important need is to be able to draw an object to our canvas at a specified position, and have the capability to clear said canvas, preparing for the next frame the game renders.

To draw a line, we can write JavaScript such as:

var c = document.getElementById("canvas");
var ctx = c.getContext("2d");
ctx.moveTo(0, 0);
ctx.lineTo(200, 100);
ctx.stroke();

And if we wanted to clear our canvas, we can use clearRect:

ctx.clearRect(0, 0, canvas.width, canvas.height);

We can define a render function to handle our different objects.

window.getAnimationFrame =
    window.requestAnimationFrame ||
    window.webkitRequestAnimationFrame ||
    window.mozRequestAnimationFrame ||
    window.oRequestAnimationFrame ||
    window.msRequestAnimationFrame ||
function(callback) {
    window.setTimeout(callback, 16.6);
};
render(){
    context.clearRect(0,0,screenWidth,screenHeight);
    renderShips();
    renderAsteroids();
    renderBullets();
    getAnimationFrame(loop);
}

renderShips(){
    ship.renderSelf();
    for (int i = 0; i < enemies.length; i++)
    enemies.renderSelf();
}
...etc

Then an example render self function:

renderSelf: function() {
    if (this.hasDied)
        return;
    context.save();
    context.translate(this.pos.getX() >> 0, this.pos.getY() >> 0);
    context.rotate(this.angle);
    context.strokeStyle = playerColor;
    context.lineWidth = (Math.random() > 0.9) ? 4 : 2;
    context.beginPath();
    context.moveTo(10, 0);
    context.lineTo(-10, -10);
    context.lineTo(-10, 10);
    context.lineTo(10, 0);
    context.stroke();
    context.closePath();

    context.restore();
}

Which would render our object assuming a class holding some variables with our Vector2 class we described earlier.

var Ship = (function() {
var create = function(x, y, ref) {
    var obj = Object.create(def);
    obj.ref = ref;
    obj.angle = 0;
    obj.pos = Vec2D.create(x, y);
    obj.vel = Vec2D.create(0, 0);
    obj.thrust = Vec2D.create(0, 0);
    obj.invincible = false;
    obj.hasDied = false;
    obj.radius = 8;
    obj.idleDelay = 0;
    obj.isSpectating = false;

    return obj;
};
...etc

We are handling rendering and state management from inside an object now. All that just for a triangle.

player ship

We aren’t done yet. Next we need to handle Input. The goal with creating object classes is reusability and extensibility. We don’t need to spawn multiple instances of an input, so we can handle that globally. Your Input function may look something like this:

window.onkeydown = function(e) {
    switch (e.keyCode) {
        //key A or LEFT
        case 65:
        case 37:
            keyLeft = true;
            break;
            //key W or UP
        case 87:
        case 38:
            keyUp = true;
            break;
            //key D or RIGHT
        case 68:
        case 39:
            keyRight = true;
            break;
            //key S or DOWN
        case 83:
        case 40:
            keyDown = true;
            break;
            //key Space
        case 32:
        case 75:
            keySpace = true;
            break;
            //key Shift
        case 16:
            keyShift = true;
            break;
    }

    e.preventDefault();
};

window.onkeyup = function(e) {
    switch (e.keyCode) {
        //key A or LEFT
        case 65:
        case 37:
            keyLeft = false;
            break;
            //key W or UP
        case 87:
        case 38:
            keyUp = false;
            break;
            //key D or RIGHT
        case 68:
        case 39:
            keyRight = false;
            break;
            //key S or DOWN
        case 83:
        case 40:
            keyDown = false;
            break;
            //key Space
        case 75:
        case 32:
            keySpace = false;
            break;
            //key Shift
        case 16:
            keyShift = false;
            break;
    }

    e.preventDefault();
};

e.preventDefault() will stop users from accidentally hitting keys such as ctrl + L and losing focus from the window, or jumping the page with Space, for instance.

function updateShip() {
    ship.update();

    if (ship.hasDied) return;

    if (keySpace) ship.shoot();
    if (keyLeft && keyShift) ship.angle -= 0.1;
    else if (keyLeft) ship.angle -= 0.05;
    if (keyRight && keyShift) ship.angle += 0.1;
    else if (keyRight) ship.angle += 0.05;

    if (keyUp) {
        ship.thrust.setLength(0.1);
        ship.thrust.setAngle(ship.angle);
    } else {
        ship.vel.mul(0.94);
        ship.thrust.setLength(0);
    }

    if (ship.pos.getX() > screenWidth) ship.pos.setX(0);
    else if (ship.pos.getX() < 0) ship.pos.setX(screenWidth);

    if (ship.pos.getY() > screenHeight) ship.pos.setY(0);
    else if (ship.pos.getY() < 0) ship.pos.setY(screenHeight);
}

...etc

function checkDistanceCollision(obj1, obj2) {
    var vx = obj1.pos.getX() - obj2.pos.getX();
    var vy = obj1.pos.getY() - obj2.pos.getY();
    var vec = Vec2D.create(vx, vy);

    if (vec.getLength() < obj1.radius + obj2.radius) {
        return true;
    }

    return false;
}

...etc

Once we have the ability to render a reusable object to a canvas and read / write a position that can be checked, we use that as a template to create other objects (particles, asteroids, other ships).

hexagon asteroid
enemy ship example

You can make interesting graphics with just basic shapes. We handle collision by assigning either an xWidth and yWidth + xOffset and yOffset, OR a radius. This again would be assigned to the object itself to keep track of.

asteroids game example

Further Techniques

If we can control the rendering manually we can leave an ‘afterimage’ on our canvas before rendering the next frame as opposed to clearing it entirely. To do this, we can manipulate the canvas’ global alpha.

// Get the canvas element and its 2D rendering context
const canvas = document.getElementById('myCanvas');
const ctx = canvas.getContext('2d');
// Set the initial alpha value
let alpha = 0.1; // You can adjust this value to control the fading speed
// Function to create the afterimage effect
function createAfterimage() {
    // Set a semi-transparent color for the shapes
    ctx.fillStyle = `rgba(255, 255, 255, ${alpha})`;
    // Fill a rectangle covering the entire canvas
    ctx.fillRect(0, 0, canvas.width, canvas.height);
    // Decrease alpha for the next frame
    alpha *= 0.9; // You can adjust this multiplier for a different fade rate
    // Request animation frame to update
    requestAnimationFrame(createAfterimage);
}
// Call the function to start creating the afterimage effect
createAfterimage();

And a simple localStorage can be used to save scores.

function checkLocalScores() {
    if (localStorage.getItem("rocks") != null) {
        visualRocks = localStorage.getItem("rocks");
    }
    if (localStorage.getItem("deaths") != null) {
        visualDeaths = localStorage.getItem("deaths");
    }
    if (localStorage.getItem("enemyShips") != null) {
        visualEnemyShips = localStorage.getItem("enemyShips");
    }
    updateVisualStats();
}
function saveLocalScores() {
    localStorage.setItem("rocks", visualRocks);
    localStorage.setItem("deaths", visualDeaths);
    localStorage.setItem("enemyShips", visualEnemyShips);
}

End Result

You can see and play the game here.

Source code is here. โœจ


It helps me if you share this post

Published 2023-11-30 23:51:07

Starbound 1.4.4 Source Code

Starbound has been one of my favorite games of all time, so I’m happy to say that I have the latest Starbound source code, last commit August 7th, 2019. I will not be explaining how I got these files. It is the actual source, not just a decompilation, and as such includes build scripts, unused stuff, old migration code, comments, a stored test player, etc.

Source Screenshots

The source has minimal comments, and the structure is reasonable. I found the code easy to read and understand, but perhaps that’s because I’ve been modding Starbound for years now and am familiar with its behavior.

Languages Breakdown (GitHub)

StarEnvironmentPainter.cpp

StarEnviroment.cpp preview

StarMixer.cpp (audio related)

StarMixer.cpp source preview

StarTools.cpp

StarTools.cpp source preview

Building

And of course, we can build it. I compiled this version without Steam API or the Discord rich presence API, but those are easily included.

Skip to 1:10 to see the game launch

Funny Developer Comments

Here’s a look at some of the best (in my opinion) developer comments in the source. This is not intended to be a mockery, far from it, I’m ecstatic I can take a peek into the minds of the developers. Enjoy.

// message is fullbody encrypted so the response is trust worthyish
// message is fullbody encrypted so the response is trust worthyish

// Meh, padding is hard-coded here
// Meh, padding is hard-coded here

// TODO: I hate these hardcoded values.  Please smite with fire.
// TODO: I hate these hardcoded values. Please smite with fire.

// TODO: Get rid of this stupid fucking bullshit, this is the ugliest
// fragilest pointlessest horseshit code in the codebase.  It wouldn't
// bother me so bad if it weren't so fucking easy to do right.
// TODO: Get rid of this stupid fucking bullshit, this is the ugliest
// fragilest pointlessest horseshit code in the codebase. It wouldn’t
// bother me so bad if it weren’t so fucking easy to do right.

// This was once simple and elegant and made sense but then I made it
// match the actual platform rendering more closely and now it's a big
// shitty pile of special cases again. RIP.
// This was once simple and elegant and made sense but then I made it
// match the actual platform rendering more closely and now it’s a big
// shitty pile of special cases again. RIP.

Example: Simple Re-implementation of Vapor Trail and Sitting Toolbar Usage

At some point during development, Chucklefish had the idea to add a vapor trail when the player was falling fast. I could’ve sworn I saw a post on their news about it back when the game was in beta, but I can’t find it now. Anyway, we can add a small snippet to restore it, as an example of further engine work Starbound can benefit from.

// Vapor trail
if (m_movementController->velocity()[1] < -50) {
  m_vaporTrailTimer += WorldTimestep;
  if (m_vaporTrailTimer > 1)
      m_humanoid->setVaporTrail(true);
  }else{
  m_vaporTrailTimer = 0;
  m_humanoid->setVaporTrail(false);
}

By adding this snippet, we can see what it was roughly meant to look like.


We can also modify Player restrictions such as

bool Player::canUseTool() const {
  return !isDead() && !isTeleporting() && !m_techController->toolUsageSuppressed() && m_state != State::Lounge;
}

to just

return !isDead() && !isTeleporting() && !m_techController->toolUsageSuppressed();

Allowing us to use our inventory while sitting down

Further Thoughts

Future work on the engine can lead to further modding capabilities and engine optimizations. There are many potential client side performance improvements that could be made without touching any network code. This would maintain compatibility with the vanilla client. The netcode could be updated as well, but this would break compatibility once major changes were made. If both (or more) parties are willing to use a modified client, any theoretical modification could be made. The possibilities are endless.

As of 2024, there now exists a few Starbound open source community projects with the aim of enhancing the base game’s experience. : )


It helps me if you share this post

Published 2023-05-27 04:55:45

Applying custom Windows styles to Firefox, Chrome, and other Chromium browser’s window buttons in Windows 10 & 11

Typically, browser vendors force default button styles onto the program. This can be troublesome when you use something like SecureUxTheme to change your Windows styles, and you care about the cohesiveness. There is a hacky solution, even if the Firefox forums told me there wasn’t. ๐Ÿ˜‰

DEFAULT: Custom themed Notepad next to standard browsers

For Google Chrome, Edge, Brave, and some other Chromium-based browsers

For Chromium based browsers you can simply change the shortcut target to allow launching with your custom changes.

  1. Open start menu.
  2. Search and find your browser shortcut
  3. Right-click, and open file location
  4. Right click > open Properties of the browser shortcut (The shortcut for Chrome in the Start Menu may be found in C:\ProgramData\Microsoft\Windows\Start Menu\Programs)
  5. Add this line --disable-windows10-custom-titlebar to the end of the Target field after a space. (For Chrome, “C:\Program Files\Google\Chrome\Application\chrome.exe” becomes “C:\Program Files\Google\Chrome\Application\chrome.exe” –disable-windows10-custom-titlebar )
  6. In order for your changes to show up you may need to use Task Manager (ctrl + shift + esc) and kill all background processes of that browser
  7. Repeat for each browser shortcut you use.

Changing the Registry Launch settings

This is all well and good but what if you click on a link and the browser opens automatically? Now we aren’t using the custom launch option anymore. We can edit the registry to fix this.

This is the “I’m not responsible if you break your computer” warning: BE SURE TO ALWAYS MAKE A BACKUP OF THE REGISTRY BEFORE PERFORMING ANY CHANGES.

  1. Launch the Registry Editor (Win + R, regedit)
  2. Navigate to Computer\HKEY_CLASSES_ROOT\ChromeHTML\shell\open\command
  3. Change the (Default) value from "C:\Program Files\Google\Chrome\Application\chrome.exe" --single-argument %1 to "C:\Program Files\Google\Chrome\Application\chrome.exe" --disable-windows10-custom-titlebar --single-argument %1
    • We are essentially just adding that custom launch argument onto the default launch arguments Windows calls when it opens the program
  4. Starting the browser now use your themed settings. Older versions Chromium may have a different startup option. Try --disable-features=Windows10CustomTitlebar if it doesn’t work for you

Firefox

Firefox needs CSS and changing an internal flag in order to work.

  1. Open your Firefox profile. You can find it in %appdata%\Mozilla\Firefox\Profiles, try looking at the one most recently modified.
  2. If the folder doesn’t exist already, create a folder called ‘chrome‘. Yes, this is the tutorial for Firefox.
  3. Inside the ‘chrome‘ folder in your profile, create or edit the file ‘userChrome.css‘.
  4. Put these contents (or embedded down below) into the css file, either on its own or adding to what is already there. You can modify anything you want, such as the ‘titlebar-button:hover’ alpha value to your liking.
  5. Open a new Firefox window
  6. Enter about:config into the URL bar, and bypass the warning
  7. Change the toolkit. legacyUserProfileCustomizations. stylesheets option to true by double clicking.
  8. Restart Firefox
@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
@namespace html url("http://www.w3.org/1999/xhtml");
.titlebar-button {
background-color: transparent !important;
transition: background-color 0.5s ease;
height: 0px;
}
.titlebar-button>.toolbarbutton-icon {
list-style-image: none;
}
.titlebar-button:hover {
background-color: rgba(121, 121, 121, 0.1) !important;
}
#titlebar-close:hover {
background-color: rgba(121, 121, 121, 0.1) !important;
}
#titlebar-close:hover>.toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/caption-buttons.svg#close-white") !important;
}
#main-window {
-moz-appearance: -moz-win-glass !important;
background: transparent !important;
}
#navigator-toolbox {
background: transparent !important
}
view raw userChrome.css hosted with ❤ by GitHub

And finally, get my better dark theme for Firefox. ๐Ÿ™‚


Now your browser buttons look sleek and uniform, just like the rest of your system.


It helps me if you share this post

Published 2022-07-31 09:03:00

Undertale Mobile Native Android Build with Controller & Keyboard Support + Save Editor

What the heck?” I hear yourself asking.

“Is there even an android version of the game out?” No. ๐Ÿ™‚

Undertale has been one of the most influential and one of my favorite games of all time. Since the game’s release in 2015 I’ve been entranced by its secrets and storyline. I played it blind when it first came out and have been hooked ever since.

I’ve been a part of a few different Undertale data mining communities over the years and although I admit there probably aren’t any secrets left, I’m still interested in any new theories or fan works/mods.

I came across a method to patch gamemaker files including Undertale to mobile, and then discovered there’s already been some work in the community into this area. I took the existing mobile Undertale modifications online and added full controller and keyboard support (note this build is Android only). YOU CAN HIDE THE ADDED GAMEPAD IN THE GAME’S BUILT IN SETTINGS MENU. SET THE BUTTON OPACITY TO 0. โค๏ธ

A save editor has also been added into the game. If you visit the SETTINGS menu from either the beginning of the game or the Continue menu, you can overwrite your save file with presets. Save file preset names are below, but THEY CONTAIN SPOILERS (if you haven’t somehow heard/played UNDERTALE already)

This along with the added Bluetooth controller support should make it bearable to play Undertale on mobile devices!

Screenshots

This build is for educational purposes and Undertale research only.


Download

v0.1.0
– Updated internal Undertale version to v1.08
– Fixed name selection screen crash
– Add more name easter eggs
– Fix save editor crash
DOWNLOAD: [APK FILE FOR ANDROID ONLY]

v0.0.8
– Initial test
[download removed]


It helps me if you share this post

Published 2022-06-17 07:39:00

Mass Discord Message Remover / Deleter Script – Remove Lots of Instant Messages

With this script, you can automate the removal of a massive quantity of discord messages (everything back to a channel’s origin, if wanted), including in personal channels. I used it personally to delete a conversation with over a year of messages. There were no problems after the proper modifications.

You will need Tampermonkey. This is an extension for your favorite browser that will allow you to run custom JavaScript.


Next, visit the delete discord messages repository. You will need to click the ‘userscript.js‘ file listed upon visiting the url. Copy everything (CTRL + A / CTRL + C) and install it. The script obviously does nothing malicious but you can also take this opportunity to verify for yourself.

To use, click the trash can icon in the channel or DM you want to delete and press “START”.

You can also add a ‘before message id’ or ‘after message id’ to control how much you delete.

The script will try to respect Discord’s limits as much as possible, backing off as necessary when Discord errors. I cannot promise you will not be banned for selfbotting or something, but I have used it many times and my account is fine. Just to be safe you shouldn’t be doing anything else on your account while the script is deleting (it will also slow down and cause problems anyway). AFAIK this doesn’t violate anything in terms of service but use at your own risk, as always.


It helps me if you share this post

Published 2022-03-06 20:55:47