Skip to main content

News

Topic: Sphere SFML v0.90 (Read 51385 times) previous topic - next topic

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Sphere SFML v0.90


Introducing Sphere-SFML
A modern day, Windows only (presently) .NET based Sphere Engine alternative using SFML, aimed to be Sphere standards compliant with over 350 unit tests and under 5,000 LOC.

What do I mean by "Sphere Standards Compliant"? I mean you can take a game from way back in 2003 and still use it in my engine with *no* added changes. You might be able to load games earlier than that, but sphere file formats have changed since then and you might be loading a game that's simply too old. This also means it's for games against the latest Sphere standard (Sphere v1.5/1.6), which coincidentally hasn't changed since around 03'. See Github Sphere Documentation for raw sphere filetype details.

Source Code:
https://github.com/Radnen/sphere-sfml

Sphere Compliance:
**Complete**
- Images: 100%
- Input: 100%
- Sounds: 100%
- Fonts: 100%
- WindowStyles: 100%
- Spritesets: 100%
- Files: 100%
- Networking: 100%

**Incomplete**
- General: 92%
- Persons: 90%
- Surfaces: 69%
- Primitives: 65%
- Map Engine: 60%

Alpha versions:
Latest: http://radnen.tengudev.com/spheresfml/sphere-sfml-0.90.zip
Other: http://radnen.tengudev.com/spheresfml/

Tips and neat additions
1. MapEngine() can take the fps as an optional parameter default = 60.
2. Hashing functions take a boolean as a second variable, that will return a SHA1 instead of an MD5 hash.
3. Along with other interesting Sphere keys, key F2 will automatically double the viewport size (giving you x2 scale).
4. Has a built-in BinaryHeap, use 'new BinaryHeap(func)' in your code to use it.
5. Has an experimental built-in method for serializing JS to XML files (for save-games etc).
  • Last Edit: January 06, 2015, 12:00:51 am by Radnen
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Sphere SFML
Reply #1
I'm intrigued as to what this "Jurassic" library is. I look forward to seeing the progress of this engine implementation!

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Sphere SFML
Reply #2
I lied. It's not Mono compatible! Welp. I was running and testing code under MonoDevelop (now titled Xamarin Studio) but it seems it was using .NET 4.0? When I run it exclusively under mono it doesn't seem to work. Anyways, JSIL may not be mono-compat as well, I juts hope it's cross-platform in the end (I mean it's JavaScript in the end).

Jurassic is an abstraction layer and full implementation of ECMA script v3 and v5 (plus v5 strict mode). It's pretty fast, I think it uses v8 (it literally compiles JS to CIL) but it's not yet chrome-fast, check it out here: http://jurassic.codeplex.com/
  • Last Edit: July 07, 2013, 12:46:01 am by Radnen
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: Sphere SFML
Reply #3
Hey, awesome, I've been looking for a JS engine for .NET for a while now, I'll have to check Jurassic out when I have some free time. ;D

Edit: Wow, this is ridiculously easy to use!  The Jurassic API is really quite nice.
  • Last Edit: July 07, 2013, 12:25:59 am by Lord English
miniSphere 5.0b2 (stable: 4.8.8) - Cell compiler - SSj debugger - thread | on GitHub
For the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enormous man-eating pigs ~Rhuan

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Sphere SFML
Reply #4
It was actually a nightmare to use.  :o But it is indeed a necessary nightmare. In Javascript.NET I could directly pass .NET objects to and from the JS engine which makes it incredibly easy to wrap .NET classes for images, colors, etc. But it didn't implement exactly what Sphere had, for example ToString() wasn't do the right thing, variable access were muddled, and many methods I didn't want carried over, carried over.

At least with Jurassic I get full control over how I present the underlying .NET object to the JS environment. So, much more work, but better results and emulation of Sphere 1.5's native object idioms.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Sphere SFML
Reply #5
I guess I'd need to compile this in order to test? In any case, I don't think .NET is the way to go when it comes to implementing a Sphere engine (portability?).

Though it's still nice work. I think. I can't test it. :P

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Sphere SFML
Reply #6
Well I wanted to make it in Mono, but the JS engine won't run in Mono, Welp.

But there is JSIL, so Maybe that will make it cross-platform?
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

Re: Sphere SFML
Reply #7
Isn't Lua script like JS?

I know it works with Linux because of the Rainmeter program.
And of course works with Windows also.
Is it possible to replace JS with Lua, or is that a little more difficult than what is in mind?

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Sphere SFML
Reply #8

