Spherical forums

Sphere Development => Sphere Support => Script Support => Topic started by: Miscreant on August 22, 2017, 11:03:10 pm

Title: GetVersion Question
Post by: Miscreant on August 22, 2017, 11:03:10 pm
I've come across some parts of my code that function in Sphere 1.5 and do not function in miniSphere.

I'm trying to get the code to function in both. I thought that maybe if I added in the GetVersion it would make the code functional again. However, since I added in the GetVersion part var CurrMap is returning as undefined in both Sphere & miniSphere.

Perhaps this is not the way GetVersion functions?

Code: [Select]
var GCM = GetCurrentMap();
var GCM_S = GCM.split("/");
var GCM_SA;
var CurrMap;

if (GetVersion() < 2.0)
{
GCM_SA = GCM_S[1];
}else{
GCM_SA = GCM_S[3];
}

CurrMap = GCM_SA.slice(0, -4);
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 22, 2017, 11:15:17 pm
Which version of miniSphere are you using?  In the latest versions GetCurrentMap() should return exactly the same string in both engines.  I fixed a bug a few versions ago where it would return the full SphereFS path of the map file, so maybe that's the problem you're having.
Title: Re: GetVersion Question
Post by: Miscreant on August 22, 2017, 11:22:19 pm
Quickly drawing the version number to the screen... it is 2.
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 22, 2017, 11:24:10 pm
No no, I meant the version number of the engine, not the API version.  Are you using 4.8.4 or an earlier version?
Title: Re: GetVersion Question
Post by: Miscreant on August 22, 2017, 11:27:50 pm
ah, looking at my backup dir. I had installed miniSphere 4.5.11
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 22, 2017, 11:46:01 pm
If you upgrade to 4.8.4 then you won't need the version check for this.

To answer the original question though, you were using GetVersion() correctly, it returns 2.0 for miniSphere and 1.5 for Sphere 1.5.  Note that in JS, 2.0 === 2, i.e. there is no concept of an integer type.
Title: Re: GetVersion Question
Post by: Miscreant on August 23, 2017, 12:01:26 am
I just updated miniSphere and GetCurrentMap is not returning the same value...
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 23, 2017, 12:12:55 am
That's interesting, Sphere 1.5 is apparently not normalizing the path.  It's been my experience with Sphere 1.5 that the string returned by GetCurrentMap() is relative to maps/, but for some reason you have an extra redundant ../maps/ component in there.  Strange.

In any case if you're just trying to get the filename, this will work regardless of what its directory path is:

