Skip to main content

News

Topic: TurboSphere (Read 98872 times) previous topic - next topic

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: TurboSphere
Reply #15
New and better sound please, kthxbai! ^_^

Re: TurboSphere
Reply #16
My thoughts exactly. Except I usually don't think to myself 'kthxbai'.

Also, the makefiles have been fixed (on the github version), and TS can also be built using Scons now.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #17
I'm going to use github to post any issues I find with it, so check there periodically. I'm going to try and experiment and use turbosphere. So, basically I'm going to beta test it's features!
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: TurboSphere
Reply #18
Ah, I saw the issues you posted, as well. Much appreciated!

EDIT:

I've updated TurboSphere, btw: TurboSphere 0.2.1.

The entire graphics plugin is built a bit differently now. I removed a lot of old and unnecessary functions that were used for testing before.

New:
- Surface.Line, Surface.Rectangle
- Numerous minor improvements to the graphics system.
- Circles are faster, and OutlinedCircles no longer have issues with colors of alpha<255
   
Fixed:

- Blitting two windowstyles on top of each other no longer causes the second blit to lose it's alpha channel (this was part of a deeper issue that was fixed, but only appeared in that circumstance with the functions existing so far)
- AreKeysLeft and GetKey perform much closer to Sphere 1.5
- RequireScript is less buggy
- No longer crashes on closing in Windows.
- SDL window no longer becomes unresponsive on Windows when the key buffer is not handled by the game.
  • Last Edit: March 24, 2013, 01:10:54 am by Flying Jester

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #19
Amazing work! Just to let you know, I'm building up a unit test framework for testing all kinds of things in your engine.
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: TurboSphere
Reply #20
That's good to know. It's probably obvious that TurboSphere could do with a bit more testing, and some regressions have slipped past for quite a while.

Also, I posed this idea on Google+, but now that the forums have returned I'll put it here:

I'm planning on making the mouse buttons used a queue just like the keyboard. The same old mouse functions will still exist, which are an analog of the IsKeyPressed for the keyboard. But new functions, probably called GetMouseButton and AreMouseButtonsLeft will be added.

When I was first suggested this idea, I didn't really think it was all that necessary. But the more  thought about it, the more I realized that whenever I have to deal with the mouse in Sphere I spend a bit of time recreating this functionality. I think it would be beneficial to add it.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #21
I was able to get the core radlib library to run under TS, but many of the more complicated features can't run. And I cannot fix them since it crashes straight-away without telling me why. For example, a simple syntax error will make it crash, or a function that wasn't defined. It's hard to debug this way.
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: TurboSphere
Reply #22
That's partially because I'm still working on getting v8 3.15 for the windows build. As it is, the v8 library I include is fairly ancient (3.9), and within that it isn't compiled with JIT debugging enabled. The V8 internal error messages end up being somewhat useless right now.

One thing I do not know how to solve just yet is that issues with declarations before or in game() make V8 say that game is not a function.

