Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Hey hey :) Ok I see you've been messing around a bunch ^-^ and it actually fills me with joy someone is using the engine to make something!

I will try to go through the things in order as I understand them:

Global variable: you can put the variable on the window like "window.something = 2;". But putting in on a persistent object is also not a bad idea.

I never realized goToRoom is not in the reference, I think I simply forgot. You use it like this: "goToRoom(room0)", room0 being the name of the room (trash engine creates a global variable for every room/sprite/etc pointing to an internal room id). For trashovania I do some funny hacking to make the rooms work, I think, something like window["room_"+x+"_"+y], to access those global variables.

On findClosest: Calling this function on creation might not work, since the instances are created in a certain order, so it might not exist yet. Also for findClosest you need to provide x,y coordinates, if you just want to find any object use find(gamemode).

On the versions issue: Not at all sure what's going on. But relevant information is that trash engine stores game data in your browser. So if you make changes to, for example, trashovania, using the remix functionality, those changes will stay until you clear the indexeddb storage in your browser or use the "delete data" button in the settings. This is tied to the domain (like itch.io) and the game id (which you can change in the settings), so there can be some problems where different games access the same save data. If you go to the settings in your mod and change the id to something else that might fix it, but just a guess. The browser save data system was quite complicated to implement, and I'm not confident that there aren't any bugs in it. Also not exactly sure what kind of "upgrade()" you are referring to, kind of blanking on this one.

I don't think there really is a good way to use trash engine with version control. There is the save/load system, or you just export the game regularly and keep those as backups. The project on github is really just for developing the engine itself but the game is still stored in the browser (in the localhost domain).

I know this whole storage situation might be confusing it's not a very obvious system :d

Anyways, I hope I have answered your questions to your satisfaction! Unfortunately I am not developing trash engine very actively right now for lack-of-time reasons, but seeing the issues you run into gives me a good idea on which parts of the engine to improve when I get around to it! :>

(Also I'm on on my phone right now, but I will check out the mod, when I'm back on a computer)

window.blablabla works! Thank you! Yes, i saw rooms transitions, pretty smart, tho i improved it by also using "roomName+x+y", so for example if you are in room "badfgdf_0_5" and you go somewhere, you go in "badfgdf_3434_439, so prefix stays." "upgrade()" is function, which i saw in gameName.html (after "export game"), it's in start, and it's name and code make me think that it upgrades game to newer version. I can try to change ID, but idk if that would work :p. Probably if i'll change it then it will be disconnected from trash engine (right what i need), and you should add option "change ID on export to:" in settings :>

Oh, i'm not sure which Id to change. When i use search, there are a lot of Id, but i don't think any of them is right. You said "can change in settings", but there is nothing about id. Ig Id is project name, which you can change it top. Only problem is what when i'm trying to search for it, vscode lags, cuz all data is in one line >_< Ig i will try to change project name, export, and change it back lol. Probably after that best solution is to do changes in one Id, and when everything works correctly/when i want to release new version i should change project Id and save it lol. idk.

Sorry it took me a while to respond. It turns out the game id is a feature that I only experimentally tested out on my machine, but never fully implemented, sorry >.< The "different games sharing the same save data" is a problem I have been aware of, but my brain remembered me fixing it, when in reality the version on itch still has this problem. So the save data problem is 100% a bug, I will try to fix it soon!

The upgrade coming from gameName.html makes sense, this file contains a lot of generated code (I'm using a web framework called svelte), and the upgrade funtion comes from the framework, not from me. The exported file is really not meant to be edited directly. If you really need to change things there, the section of the html within the <script type="gamedata>..</script> tag contains the entire game, the rest is just the engine.

That being said, there should be a place in the html thats says:

const NAME = "trash_engine";
const STORE_NAME_RESOURCES = "game_data";

Changing any of these strings to something else might work, but I haven't really tested it.