设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 72|回复: 0

[制作教程] Writing an automated build script for MV games

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    前天 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    4446

    主题

    864

    回帖

    2万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    22899
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    28239

    灌水之王

    发表于 4 天前 | 显示全部楼层 |阅读模式
    When working with custom tools (like my Cook Tool) it can be daunting to build the game before publishing. In this tutorial, I’ll show you how to build your own build script so you can automate the chores (and have a custom executable).

    Requirements​


    • PowerShell 7 or newer
    • Node.js (either LTS or Stable)
    • An MV project
    • An icon in the .ico format.
    Step 1: Build the exe script​

    Spoiler

    • Download Node.js and PowerShell from the sites (or type winget install OpenJS.NodeJS and winget install Microsoft.PowerShell, if you have winget installed). If you are using Linux or macOS, look up if your package manager provides these.
    • After exporting the game, edit the package.json file and add the “app_name” and “version” tags.
    • Find a folder that you’ll put the exported project on. The project should be on in a folder inside it.
    • Create two files: One called buildPackage.ps1 and another called buildExecutable.js
    • Open the ps1 file. Then write the following:
      Get-ChildItem -Path ‘.\<Game Folder>’ -Exclude “www”, “package.json” | Remove-Item -force -RecurseRemove-Item -Path “.\www\package.json”node buildExecutable.js
      Important! If you have any folders outside of the www folder (and need to keep), add it to the exclude list.
    • Save the .ps1 file.
    • Open the command line (or the terminal) on the folder, then type npm install nw-builder --save-dev.
    • Once the nw-builder is installed, open the js file and put this script:
    var gameName = '<Game Name>';var gameVersion = '<Game Version>';var gameTag = '<GameName>';var NwBuilder = require('nw-builder');var nw = new NwBuilder({files: '<Game Folder>/**', // use the glob formatflavor: 'normal',version: '0.22.0', //Specifies the version of nwjs. Remove this to get the latest version.appVersion: gameVersion,platforms: ['win64', 'linux64'], //Change this if you want to target more or less platformszip: false, //Only turn this to true. This may affect startup times on WindowsappName: gameTag,//Windows SpecificwinVersionString: {'FileVersion': gameVersion,'InternalName': gameTag,'ProductVersion': gameVersion,'CompanyName': '<Dev Name>','FileDescription': gameName,'ProductName': '<Game or Series Name>','OriginalFilename': '<GameName>.exe','LegalCopyright': '<Insert copyright here>',},winIco: "Game.ico" //It should be in the same folder as this script});// Log stuff you wantnw.on('log', console.log);nw.build().then(function () {console.log('all done!');}).catch(function (error) {console.error(error);});

    That’s all. Save the file, run PowerShell and then execute the ps1 script (after you navigate to the folder where both scripts live) with .\buildPackage.ps1.



    Step 2: Chaining the other tools​

    SpoilerIn order to get the tools working with the script, it’s a simple line add before or after the js line. In the ps1 script, add this line:

    Start-Process <tool executable> -NoNewWindow -PassThru -Wait -Arguments ‘<Arguments for the tool go here>’



    Step 3: Customizing and expanding the script​

    SpoilerThis step is left up to you. PowerShell is pretty powerful and you can do a lot of stuff with it.  Want to create a zip file? You can. Want to edit a few files before creating? That too. Take a look at the documentation of PowerShell. Look on some tutorials. Experiment.






    本贴来自国际rpgmaker官方论坛作者:AceOfAces处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/writing-an-automated-build-script-for-mv-games.140125/
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-14 14:21 , Processed in 0.132888 second(s), 55 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表