Anyway to load a custom library in MV?

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
I've been working along with my programmer on a plugin, and it uses png files. There's a loss of transparency when the png files are saved/compressed, creating a faint outline around them. We want no quality loss to the images, so we've been looking into solutions.

So my programmer says he can get around it using a different library, but he doesn't know how to load a custom library in MV. For example, he'd like to load this one. Is it possible, and if so, how?

If there is no way to load said library is there any way to save png files using "toDataURL("image/png", 1)" without any loss of transparency?
 

MRHAPPYFACEMAN

Story Writer and Plot Development
Veteran
Joined
Dec 30, 2016
Messages
120
Reaction score
19
First Language
ENGLISH
I don't know, but I will write in this thread to get updates from it because that sounds pretty cool from what I understood.
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
So my programmer says he can get around it using a different library, but he doesn't know how to load a custom library in MV. For example, he'd like to load this one. Is it possible, and if so, how?
very simple way in the index.html file symply download the JS libs
and Add to your custom Html file
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="viewport" content="user-scalable=no">
<link rel="icon" href="icon/icon.png" type="image/png">
<link rel="apple-touch-icon" href="icon/icon.png">
<link rel="stylesheet" type="text/css" href="fonts/gamefont.css">
<title>A NEW FANTASTIC TIME tale of middle galaxi</title>
</head>
<body style="background-color: black">
<script type="text/javascript" src="js/libs/******my new js"></script> // add you new lib here
<script type="text/javascript" src="js/libs/pixi.js"></script>
<script type="text/javascript" src="js/libs/pixi-tilemap.js"></script>
<script type="text/javascript" src="js/libs/pixi-picture.js"></script>
<script type="text/javascript" src="js/libs/fpsmeter.js"></script>
<script type="text/javascript" src="js/libs/lz-string.js"></script>
<script type="text/javascript" src="js/rpg_core.js"></script>
<script type="text/javascript" src="js/rpg_managers.js"></script>
<script type="text/javascript" src="js/rpg_objects.js"></script>
<script type="text/javascript" src="js/rpg_scenes.js"></script>
<script type="text/javascript" src="js/rpg_sprites.js"></script>
<script type="text/javascript" src="js/rpg_windows.js"></script>
<script type="text/javascript" src="js/plugins.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</body>
</html>
 
Last edited:

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
The above will work fine and the plugin should be available in game as stated on the npm page. But, just be careful, since it does use node, and any project that's using node shouldn't technically work in the browser.
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
Strange; I ran a custom library for live2D in RMMV. I could take a look and see if I can make it work. Is this game only for embedded systems or is it for browser too? @Celianna
 

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
It's not meant for a browser, so there's no issues there. As long as it can run on a blank MV project, my programmer can get it to work on mine.

Interesting you got Live2D to work in MV! Nice to hear that's possible :)
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
Unfortunately, the plugin doesn't load, even with @Jonforum's suggestion. My programmer can't get it to load at all :(
Have you try to load it in a different order, because the orde has an importance.
If your library conflicts with another it will be overwritten
These in the same principle as creating a website, some librayry have to be loaded before in the header and other in the footer to avoid conflated between librairy JS.

Otherwise I do not see why it is not loading.
 

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
@Jonforum he's tried just about everything but he can't seem to get it to load at all. Do you think you can try it yourself and load it on a blank MV project? See if that works?
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,439
First Language
French
Primarily Uses
RMMV
@Jonforum he's tried just about everything but he can't seem to get it to load at all. Do you think you can try it yourself and load it on a blank MV project? See if that works?
it load in the html but give after error !
Uncaught ReferenceError: module is not defined
I guess you have to follow the complete installation guide here.
https://www.npmjs.com/package/pngjs#installation

Your programmer can take a closer look at how the module is installed
with ref of pixi-picture.js , lz-string.js, pixi.js

But it sounds hyper complex, and very far from my ability.
Code:
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.PIXI = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var EMPTY_ARRAY_BUFFER = new ArrayBuffer(0);
 

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
@Celianna I got the module to work and you can access it under the name PNG, like mentioned on the npm page; had to bundle it with browserify since it was so many different files, and didn't want to use webpack.

You'll need these two files:
Place the lib-png.js in the RMMV js/libs folder for your project, and activate the plugin in the PluginManager.
Hope this helps with your project.

Also, this is a good blog post detailing how browserify bundles a standalone: Browserify
 

Attachments

Last edited:

Kino

EIS Game Dev
Veteran
Joined
Nov 27, 2015
Messages
556
Reaction score
794
First Language
English
Primarily Uses
RMMV
@Celianna Awesome; glad I could help. Lol for a moment there, I was wondering if it would work on your end or not.
 

cabfe

Cool Cat
Veteran
Joined
Jun 13, 2013
Messages
2,353
Reaction score
2,549
First Language
French
Primarily Uses
RMVXA
Good that the problem is solved that way, but wouldn't it be better/faster to fix this loss of transparency issue?
It shouldn't happen in the first place.
 

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
Ah yes, the transparency issue was after all, not something that was solved with this custom library. My programmer found the issue, and knows the solution (something about the snapshot he was taking was causing the issue, but he doesn't know how to copy a mask onto bitmap any other way). But that's a different issue!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,093
Members
137,587
Latest member
Usagiis
Top