Code: [Select]
GCM_SA = GCM_S[GCM_S.length - 1];
Title: Re: GetVersion Question
Post by: Miscreant on August 23, 2017, 12:27:12 am
Off Topic: Now, with the update to miniSphere 4.8: the graphics are displaying very slow and player movement is no longer fluid.
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 23, 2017, 12:29:50 am
Hm, not sure what would have caused that.  I made a lot of changes to the internal rendering since 4.5, but none of those should have slowed it down, if anything the upgrade should have made things a lot faster. :(
Title: Re: GetVersion Question
Post by: Miscreant on August 23, 2017, 12:37:13 am
I'm developing on a quad core with 4gigs of memory.

Are there min reqs for miniSphere?
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 23, 2017, 12:45:54 am
CPU-wise, requirements should be on par with Sphere 1.5 (in fact Duktape is 2-3x faster than the old SpiderMonkey used by 1.5).  GPU requirement is definitely a lot higher though, since it's all shader-based nowadays (1.5 is software-rendered unless you use the horribly optimized OpenGL plugin).

In the absence of a dedicated graphics card, I'm going to say the minimum requirement would be a Sandy Bridge i5, circa 2011.
Title: Re: GetVersion Question
Post by: Miscreant on August 23, 2017, 01:17:27 am
I'm pretty sure my vid card is a nVidia GeForce 7300.
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 23, 2017, 01:25:16 am
Wow, GeForce 7300 is circa 2005... so that's a pretty old machine then.  The oldest PC I think I have access to is an Athlon X4 635 from around 2010.  I can look into it to try to figure out what caused the performance regression but I don't think you're ever going to get miniSphere to run adequately on that machine.
Title: Re: GetVersion Question
Post by: Miscreant on August 23, 2017, 01:29:58 am
I'm not sure what all the specs are by memory. I can say that the machine I used before this one was almost 20 years old though.

although. miniSphere 4.5.xx functioned with no slow down of graphics.
Title: Re: GetVersion Question
Post by: Fat Cerberus on August 23, 2017, 02:47:05 am
Without having access to a machine that old I can only guess at what's wrong, unfortunately. :(

The only thing that comes to mind is the change to backbuffer handling I did in mS 4.6: the engine now uses a fake backbuffer to ensure pixel-perfect output, and your 7300 may not be able to do render-to-texture at all.  In that case Allegro is probably emulating it in software, hence the slowdown.  If that's indeed the case, then there's not much I can do--using Surfaces in miniSphere would be slow for you too, even under 4.5.
Title: Re: GetVersion Question
Post by: Miscreant on August 23, 2017, 03:09:05 am
The vid card is actually in the 8500 series but even that is like 10 years old...

There must be some way to accomplish this.

Too much to think about right now...

For now, back to Sphere 1.5...
Title: Re: GetVersion Question
Post by: Miscreant on September 07, 2017, 03:45:24 pm
I know this topic started out with a GetVersion question... We got in to talking about the video display between the Sphere and miniSphere. Which would still be on topic about the different versions. I thought you might like to see just what miniSphere 4.8 does on my dev machine...
Title: Re: GetVersion Question
Post by: Rhuan on September 07, 2017, 03:48:03 pm
I assume it's not meant to be doing that?
Title: Re: GetVersion Question
Post by: Miscreant on September 07, 2017, 03:52:54 pm
With miniSphere 4.5, the graphics were very much like Sphere 1.5. Very smooth with no issues. With miniSphere 4.8 the graphics became very slow and choppy. @Fat Cerberus thought it might be because of my video card.
Title: Re: GetVersion Question
Post by: Rhuan on September 07, 2017, 04:10:11 pm
With miniSphere 4.5, the graphics were very much like Sphere 1.5. Very smooth with no issues. With miniSphere 4.8 the graphics became very slow and choppy. @Fat Cerberus thought it might be because of my video card.
I can't work out what's wrong in the picture you've posted. Not sure if you're showing a bug or something else.
Title: Re: GetVersion Question
Post by: Miscreant on September 07, 2017, 04:16:40 pm
The graphics are just choppy and slow and kept making a trail of "Link". Not a bug, just slow graphic rendering on my dev machine, I guess.
Title: Re: GetVersion Question
Post by: Rhuan on September 07, 2017, 04:24:07 pm
The graphics are just choppy and slow and kept making a trail of "Link". Not a bug, just slow graphic rendering on my dev machine, I guess.
Until you said that I thought it may have bean some kind of line of flames.

Yeah minisphere 4.8 needs a modern graphics card it just doesn't have the right hooks for old graphics cards.
Title: Re: GetVersion Question
Post by: Miscreant on September 07, 2017, 04:32:10 pm
Looking at the image, it's like an army of Links all following one another on their way to fight Gannon.
Title: Re: GetVersion Question
Post by: Fat Cerberus on September 07, 2017, 04:42:41 pm
Yeah, not sure what's up with the trails, that's kind of weird.

It's not that I don't want to support older machines, it's just I don't have a 2000s-era desktop handy to actually test things on. :(
Title: Re: GetVersion Question
Post by: Miscreant on September 07, 2017, 06:07:28 pm
I can't find an actual production year for the desktop but from what I can gather, similar models were produced in 2010. If that is when this machine is from then I am developing on a 7 year old machine. Considering the machine I was using before this one was from 2003... Not the newest tech, I know. I try to stay updated but new hardware isn't really cheap.
Title: Re: GetVersion Question
Post by: Fat Cerberus on September 07, 2017, 06:24:01 pm
Hm, 2010 is still new enough that I'd consider it a bug if miniSphere doesn't run acceptably on it.  I'll see what I can do going forward.
Title: Re: GetVersion Question
Post by: DaVince on September 10, 2017, 06:43:15 am
@Miscreant What kind of CPU is in that? I'm using a Dell laptop from 2011 which has a third gen i7 CPU, and Intel HD Graphics 4000 served miniSphere just fine.

Before this I had a laptop from 2010 with a second-gen i7, and that worked fine too. Maybe it doesn't now, I dunno.
Title: Re: GetVersion Question
Post by: Miscreant on September 10, 2017, 06:44:41 am
@Miscreant What kind of CPU is in that? I'm using a Dell laptop from 2011 which has a third gen i7 CPU, and Intel HD Graphics 4000 served miniSphere just fine.

Before this I had a laptop from 2010 with a second-gen i7, and that worked fine too. Maybe it doesn't now, I dunno.

Give me a moment to gather the specs.
Title: Re: GetVersion Question
Post by: Miscreant on September 10, 2017, 06:56:18 am
Quote from: cnet.com
PROCESSOR / CHIPSET
CPU
Intel Core 2 Quad Q8200 / 2.33 GHz

Number of Cores
Quad-Core
64-bit Computing
Yes
Data Bus Speed
1333 MHz

Chipset Type
NVIDIA GeForce 7100 / nForce 630i
Processor Socket
LGA775 Socket

CACHE MEMORY
Installed Size
L2 cache - 4 MB
Cache Per Processor
4 MB
Type
L2 cache
Per Processor Size
4 MB
Installed Size
4 MB

RAM
Installed Size
4 GB / 4 GB (max)
Memory Speed
800 MHz
Memory Specification Compliance
PC2-6400
Features
unbuffered
Configuration Features
2 x 2 GB
Technology
DDR2 SDRAM
Installed Size
4 GB
Data Integrity Check
non-ECC
Rated Memory Speed
800 MHz

MEMORY
Max Supported Size
4 GB

PROCESSOR
Installed Qty
1
Max Supported Qty
1
Type
Core 2 Quad
Processor Number
Q8200
Manufacturer
Intel
Clock Speed
2.33 GHz

GRAPHICS CONTROLLER
Graphics Processor
NVIDIA GeForce 7100
Video Interfaces
HDMI, VGA

My dev machine... I put an nVidia GeForce 8400 ge PCIe graphics card into it which disabled the integrated video.
Title: Re: GetVersion Question
Post by: DaVince on September 10, 2017, 08:17:14 am
Ohhh, yeah, I see why Fat Cerberus was mentioning the specs now. Have you looked into getting the latest graphics drivers for your GeForce specifically? Even with those specs I imagine that a GeForce 7100 or 8400 should do the trick when I can do everything I need on Intel integrated graphics. But I dunno.
Title: Re: GetVersion Question
Post by: Rhuan on September 10, 2017, 08:18:20 am
That's weird, my understanding was that you just needed shader support which means OpenGL 2.0 or higher - a quick google says that a geforce 7100 should support opengl 2.0 no problem maybe it was a driver problem with the old card?

edit: semi-ninja'd by DaVince
Title: Re: GetVersion Question
Post by: Miscreant on September 10, 2017, 08:26:41 am
The 7100 is integrated into the motherboard, there was no old card. When I setup the machine, I made sure to have the updated drivers. Since I added the 8400 graphics card, miniSphere's graphics perform much smoother. I'm not really sure what was causing the slowdown in graphics but now I do have to figure a way to re-enable my dual monitors. The desktop environment is just way too cluttered now. It is a wonder how people were ever accustomed to a 640x480 resolution back in the early days of computing.
Title: Re: GetVersion Question
Post by: Fat Cerberus on September 10, 2017, 09:18:58 am
It is a wonder how people were ever accustomed to a 640x480 resolution back in the early days of computing.

Funny you bring that up, because I deliberately held out on 800x600 for a long time (as in, long after that was below the minimum requirements to run Windows).  I liked the coziness I think, anything higher at the time felt like I was swimming. :P  Nowadays I go crazy with anything less than 1080p though.
Title: Re: GetVersion Question
Post by: Miscreant on September 10, 2017, 09:45:47 am
Computers have come along way since I first started using them, dialing in to Prodigy with a 24.4kbps modem on a 386 machine. For a long time, I was stuck with a max res of 1024x768. It was all my graphics card and monitor would support. That was when I first set up a dual monitor system which then evolved to a tri-monitor system. Since this machine had the dual monitor support integrated, I reverted back but I upped my monitors to 2 24" with native resolution of 1920x1080. Yet, as large a resolution as it is, with the 8400 graphics card I'm stuck at 1 monitor (for the time being) and find the desktop environment very cluttered.