It should tell you something about the crash, though (assuming you run it in a command prompt). And it shouldn't crash without either message from V8 or a message from TurboSphere.
  • Last Edit: March 24, 2013, 09:34:51 pm by Flying Jester

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #23
Well, it just closes. It's a CTD type of crash, and it does not generate an output file. I put "breaks" (GetKey()) around the code I'm trying to test, but even then it will CTD between two code statements, especially stuff in other code files.
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: TurboSphere
Reply #24
Try running it from a command prompt. I never intended for errors to be logged to any files, just posted into a containing terminal window (and if I needed output to file, I'd just run turbosphere.exe >log.txt). It shouldn't crash the terminal.

The whole multiple scripts situation is a little odd right now. Each one is its own compiled script in V8, and it can crash without taking down all execution (which will undoubtedly cause unexpected things to happen). The error that crashed the script will still be logged to the terminal.

I'm trying to make it more like Sphere had it, without just turning RequireScript into a C-style include that will just dump the second script into the first. There surely are elegant solutions working just with V8. But I don't know exactly how to do that yet.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #25

I'm trying to make it more like Sphere had it, without just turning RequireScript into a C-style include that will just dump the second script into the first. There surely are elegant solutions working just with V8. But I don't know exactly how to do that yet.


No kidding, line error's are in the 1000's!

I don't know if this is a bug or feature, but you've made Sphere Objects [object Object] types rather than [object Image] etc. which Sphere did. So, it's harder to tell if an image is an image or some object.

Edit: Now I'm running into an issue with the console. I don't see the entire log. I'm loading hundreds of scripts, okay, so the console has a huge list of stuff, but only stops half-way before the screen pops up running. Then when an error occurs, nothing else is added to the console.

Code: [Select]

$ ./turbosphere.exe
Fixed plugins: 1
Fixed plugins as recorded: 1
Opening SGM file startup/game.sgm
Opening script startup/scripts/main.js
File is good.
Opening script startup/scripts/radlib/radlib.js
File is good.
Opening script startup/scripts/radlib/radextend.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/animation.js
File is good.
JS Result will be passed.
function (x, y) {
        this.frames[this.frame].i.blitMask(x, y, this.color);
}
Opening script startup/scripts/radlib/assert.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/audio.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/colors.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/debug.js
File is good.
Opening script startup/scripts/radlib/game.js
File is good.
Opening script startup/scripts/radlib/hooklist.js
File is good.
JS Result will be passed.
function (key) {
        var hook = List.get(this.hooks, key, "key");
        hook.paused = false;
}
No JS result will be passed
No JS result will be passed
Opening script startup/scripts/radlib/event.js
File is good.
JS Result will be passed.
function () {
        return this.parent.constructor.name;
}
Opening script startup/scripts/radlib/game.js
File is good.
Opening script startup/scripts/radlib/hooklist.js
File is good.
JS Result will be passed.
function (key) {
        var hook = List.get(this.hooks, key, "key");
        hook.paused = false;
}
No JS result will be passed
Opening script startup/scripts/radlib/hooklist.js
File is good.
JS Result will be passed.
function (key) {
        var hook = List.get(this.hooks, key, "key");
        hook.paused = false;
}
Opening script startup/scripts/radlib/inherit.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/input.js
File is good.
JS Result will be passed.
function (button) {
        return IsJoystickButtonPressed(this.num, button);
}
Opening script startup/scripts/radlib/image.js
File is good.
JS Result will be passed.
function (x1, y1, radimg, x2, y2) {
        // setup positions:
        var top    = Math.max(y1, y2);
        var left   = Math.max(x1, x2);
        var right  = Math.min(x1 + this.width , x2 + radimg.width )-1;
        var bottom = Math.min(y1 + this.height, y2 + radimg.height)-1;

        // collision:
        var colA, colB;
        for (var y = top; y < bottom; ++y) {
                for (var x = left; x < right; ++x)
                {
                        colA = this.canvas.getPixel(x - x1, y - y1);
                        colB = radimg.canvas.getPixel(x - x2, y - y2);
                        if (colA.alpha > 0 && colB.alpha > 0) return true;
                }
        }

        return false;
}
Opening script startup/scripts/radlib/json2.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/list.js
File is good.
Opening script startup/scripts/radlib/assert.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/debug.js
File is good.
Opening script startup/scripts/radlib/game.js
File is good.
Opening script startup/scripts/radlib/hooklist.js
File is good.
JS Result will be passed.
function (key) {
        var hook = List.get(this.hooks, key, "key");
        hook.paused = false;
}
No JS result will be passed
No JS result will be passed
No JS result will be passed
Opening script startup/scripts/radlib/loader.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/mouse.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/path.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/resources.js
File is good.
No JS result will be passed
Opening script startup/scripts/radlib/savefile.js
File is good.
Opening script startup/scripts/radlib/json2.js
File is good.
No JS result will be passed
JS Result will be passed.
function (filename) {
        if (!Assert.is(filename, "string")) { Debug.log("Filename not a string.", LIB_ERROR); return; }

        if (filename.indexOf(".") < 0) filename += ".sav";

        if (!Assert.fileExists("~/other/", filename)) {
                Debug.log(FormatString("File {?} doesn't exist!", filename), LIB_ERROR);
                return;
        }

        var file = OpenRawFile("~/other/" + filename);
        this.content = JSON.parse(CreateStrin



Edit2: Only when there's a script error hmm... Weird.
  • Last Edit: March 25, 2013, 01:00:28 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

Re: TurboSphere
Reply #26
Well, I do see one thing that I know is my fault. Normally the system that prints 'JS Result Will Be Passed' is only supposed to work on scripts embedded in maps. I'll have to change how that is handled, that for sure is causing a problem here. I believe that whenever it spits out a value from a script (and it looks like it's doing that with functions here? I've never seen that before!), whatever it spits out is lost. But I'm not sure of that, I haven't worked on that part of TurboSphere in about a year. Time to take another look at it!

I believe nothing else is added to the console after a certain point because the original script has thrown some sort of error. I just made up a new version of V8 3.15 with JIT debugging enabled for Windows, and I'll make a new release with both the new V8 included and I believe some changes that should fix this.

On another note, I think that there is builtin JSON in V8 by default, so you shouldn't need the json.js files (but don't quote me on that).

EDIT: Nevermind. Whenever 'result will be passed' is printed, it means that something was actually passed from the script. I removed the special handling a long time ago, apparently. I think that means here that whatever is being passed was not assigned to anything in script?
  • Last Edit: March 25, 2013, 01:19:03 am by Flying Jester

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #27

On another note, I think that there is builtin JSON in V8 by default, so you shouldn't need the json.js files (but don't quote me on that).


I don't know.. I couldn't get foreach to work... and it was implemented in JS 1.6... I'm still using my foreach code! But we'll see... It's still good to have.

I got radgui to now work!

That means, I have now got radlib's debug system working (the interactive version, supplied by radgui). Yay, I can finally report errors! But there were many things it's lacking.

1. Surface.gradientRectangle()
2. Font.getHeight();
3. Accurate Font.getStringWidth()
4. Font/WindowStyle .get/.setColorMask()
5. Image.blitMask()
6. GetFileList()
7. GetDirectoryList()
8. GetNumJoystickButtons,
9. IsMapEngineRunning,
10. Font.wordWrapString(),
11. Windowstyles are not drawing their backgrounds?
12. Fot.drawTextBox()
13. JS Error (Esp error.stack)

Re the "result will be passed": It seems to be the last function/line in the file.

Code: [Select]

Opening script startup/scripts/radlib/hooklist.js
File is good.
JS Result will be passed.
function (key) {
        var hook = List.get(this.hooks, key, "key");
        hook.paused = false;
}


Equals:
Code: [Select]

HookList.prototype.unpause = function(key) {
var hook = List.get(this.hooks, key, "key");
hook.paused = false;
}
  • Last Edit: March 25, 2013, 01:30:55 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

Re: TurboSphere
Reply #28
GetFileList should be working (I did test it, and it seemed to work for me), and Font.getStringWidth should properly work (it has always seemed to for me?).
GetNumJoyStickButtons exists now (I haven't updated the binaries to reflect this just yet).
WindowStyles do not draw their backgrounds yet, this is true. At the time I made windowstyleSDL, I didn't even know they had backgrounds.

blitMasks don't exist yet. As part of generalizing the primitives and blitting features, they (along with surface.gradientRectangle and all other primitives, and font drawing) will be added. You can (or could, I haven't tested this in quite a long time) set the mask for TTFFonts just by accessing the mask member. But TTFFonts are a little leaky right now, and I don't know why.

JS Error seems to be quite possible in V8. DaVince asked me about it a while ago, and I know it can work. We found that in TurboSphere, the error object does exist, it just doesn't do anything. I need to do some more V8 research to get it working right.

I'm really rather sure V8 has a JSON builtin (I might need to do something to make it appear, but I know it exists). I don't know what the deal is with foreach'es, I
think I found them not to work before, as well.


Edit: Yes, the result is (and I say this with fear of using a grossly incorrect term) whatever was accumulated last in the script. I was under the impression that it normally meant that some expression went unused, but I'll bet it's quite possible that that's not true.

And btw, that's a beautiful sight there!
  • Last Edit: March 25, 2013, 01:39:22 am by Flying Jester

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: TurboSphere
Reply #29
In Windows, GetFileList returns an empty object.
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