Skip to main content
↑
↓
Spherical forums
Community for the
Sphere game engine
New?
Contact Us
to register an account!
1 Hour
1 Day
1 Week
1 Month
Forever
Community
Help
Search
Recent Posts
Log in
Contact Us
News
Spherical
Facebook
-
Twitter
-
Discord chat
New?
Contact us
to register an account!
User-Made
Libraries
MapEngine for Sphere v2
1
Print
Topic: MapEngine for Sphere v2
(Read 6622 times)
previous topic
-
next topic
0 Members and 3 Guests are viewing this topic.
Rhuan
High Poster
Posts: 384
Logged
MapEngine for Sphere v2
November 05, 2017, 12:37:19 pm
This is still an alpha version I suppose but really needs some usage so I can know what else to do with it.
Feels good enough to share as a release of sorts now rather than just a project.
https://github.com/rhuanjl/SphereLibs
See the "Map Engine tutorial.md" file for a fairly brief getting started tutorial - it's a lot of files to put in your project but should hopefully be simple to use once in place.
Any questions let me know.
Note: this requires miniSphere version 5.0 (or later) it will not run with earlier versions and certainly won't run with Sphere 1.5.
Last Edit
: November 05, 2017, 12:38:50 pm by Rhuan
1
Likes
DaVince
Legendary Poster
Posts: 1,001
Logged
Administrator
Used Sphere for, like, half my life
Re: MapEngine for Sphere v2
Reply #1
–
November 10, 2017, 01:00:42 am
I think this thread could benefit from some visual benefits that the map engine offers! I'll start by showing the zooming capabilities of the map engine, as well as the flexible HUD/GUI system that is built around it.
Spherical Downloads Repo
||
My (really old) Sphere stuff
scojin
Newbie
Posts: 18
Seiryoku-Zenyo
Logged
Re: MapEngine for Sphere v2
Reply #2
–
July 10, 2018, 03:18:40 pm
I'm trying to use the map engine, but I keep getting an error:
uncaught JavaScript exception
RangeError: Invalid read size '-929892776'
at TileBuffer (@/src/MapEngine/PixelBuffer.mjs:171:9)
at MEngine.prototype.setMap (@/src/MapEngine/MEngine.mjs:380:9)
at Generator.prototype.next (native code)
at MapEngine.prototype.start (@/src/MapEngine/map-engine.mjs:168:9)
at Generator.prototype.next (native code)
at Anonymous function (@/src/main.mjs:199:1)
at module (@/src/main.mjs:2:1)
I followed the template for cellscript and the mainscript and made the file path adjustments where necessary.
I'm using .rmp maps. I tried making a new map, and I also tried making a map with only a single layer, but still get the error. My tile sizes are 16x16, but that isn't what comes back in the debugger. Is there something I'm missing? Probably something simple...
Thanks in advance!
Rhuan
High Poster
Posts: 384
Logged
Re: MapEngine for Sphere v2
Reply #3
–
July 10, 2018, 04:45:54 pm
That's not an error I've seen, please could you post a sample project that produces it and I'll take a look?
My map engine should support any (positive) tile size and any number of layers.
At a guess - "-929892776" sounds like the wrong file is being read for the map - possibly the cellscript is wrong or you're trying to load the original .rmp file at runtime rather than the .mem file that the cell script will turn it into.
Last Edit
: July 10, 2018, 05:16:10 pm by Rhuan
1
Likes
scojin
Newbie
Posts: 18
Seiryoku-Zenyo
Logged
Re: MapEngine for Sphere v2
Reply #4
–
July 10, 2018, 10:58:50 pm
That was absolutely it. I didn't have my map's file extension as .mem. I guess I overlooked the fact of having to change it. Same with my sprites, also; had to change them to .ses. I figured it was something simple.
Bleh. Thanks for the quick response!
Fat Cerberus
Big Chungus
Posts: 2,774
*MUNCH*
Logged
Global Moderator
Sphere Developer
Re: MapEngine for Sphere v2
Reply #5
–
July 10, 2018, 11:08:36 pm
Well, it's not just a matter of renaming the file, for the record - the file extension is just a hint to programs. You actually need to convert the .rmp map to the .mem format, which is what the included Cellscript does. Same deal with the spritesets.
1
Likes
neoSphere 5.9.2
-
neoSphere
engine -
Cell
compiler -
SSj
debugger
forum thread
|
on GitHub
scojin
Newbie
Posts: 18
Seiryoku-Zenyo
Logged
Re: MapEngine for Sphere v2
Reply #6
–
July 11, 2018, 07:18:17 pm
So, I got the MapEngine to work with the simple template method; I was even able to change walking speeds and utilize the zoom aspect. But when I use the code for the more 'dynamic' version, I'm running into a few problems. There are no errors called and the game loads up fines, but the map isn't drawn correctly and none of the input works.
I created a new project, copy-pasted the code, adjusted for custom map and sprite, and still got the same result. I'll post some pics and a link to the smaller project I made.
Spoiler (click to show/hide)
Spoiler (click to show/hide)
Rhuan
High Poster
Posts: 384
Logged
Re: MapEngine for Sphere v2
Reply #7
–
July 11, 2018, 08:20:31 pm
I've temporarily deleted that larger example from the github repository I wrote some of that a while ago when I was still designing the map engine and I'm afraid I never updated it for some key changes so it doesn't behave correctly anymore. I'm really sorry about this failure.
I'd reccomend building upon the simpleExample instead for now - the map-engine.mjs interface it uses should be good enough for most things.
Edit: easier fixes than I thought:
1. Change the update function (line 92) so the parameters are this.camera.x, this.camera.y and this.camera.zoom (i.e. without the square brackets around the x and y)
2. add this.spriteSystem.takeInput(); anywhere in the start function
With these two changes it should work BUT I'm not going to put it back on GitHub for now as IMO it's not the best way to do things, the simpleExample (whilst it covers a few less features) is a better starting point at the moment.
Last Edit
: July 11, 2018, 08:36:47 pm by Rhuan
1
Likes
1
Print
User-Made
Libraries
MapEngine for Sphere v2