Is it possible to replace JS with Lua, or is that a little more difficult than what is in mind?


Not to mention such a move would break all existing games! I want something existing JS games can run on. If I went with Lua I'd be making a new game engine basically.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

Re: Sphere SFML
Reply #9
Yes, but it'd still be Sphere in spirit.
After all the point is to have a scripting language that can be somewhat easy to
learn and understand for those inexperienced with programming languages.

I was also reading a blog though about something with a Javascript interpreter in Mono.
What I understand from reading, Mono relies heavily on C# and what you'll need is something
to translate Javascript for C# programming. C# compiler for using Javascript essentially I think?

Just contributing ideas. I admit these matters are a bit too advanced for me to understand most of.

Re: Sphere SFML
Reply #10
Mono is (correct me if I'm wrong, .NET isn't exactly my area of expertise) an implementation of some primary components of .NET, including the CLR (common language runtime?), which is (part of?) the backend for C#, VB.net, C++/CLI, and some other languages. Ideally, Mono would let you run .NET programs without specifically having the Microsoft .NET framework, which is mostly important for non-Microsoft platforms (such as Linux).

There are already a lot of LUA engines, it's a very popular language for scripting games. But what makes Sphere interesting is that it uses JavaScript, and has a lot of freedom (most other JS-scripted engines I've found really don't). In fact, what I would consider the most similar engine in spirit (or how I see the spirit, anyway) to Sphere, Love2D, uses LUA.

And I for one prefer curly-bracket languages to LUA/Basic style languages.


I lied. It's not Mono compatible! Welp. I was running and testing code under MonoDevelop (now titled Xamarin Studio) but it seems it was using .NET 4.0? When I run it exclusively under mono it doesn't seem to work. Anyways, JSIL may not be mono-compat as well, I juts hope it's cross-platform in the end (I mean it's JavaScript in the end)


.NET 4.0 is the most compatible thing for Mono, at least as far as I've found. If you have 64-bit Linux, you can't even use .NET 2.0 (supposedly you can, but if so then it's extremely difficult). I may have a look, and see if it will run for me.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Sphere SFML
Reply #11
Quote
There are already a lot of LUA engines, it's a very popular language for scripting games. But what makes Sphere interesting is that it uses JavaScript, and has a lot of freedom (most other JS-scripted engines I've found really don't). In fact, what I would consider the most similar engine in spirit (or how I see the spirit, anyway) to Sphere, Love2D, uses LUA.

I was thinking that as long as the API Sphere provides is kept, the language doesn't really matter that much.

...Well, I'm saying that even though I like JS and know a bunch of details in JS I don't know how to do in any other language. So JS is optimal for me, and sticking with it just strengthens my knowledge on it. Though that makes me a one-sided coder. :P

Re: Sphere SFML
Reply #12

...Well, I'm saying that even though I like JS and know a bunch of details in JS I don't know how to do in any other language.
So JS is optimal for me, and sticking with it just strengthens my knowledge on it. Though that makes me a one-sided coder. :P


This is how it's viewed in my perspective also. Totally agree.
Either way I'm happy, and either way helps.

Just saying if there's an amount of effort put into keeping sphere the same
and it's extremely difficult to get that result, maybe a different language
is needed for Linux-users. Personally open to it, with Lubuntu on my Netbook
cause then I can code on the go :p

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Sphere SFML
Reply #13
Jester: You are right but some libraries just aren't ported over 100%. Jurassic uses a dynamic IL converter that comes with the Windows .NET package. Mono does not have that implemented. So I can't run it in Mono.

Guys, if you are running in Linux/Mac do any of the demos on this site work for you? http://jsil.org/

If they do, then I'll continyue development in .NET.

Also I was able to get Jurassic to compile and run under Mono, but I had to modify the source, removing dynamic methods. This sucks because the Sphere API is implemented as dynamic methods in the JS engine. That means you can Run JS in Mono, but you can'u use a native function (Like LoadImage()).
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Sphere SFML
Reply #14
Those demoes work! If this is the easiest way to go for Sphere on the Web, I'd say go for it!

Edit: doesn't always work as well as I'd hope, though. The sound in http://hildr.luminance.org/RPG/RPG.html is really distorted, but the sound in Escape Goat if fine, for example.
  • Last Edit: July 07, 2013, 05:42:42 pm by DaVince