Author Topic: miniSphere 4.5.11  (Read 133069 times)

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1635 on: June 12, 2017, 07:53:41 pm »
@DaVince: In your Cellscript template, The files() for transpile should be recursive, as most people, myself included, like to organize scripts into subfolders.  For a native Sphere v2 game that doesn't need backward compatibility, I also recommend transpiling into @/bin (rather than @/scripts), as a hint to a person looking at the distro that the game has been compiled in some way and they should look for the real source code if they want to make edits.

In other words:
Code: (javascript) [Select]
transpile('@/bin/', files('src/*.mjs', true));
transpile('@/bin/', files('src/*.js', true));
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline DaVince

  • Used Sphere for, like, half my life
  • Administrator
  • Hero Poster
  • *****
  • Posts: 824
    • View Profile
    • Vincent Beers portfolio
Re: miniSphere 4.5.11
« Reply #1636 on: June 13, 2017, 11:49:03 pm »
Okay, I'll  make the changes. And now I know what the true statement is for. :P

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1637 on: June 14, 2017, 12:05:50 am »
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1638 on: June 17, 2017, 02:23:45 am »
I want to refactor the standard library for miniSphere 5.0.  The code is all over the place currently and different modules use different styles; they sometimes don't even use module.exports consistently. What I think I'd like to do is reorganize it so that the CommonJS view is split at the object level--each require() module would correspond to a single namespace, function, or class--while the ES6 view would have it all merged into a single composite module, making everything more intuitive for both environments.

Node style (CommonJS):
Code: (javascript) [Select]
const from     = require('from'),
      Delegate = require('delegate'),
      Music    = require('music'),
      Scene    = require('scene');

ES6 style:
Code: (javascript) [Select]
import { from, Delegate, Music, Scene } from 'miniRT';
Which really shows the strength of the ES6 module syntax compared to old-style require() :)
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1639 on: June 17, 2017, 10:50:51 am »
There will be some minor compatibility breakage in miniSphere 4.6 in preparation for the above change.  I can still technically do that because the Sphere v2 API hasn't been finalized yet ;)
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1640 on: June 18, 2017, 09:55:33 am »
Idea I had: Example project could take advantage of classes:

Code: (javascript) [Select]
import Thread from 'thread';

class Game extends Thread
{
    constructor() {
        super();
        // startup code
    }

    on_update() { ... }
    on_render() { ... }
}

new Game();

The Thread constructor sets up the dispatch automatically, avoiding the need to deal with the Dispatch API or threader directly.
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1641 on: June 19, 2017, 12:13:44 am »
This is what the new game template looks like now:
https://github.com/fatcerberus/minisphere/blob/master/assets/template/src/main.mjs

Much cleaner and doesn't require you to understand the Dispatch API :D
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline DaVince

  • Used Sphere for, like, half my life
  • Administrator
  • Hero Poster
  • *****
  • Posts: 824
    • View Profile
    • Vincent Beers portfolio
Re: miniSphere 4.5.11
« Reply #1642 on: June 19, 2017, 03:44:01 am »
Looks great, much easier to get started with!

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1643 on: June 19, 2017, 09:32:54 am »
Regarding file association, I think Linux has regex-based associations, so we could define a standard that the first field in the JSON file must be version and then use a regex like...

Code: (regexp) [Select]
^{\s*(?:\r?\n)*\s*version:\s*\d*
...to associate them with miniSphere without pulling in all JSON files.  Unfortunately Windows associates only based on file extension :(
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline DaVince

  • Used Sphere for, like, half my life
  • Administrator
  • Hero Poster
  • *****
  • Posts: 824
    • View Profile
    • Vincent Beers portfolio
Re: miniSphere 4.5.11
« Reply #1644 on: June 19, 2017, 09:43:06 am »
Well, why not give it its own extension then? I still think s2gm is a good candidate (for a file extension), and the contents can just stay the JSON format that they're in.

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1645 on: June 19, 2017, 09:49:05 am »
The reason I chose game.json was for consistency with Node.js package.json.  I wanted more veteran JS developers (like myself ;)) to find Sphere approachable and familiar too, not just newbies.  Plus .json is more likely to have "Edit" as an option in its right-click menu in a default Windows setup, whereas an unknown format won't be associated with anything.

And you can always compile to an SPK ;)

I guess both have their pros and cons.  I'll revisit the issue after I finish up the module reorganization and release miniSphere 4.6.
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline DaVince

  • Used Sphere for, like, half my life
  • Administrator
  • Hero Poster
  • *****
  • Posts: 824
    • View Profile
    • Vincent Beers portfolio
Re: miniSphere 4.5.11
« Reply #1646 on: June 19, 2017, 10:01:57 am »
Sounds fair, although to me it's felt like the json file just tends to be the resulting file after compiling with Cell (even if not strictly necessary), especially now that ES6 transpilation is going to be a common thing. I always found having a project file to double-click in order to run it more convenient.

Well, I guess since I've only recently started learning the New Way of Doing Things, I'm still totally used to having the sgm. :P

Offline Fat Cerberus

  • miniSphere Developer
  • Global Moderator
  • Kitty-Eating Cow
  • *****
  • Posts: 2228
  • *MUNCH*
    • View Profile
Re: miniSphere 4.5.11
« Reply #1647 on: June 20, 2017, 09:54:39 am »
miniRT is being promoted to a first-class part of the Sphere v2 API.  This will split the API into two levels: the low-level Core API which can't be implemented in script such as Galileo, Audialis and the like, and sphere-runtime, which is more high-level with stuff like the Thread class, Scenario, the Music manager, and more.

I'm hoping this change will make Sphere v2 more approachable, as I've noticed that people tend to get scared away due to the more low-level design.  I try to point people to miniRT as consolation, but I think there's a stigma there due to it seeming like a third-party add-on, albeit one that happens to be bundled.  Making it an official part of Sphere v2 increases the burden for standardization, but should avoid the "inferiority complex". :P
miniSphere 4.5.11 - Cell compiler - SSJ debugger
Forum Thread | GitHub Repo

Offline DaVince

  • Used Sphere for, like, half my life
  • Administrator
  • Hero Poster
  • *****
  • Posts: 824
    • View Profile
    • Vincent Beers portfolio
Re: miniSphere 4.5.11
« Reply #1648 on: June 20, 2017, 03:11:01 pm »
I think this is a really good idea, and it's good that you're pretty much immediately showcasing what it can do in the example project.

Offline Eggbert

  • Verified
  • Medium Poster
  • *
  • Posts: 206
    • View Profile
    • My GitHub
Re: miniSphere 4.5.11
« Reply #1649 on: June 20, 2017, 04:26:38 pm »
I agree, especially considering image/surface blitting can be very tedious without the respective miniRT module. It's almost necessary.