Skip to main content

News

Recent Posts

91
Projects / Re: Project ZeC (My Zelda-esque Clone)
Last post by DaVince -
Hey, how's progress? This is one of these projects I really like following. :)
92
Sphere General / Re: Proper way of using Sphere?
Last post by DaVince -
Really? That's all there is to them? Huh, thought they'd be more complicated than that.

And yeah, I've peeked into the Discord. Looks like you guys talk about stuff related to developing the engine that I can barely make sense of.
That's just in the #engine-dev channel, which you could mute. #game-dev is there for game development questions and talk, and #spherical for any Sphere or community related talk at all.

Also, now that I'm actively working on a game, that's at least one person who's not talking about the complex inner mechanics all the time! But yeah, it'd be nice to have more people working on projects there, especially since it makes asking and answering questions so easy. It's very motivating.
93
Sphere General / Re: Proper way of using Sphere?
Last post by Fat Cerberus -
It used to be more complicated with CommonJS but now that it's built into the language, modules are very simple - you export from one file and import to another.  If you don't export it you can't access it from outside.
94
Sphere General / Re: Proper way of using Sphere?
Last post by Datomas -
Really? That's all there is to them? Huh, thought they'd be more complicated than that.

And yeah, I've peeked into the Discord. Looks like you guys talk about stuff related to developing the engine that I can barely make sense of.
95
Sphere General / Re: Proper way of using Sphere?
Last post by Fat Cerberus -
Note the post you linked talks about CommonJS modules which are quite a bit different structurally from mJS but the same basic idea is present, to split up your program into self-contained units that don't interfere with each other.
96
Sphere General / Re: Proper way of using Sphere?
Last post by DaVince -
I've started learning miniSphere more recently, but modules are surprisingly simple:

- Create a new mjs file, put some code in there.
- Prepend the export keyword to whatever functions or classes or variables you want to use in other script files.
- Do an import in those other script files.

Example:

main.mjs
Code: [Select]
import { SomeFunction, SomeClass } from '$/myscript'; //Refers to those functions in myscript.mjs

SomeFunction();
var f = new SomeClass();

myscript.mjs
Code: [Select]
export function SomeFunction() {
  //Regular function code in here
}

export class SomeClass() {
  constructor() {
      //Do class stuff in here or whatever
  }
}

Maybe you could come chat in the Discord chat, it's been very useful to me to get the hang of how things work as Fat Cerberus and Rhuan hang out there all the time. :)
97
Sphere General / Re: Proper way of using Sphere?
Last post by Datomas -
Generally with v2 globals are discouraged, run all your code as modules with their own seperate scopes, hand anything you need to share around as parameters.

Yeah, I remember modules throwing me off a while ago when I read about them when they were implemented.

I've been looking at this thread to try and learn more about them, but I'm still not 100% confident I know how to use them properly.
98
Sphere General / Re: Proper way of using Sphere?
Last post by DaVince -
Even with old Sphere, the engine was designed to be flexible and work in a "however you want" fashion, more or less. Newer versions of miniSphere add a LOT of convenience for the things everyone kept making their own solutions before in old Sphere.

But really, the basic idea of "lay out things however you like" is still applicable. You're free to define any scripts and load any code in any fashion you like. You don't even need to necessarily use the built in event loop if you don't want to.
99
Engine Development / Re: miniSphere 5.0rc
Last post by DaVince -
I've got more free time now and have started diving into miniSphere. I gotta say, the way you set things up it's actually pretty easy to get started, especially with all the useful core libraries and the debugger! Nice work. :smiley_cat:
100
Sphere General / Re: Proper way of using Sphere?
Last post by Rhuan -
miniSphere 5.0 is about to be released (due date the 31st) in which the Sphere v2 api will finally be stable additionally I'm hoping that the modules I've been working on to go with it https://github.com/rhuanjl/SphereLibs will provide a good base for a game (though no one other than me has tested them yet).

Previously with the Spherev1 api there were two basic means of working:
1. Use the mapEngine, have anything else you wanted to happen regularly go in the update script and render script and store key data as global objects.
2. Don't use the mapengine (as it's not suited to your project) set up your own loop with an update stage and a render stage etc.

With Sphere v2
1. The engine now provides the loop https://github.com/fatcerberus/minisphere/blob/master/docs/sphere2-core-api.txt#L153-L184
 - it has an update stage for logic a render stage and a dispatch stage (for handling one-offs)
2, I'm hoping that my Map Engine script can replace the v1 mapengine, it's intended to be more flexible and give more control - also for more complex maps it should run faster as there are fast less calls between JS and C
3. Generally with v2 globals are discouraged, run all your code as modules with their own seperate scopes, hand anything you need to share around as parameters.