Skip to main content

News

Topic: Gauntlet clone, with extra features, and also online. (Read 14053 times) previous topic - next topic

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Gauntlet clone, with extra features, and also online.
Reply #30

Two quick questions...
1) Can I access the player's X and Y without using GetPlayerX/Y? Since it's a function, it's inconvenient to use nested deep in my code. I'd prefer to just do player.x and player.y.

If I just did "player.x = GetPlayerX(blah)" would that work?


It would be nice in a different Sphere, and you can do that in Sphere 1.x if you wrote a large wrapper of the player object (but you'll have to know how to do that). However, it's not standard. It would be at some point, but not presently. So you have to use the Set/Get methods for now. And all beginners should use them at first to be safe.


2) Is there a controller/input object built into the Sphere API? Because one super-easy way to handle custom diagonal movement would be something like...

if DPad && 0 = 1 then player.y --;
if DPad && 1 = 1 then player.x ++;
if DPad && 2 = 1 then player.y ++;
if DPad && 4 = 1 then player.x --;

In that example, obviously, DPad would store player movement in a nibble, and I could simply and-compare it to check which bits were active, so as to move the player around accordingly.

That's what I did in my Wii U Canvas game I was messing around with awhile ago. I could post the full code if anyone wants to look at the kinda programming I'm doing and used to.


Ok, I see what you are trying to do with that code. (In JS and-compare is a single &, so that's why it looked weird to me). Yes, there is a way to do that.

Code: [Select]

function InputGroup(input) {
    this.num = input; // controller's input (aka player number).
}

InputGroup.prototype = {
get axisLeft () { return GetJoystickAxis(this.num, JOYSTICK_AXIS_X) < -0.5; },
get axisRight() { return GetJoystickAxis(this.num, JOYSTICK_AXIS_X) >  0.5; },
get axisUp   () { return GetJoystickAxis(this.num, JOYSTICK_AXIS_Y) < -0.5; },
get axisDown () { return GetJoystickAxis(this.num, JOYSTICK_AXIS_Y) >  0.5; },
}


Then you can use:
Code: [Select]

var input = new InputGroup(0);

if (input.axisLeft) SetPlayerX(name, GetPlayerX(name) + 1);
// etc.




Quote from: mooch

Ah. Found out on my own. I tried using addEventListener and it says it's not defined. Unless I just have to use EvaluateScript, but I have no idea what *.js file addEventListener is in, or where or how to obtain it.


What's addEventListener? It sounds more like Java's awt event library to me; not JavaScript.


Oh, it's JavaScript...
http://www.quirksmode.org/js/events_advanced.html
http://help.dottoro.com/ljeuqqoq.php

I was introduced to it here...
http://www.lostdecadegames.com/how-to-make-a-simple-html5-canvas-game/


Ah, I forgot about that. That's web JS, so it's only for browsers. Sphere uses a subset strictly for gaming. It's otherwise known as the SpiderMonkey v1.5 API. You can find it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference


I see my problem. I'm thinking in terms of something like BASIC, where the program runs one line of code after another, from the top of the code to the bottom, and only does any looping if you tell it to jump back up in the code. I forgot you can while(true) something and have it keep going while you're doing other things.

You know what'd be really helpful? If the raw code of the API functions were available somewhere. Then one could peer inside and see precisely what's happening.


There is the raw code. It is online at github: https://github.com/sphere-group/sphere


Okay, so since Sphere 1x is interpreting, it'll basically run any Javascript I give it the way a webpage would. In SphereSFML (which I'm mentally pronouncing "surf mail"), since it's compiled, will there be some JS stuff that doesn't work?


No, Sphere runs SpiderMonkey, see the reference. The JS API should fully work, but in fact SFML version uses an even stricter ECMA5 reference, which has fewer features than SpiderMonkey, but is still indeed a complete language and should play all the games here (unless they use some weird intrinsic feature known only to SpiderMonkey, and there are a few of those games, but rare). Compiled just means it's really fast JS, that's all. ;)

Edit:
I replied right after Jest, it takes forever responding to you!! :P
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

  • Mooch
  • [*]
  • Verified
Re: Gauntlet clone, with extra features, and also online.
Reply #31
Ah, this is the question I actually meant to ask before -- can I use stuff like Font.drawText and Image.blit without running the Map Engine? Or do they require the Map Engine?



Two quick questions...
1) Can I access the player's X and Y without using GetPlayerX/Y? Since it's a function, it's inconvenient to use nested deep in my code. I'd prefer to just do player.x and player.y.

If I just did "player.x = GetPlayerX(blah)" would that work?


No, sadly you can't. That will just get you the value returned by GetPlayerX(blah) at the time you set player.x. You could wrap it inside a player.getX() function or similar, though.


Unfortunately, I need the player's X and Y positions in variables, not functions.


It depends how you structure it. You can very easily just leave the map engine running the whole time your game runs.

Mostly, you absolutely need a game loop (and not a recursive game function! Don't do that!) if you don't use the map engine in your game, or choose to use it for portions but also close it from time to time and then run it again later.


Not sure I understand, but then again, I don't really understand how the Map Engine works. Though I get that if you were making, say, an RPG, you could turn off the ME while the player's in battle. Though I can't see what'd be wrong with leaving it running in the background. The computers we're all using are probably plenty powerful enough that that little bit of wasted computing won't cause a noticable slowdown.


There's nothing wrong with leaving it running.
I was mostly thinking of games that don't use the map engine. Then I imagined a game that used the map engine for small portions of the gameplay, and wanted to ammend that case since it is possible. It's not important.

About input handling, you can check if keys are pressed using IsKeyPressed in the update script. Or you could use AreKeysLeft and GetKey (this has some advantages) in the update script.
But either way, I would put key checking code in the update script.


Oh yeah. No reason I can't use the API functions. I'm not thinking straight.

Hmm. Checking the API on the Wiki (a rare blue link!), IsKeyPressed returns a boolean. What I need - and I'm gonna test to see if I can do this myself - is to store multiple inputs in a single byte. Like, up on the low-order bit, right on bit 1, down on bit 2, etc. Well, I probably don't need it, it's just the way I'm most used to and comfortable handling player input.

===Edit===


I see my problem. I'm thinking in terms of something like BASIC, where the program runs one line of code after another, from the top of the code to the bottom, and only does any looping if you tell it to jump back up in the code. I forgot you can while(true) something and have it keep going while you're doing other things.


while(true) does not keep going while you do other things. It is an infinite loop, meaning that when execution gets to the bottom of the block, it goes right back to the top.


Then how can the various bits of code I write be running if Sphere is infinitely stuck in the Map Engine? In Radnen's example of how function MapEngine works, it doesn't have a callback to game. So game should run once, get to MapEngine, then MapEngine should run infinitely, meaning any code not inside MapEngine (and none of my code is) shouldn't run. Or will only run once if I put it in function game() but before MapEngine.



Two quick questions...
1) Can I access the player's X and Y without using GetPlayerX/Y? Since it's a function, it's inconvenient to use nested deep in my code. I'd prefer to just do player.x and player.y.

If I just did "player.x = GetPlayerX(blah)" would that work?


It would be nice in a different Sphere, and you can do that in Sphere 1.x if you wrote a large wrapper of the player object (but you'll have to know how to do that). However, it's not standard. It would be at some point, but not presently. So you have to use the Set/Get methods for now. And all beginners should use them at first to be safe.


Oh! Wait! I don't need player.x and player.y! I was gonna use it to move the players, but I can just use QueuePlayerCommand.

It'd still be nice to have player positions as variables, not just the output of functions.



2) Is there a controller/input object built into the Sphere API? Because one super-easy way to handle custom diagonal movement would be something like...

if DPad && 0 = 1 then player.y --;
if DPad && 1 = 1 then player.x ++;
if DPad && 2 = 1 then player.y ++;
if DPad && 4 = 1 then player.x --;

In that example, obviously, DPad would store player movement in a nibble, and I could simply and-compare it to check which bits were active, so as to move the player around accordingly.

That's what I did in my Wii U Canvas game I was messing around with awhile ago. I could post the full code if anyone wants to look at the kinda programming I'm doing and used to.


Ok, I see what you are trying to do with that code. (In JS and-compare is a single &, so that's why it looked weird to me). Yes, there is a way to do that.

Code: [Select]

function InputGroup(input) {
    this.num = input; // controller's input (aka player number).
}

InputGroup.prototype = {
get axisLeft () { return GetJoystickAxis(this.num, JOYSTICK_AXIS_X) < -0.5; },
get axisRight() { return GetJoystickAxis(this.num, JOYSTICK_AXIS_X) >  0.5; },
get axisUp   () { return GetJoystickAxis(this.num, JOYSTICK_AXIS_Y) < -0.5; },
get axisDown () { return GetJoystickAxis(this.num, JOYSTICK_AXIS_Y) >  0.5; },
}


Then you can use:
Code: [Select]

var input = new InputGroup(0);

if (input.axisLeft) SetPlayerX(name, GetPlayerX(name) + 1);
// etc.


Nice! Thanks so much ^_^
So that'll work in Sphere just as you typed it?

Ah, I forgot about that. That's web JS, so it's only for browsers. Sphere uses a subset strictly for gaming. It's otherwise known as the SpiderMonkey v1.5 API. You can find it here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference


: /

That's what I was looking through. I followed the link from the Sphere wiki. I wonder how I ended up at a page about addEventListener...oh, I see. When you use the search bar on the Reference there, it kicks you out to Google, and searches the whole Mozilla Javascript site, so I ended up on a page not about SpiderMonkey.



I see my problem. I'm thinking in terms of something like BASIC, where the program runs one line of code after another, from the top of the code to the bottom, and only does any looping if you tell it to jump back up in the code. I forgot you can while(true) something and have it keep going while you're doing other things.

You know what'd be really helpful? If the raw code of the API functions were available somewhere. Then one could peer inside and see precisely what's happening.


There is the raw code. It is online at github: https://github.com/sphere-group/sphere


That is intimidating to me. I don't suppose all the code for the API commands is listed neatly, in alphabetical order somewhere in there, is it?

And wait, is that gonna be in C++? I just wanna see the exact Javascript that's being run for various API commands.


Okay, so since Sphere 1x is interpreting, it'll basically run any Javascript I give it the way a webpage would. In SphereSFML (which I'm mentally pronouncing "surf mail"), since it's compiled, will there be some JS stuff that doesn't work?


No, Sphere runs SpiderMonkey, see the reference. The JS API should fully work, but in fact SFML version uses an even stricter ECMA5 reference, which has fewer features than SpiderMonkey, but is still indeed a complete language and should play all the games here (unless they use some weird intrinsic feature known only to SpiderMonkey, and there are a few of those games, but rare). Compiled just means it's really fast JS, that's all. ;)

Edit:
I replied right after Jest, it takes forever responding to you!! :P


It's gonna pay off when I make a rockin' game that draws millions of people to Sphere :p

A RARE PROJECT UPDATE
I'm trying out my SNES multitap-esque hack. I should have a rudimentary test to see whether I can go forward with it in a few days.

Oh, and I'm gonna compile all the info in this topic (and my other ones) and de-redlink the Wiki as much as I can. If I could look all this stuff up, I wouldn't have to ask.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: Gauntlet clone, with extra features, and also online.
Reply #32
You can put the XY in variables, you can simply do something like this, using global variables (a bad practice, but sufficient for small games). Then you can use the variables whenever. But you have to constantly update the location by repeatedly calling the get functions.

Code: [Select]

var player_x = 0;
var player_y = 0;

function Update()
{
    player_x = GetPersonX("player");
    player_y = GetPersonY("player");

    SetPersonX("player", player_x + 1);
    SetPersonY("player", player_y + 1); // etc.
}


Image.blit() and various other things not relating to the map engine work. It's common sense what's related the map engine and what's not, so I can't give you a list of everything that works while it's running or not, you'll just have to experiment. But player, layer stuff etc, are going to be MapEngine related.

Quote from: mooch

And wait, is that gonna be in C++? I just wanna see the exact Javascript that's being run for various API commands.


It is in C++. There are no direct JS equivalents. I showed you what the MapEngine looks in JS, but that's just a portion of it - namely the runner - but that's because I chose to write it in JS (and my knowledge of Sphere has of late grown immensely). You may be wondering where the actual JS is, how you get those functions in the engine. Well, they are in fact C++ functions embedded into the JS environment, so you are practically running C++ code inside of those functions. They weren't designed for you to know how they work, you're just supposed to use them. Though for the MapEngine it does get tricky and is often asked about. If you looked at the actual C++ though you'd be more lost than ever. The explanation I gave - the one in JS - is really not that bad.

Finally, that axis code should work as I typed it. The InputGroup stuff, how you use it is up to you. :)
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

  • Mooch
  • [*]
  • Verified
Re: Gauntlet clone, with extra features, and also online.
Reply #33

You can put the XY in variables, you can simply do something like this, using global variables (a bad practice, but sufficient for small games). Then you can use the variables whenever. But you have to constantly update the location by repeatedly calling the get functions.

Code: [Select]

var player_x = 0;
var player_y = 0;

function Update()
{
    player_x = GetPersonX("player");
    player_y = GetPersonY("player");

    SetPersonX("player", player_x + 1);
    SetPersonY("player", player_y + 1); // etc.
}


That's not so bad.

Image.blit() and various other things not relating to the map engine work. It's common sense what's related the map engine and what's not, so I can't give you a list of everything that works while it's running or not, you'll just have to experiment. But player, layer stuff etc, are going to be MapEngine related.


Not obvious to me, heh. I was pretty sure anything graphical at all would require the ME. I'm surprised and delighted that you can draw system font and blit stuff without the ME running.

While I'm filling out the Wiki's API, I'll note which commands require the Map Engine. And I'll find those out by experimenting.

Quote from: mooch

And wait, is that gonna be in C++? I just wanna see the exact Javascript that's being run for various API commands.


It is in C++. There are no direct JS equivalents. I showed you what the MapEngine looks in JS, but that's just a portion of it - namely the runner - but that's because I chose to write it in JS (and my knowledge of Sphere has of late grown immensely). You may be wondering where the actual JS is, how you get those functions in the engine. Well, they are in fact C++ functions embedded into the JS environment, so you are practically running C++ code inside of those functions. They weren't designed for you to know how they work, you're just supposed to use them. Though for the MapEngine it does get tricky and is often asked about. If you looked at the actual C++ though you'd be more lost than ever. The explanation I gave - the one in JS - is really not that bad.


Fudgy pops. Yeah, I guess I'll just accept that it works and not worry about how.

Finally, that axis code should work as I typed it. The InputGroup stuff, how you use it is up to you. :)


Thanks again for all your help. I'm gonna try to reel in my questions a bit, see how much I can figure out on my own. Don't wanna detract you from working on SFML, 'cause I can't friggin' wait for that to be released. It'll be so awesome being able to make games and just point my friends to a URL where they can play it. Everything's web-based nowadays, so people have become too lazy to bother downloading anything.

Look forward to my Multitap Hack, as I'm calling it. It's going good so far, I can't see any theoretical reason why it shouldn't work. Though I'm sure even if I produce working code, it'll be inefficient as a butt, and you and everyone else will be able to see a much better way of doing it.

Still, just getting it to work will be an accomplishment. That's my style -- just get it to work, worry about it being pretty later.

  • Flying Jester
  • [*]
  • Verified
  • TurboSphere Developer
Re: Gauntlet clone, with extra features, and also online.
Reply #34

Not obvious to me, heh. I was pretty sure anything graphical at all would require the ME. I'm surprised and delighted that you can draw system font and blit stuff without the ME running.

While I'm filling out the Wiki's API, I'll note which commands require the Map Engine. And I'll find those out by experimenting.


Almost nothing requires the map engine. The only things that do are part of it, like GetPersonX/Y, ChangeMap and CloseMapEngine.

  • Mooch
  • [*]
  • Verified
Re: Gauntlet clone, with extra features, and also online.
Reply #35
Oh, nice.

Edit: Sorry for all the questions, but I've tried to figure this out on my own and I tried googling and I'm stuck. In Sphere, where do I put a game loop if I'm also running the Map Engine, and how do I structure that loop? Like, let's say I want a counter continuously looping.

Code: [Select]
var gameCounter = 0;

function loopForever() {
   if (gameCounter > 999) {
      gameCounter = 0;
   }
  
   else {
   gameCounter += 1;
   }
}

function game() {
CreatePerson("player1", "spWar.rss", false);
AttachInput("player1");
        MapEngine("test_map.rmp", 60);
}


I know it's crappy code, I'm just testing out here. The problem is...
1) If I call loopForever at the end of loopForever, and right above MapEngine, the game crashes from too much recursion as soon as I load it.

2) If I do the same but call loopForever after MapEngine, the game runs fine until I close the game, at which point I get the too much recursion error.

3) If I create a custom loop that calls MapEngine as well as loopForever, and the custom loop calls itself, same prob -- recursion errors.

I guess I just don't know how to do loops in Sphere, 'cause I've done them in Canvas just fine. It's a lot of code, but here's my code from the beginning of a Wii U Canvas game I was working on. Right now, all you can do is move a colored circle around the Canvas and change its size and color.

Code: [Select]
<!DOCTYPE html><html><body>



<script type="text/javascript">

var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = 854;
canvas.height = 480;
document.body.appendChild(canvas);
// Creates the canvas and sticks it on the page.

var i = -1;
// Necessary starting value for the fiveLoopChecker function.

var fiveLoopRunning = 0;
// So you can check when it starts and stops.

var circleX = canvas.width / 2;
var circleY = canvas.height / 2;
var circleRadius = 24;
// Starts the circle in the center of the canvas with a radius of 24.


var dRed = 255;
var dGreen = 0;
var dBlue = 0;

var sRed = (dRed).toString(16);
var sGreen = (dGreen).toString(16);
var sBlue = (dBlue).toString(16);

var circleColor = "#" + sRed + sGreen + sBlue;
// Variables for the changeColor function. Starts the circle as red.


function initializeGamePad(){
wiiu.gamepad.update();}
// Required to access GamePad controls.


function moveCircle(){
circleX += (wiiu.gamepad.lStickX * 4) + (wiiu.gamepad.rStickX * 4);
circleY -= (wiiu.gamepad.lStickY * 4) + (wiiu.gamepad.rStickY * 4);}
// Moves the circle if the Wii U Gamepad analog sticks are being moved. Use both for SuperSpeed :p


function noClip(){
if (circleX - circleRadius < 0){circleX = circleRadius;}
if (circleX + circleRadius > canvas.width){circleX = canvas.width - circleRadius;}
if (circleY - circleRadius < 0){circleY = circleRadius;}
if (circleY + circleRadius > canvas.height){circleY = canvas.height - circleRadius;}}
// Stops the circle from going off the edge of the canvas.


function clearScreen(){
ctx.clearRect(0, 0, canvas.width, canvas.height);}
// Erases the canvas. Kind of...kind of an obvious one, there >_>


function drawCircle(){
ctx.beginPath();
ctx.arc(circleX, circleY, circleRadius, 0, Math.PI*2, true);
ctx.fillStyle=circleColor;
ctx.fill();}
// Draws a filled circle with radius circleRadius at (circleX, circleY).


function changeCircleSize(){
if ((wiiu.gamepad.hold & 2048) && circleRadius > 1)
{circleRadius -= 1};
if (wiiu.gamepad.hold & 1024)
{circleRadius += 1};}
// Changes the size of the circle when D-Pad left (2048) or right (1024) is pressed.


function changeCircleColor(){
if ((wiiu.gamepad.hold & 512) && dRed < 255){dRed++}
if ((wiiu.gamepad.hold & 256) && dRed > 0){dRed--}
if ((wiiu.gamepad.hold & 8) && dGreen < 255){dGreen++}
if ((wiiu.gamepad.hold & 4) && dGreen > 0){dGreen--}
if ((wiiu.gamepad.hold & 33554432) && dBlue < 255){dBlue++}
if ((wiiu.gamepad.hold & 67108864) && dBlue > 0){dBlue--}}
// Changes the RGB value of the circle.
// Red: D-Pad Up/Down
// Green: Plus/Minus buttons
// Blue: Right Stick Right/Left


function fiveLoopChecker(){
switch (true){
case (i < 0):
fiveLoopRunning = 0;
break;
case (i > -1 && i < loopEndValue):
loopThisFunction();
i ++;
break;
case (i == loopEndValue):
i == -1;
break;}}
// Emulates a for loop, but doesn't lock up the system since one iteration is run per frame.


function fiveLoop(loopMe,thisManyTimes){
loopThisFunction = loopMe;
loopEndValue = thisManyTimes;
i = 0;
fiveLoopRunning = 1;}
// Plug in a function (which is stored in a variable and without parenthesis) and a value (in frames) to loop the function.


function jamesLoopton(){
initializeGamePad();
moveCircle();
noClip();
changeCircleSize();
clearScreen();
drawCircle();
fiveLoopChecker();}
// The game loop.


setInterval(jamesLoopton, 16);
// Runs the game loop every sixteen milliseconds. Almost synchs up with 60 FPS.


</script></body></html>


I'm not as dumb as I let on -- I churned out that Wii U thing all on my own, with nothing but the Mozilla Javascript reference and a few questions asked to a coding forum. I just have no idea how to make stuff run continuously in Sphere.
  • Last Edit: December 09, 2013, 07:49:37 am by Mooch

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Gauntlet clone, with extra features, and also online.
Reply #36
Quote
1) If I call loopForever at the end of loopForever, and right above MapEngine, the game crashes from too much recursion as soon as I load it.

Running it before the map engine is not running it during the map engine.

Quote
2) If I do the same but call loopForever after MapEngine, the game runs fine until I close the game, at which point I get the too much recursion error.

Same deal: running it before the map engine is not running it during the map engine. It's not going to change the actual issue with the code.

What are you trying to do, exactly? Pause the map engine to run your own loop? Or do extra things while the map engine is running (in other words, do stuff during each map engine update, so inside the map engine's loop)? These are very different things.

Just pausing the map engine to run your own loop is easy:
Code: [Select]
function loopForever() {
  while (true) {
    //Do your stuff and use break; when done
  }
}



Doing stuff each map update would have to be done by using the SetRenderScript() and SetUpdateScript() instead (check the wiki on how to use those).

  • Mooch
  • [*]
  • Verified
Re: Gauntlet clone, with extra features, and also online.
Reply #37

Quote
1) If I call loopForever at the end of loopForever, and right above MapEngine, the game crashes from too much recursion as soon as I load it.

Running it before the map engine is not running it during the map engine.

Quote
2) If I do the same but call loopForever after MapEngine, the game runs fine until I close the game, at which point I get the too much recursion error.

Same deal: running it before the map engine is not running it during the map engine. It's not going to change the actual issue with the code.

What are you trying to do, exactly? Pause the map engine to run your own loop? Or do extra things while the map engine is running (in other words, do stuff during each map engine update, so inside the map engine's loop)? These are very different things.


Have stuff run every ME update.

Just pausing the map engine to run your own loop is easy:
Code: [Select]
function loopForever() {
  while (true) {
    //Do your stuff and use break; when done
  }
}



Doing stuff each map update would have to be done by using the SetRenderScript() and SetUpdateScript() instead (check the wiki on how to use those).


http://wiki.spheredev.org/API:Functions#Map_scripts

Redlinks. Redlinks, redlinks, REDLINKS!

Ah! Wait! In /sphere/docs/contributed! A help file with info on all the commands ^_^ It even explains how function game() works!

I'm using Sphere 1.5 and nothing happens when you press F1, so I assumed there was no help file. I guess that's what I get for not poking around in the folders.

Well, that settles it. I'm going to fix-up the Wiki and write an awesome, awesome newbie tutorial. I can't tell you how frustrating it is having no readily-available source of good info on Sphere. And I can only imagine everyone else is sick of all my questions already.

Oh, one tiny question that probably only Radnen knows. Does Sphere run at exactly precisely 60 FPS constantly? Or does it fluctuate? Like, theoretically, if I had a different specific game event occur on frames 1 through 60 (function1() on frame 1, function2() on frame 2, etc.), would some of the latter functions get cut off every once in awhile due to only 55 frames occuring on a given second? Or are there sixty frames every single second no matter what?

(Oh, and DaVince, just if you were curious, I'm trying to make a millisecond counter, since there's no API function to return the current frame. ... Oh, wait. There's GetTime. And it's one of the rare bluelinks on the Wiki. Nice. I'll just use that.)

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Gauntlet clone, with extra features, and also online.
Reply #38
Quote
I can't tell you how frustrating it is having no readily-available source of good info on Sphere.

Yeah, we're all sorry about that. The wiki used to be filled with articles, but then things got kind of irrevocably nuked by the previous host. If you think you really understand a certain function, by all means fill up some of these red links. ;)

Also, did you know about DaVince scripting tutorial? It's supposed to be an awesome newbie tutorial, but if it doesn't seem complete enough, I welcome all feedback. :)

Quote
Oh, one tiny question that probably only Radnen knows. Does Sphere run at exactly precisely 60 FPS constantly? Or does it fluctuate? Like, theoretically, if I had a different specific game event occur on frames 1 through 60 (function1() on frame 1, function2() on frame 2, etc.), would some of the latter functions get cut off every once in awhile due to only 55 frames occuring on a given second? Or are there sixty frames every single second no matter what?

Sphere runs at the framerate you give it. For the map engine, this is defined in MapEngine() or with the SetMapEngineFramerate() function. Sphere will always try to run at the frame rate you defined in the map engine. If it can't process everything in a single frame, the map engine will start skipping frames visually, but none of your own code is ever skipped.

For your own loops, the framerate is unlimited until you manually limit it (either with SetFramerate() or using GetTime() to wait for a certain millisecond). Though if your loop needs even more time, I think it starts slowing down the framerate in order to run all your code.

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: Gauntlet clone, with extra features, and also online.
Reply #39
Well, that settles it. I'm going to fix-up the Wiki and write an awesome, awesome newbie tutorial.


For filling in the API pages, there is a procedure you should follow to keep the consistency I've instituted. Otherwise, go nuts and I or another senior editor will spell check and grammar check afterwards!

  • Flying Jester
  • [*]
  • Verified
  • TurboSphere Developer
Re: Gauntlet clone, with extra features, and also online.
Reply #40
Indeed. I for one would be very grateful for anyone adding to the wiki...

Speaking of, I should really contribute to it more, too.

  • Mooch
  • [*]
  • Verified
Re: Gauntlet clone, with extra features, and also online.
Reply #41

Quote
I can't tell you how frustrating it is having no readily-available source of good info on Sphere.

Yeah, we're all sorry about that. The wiki used to be filled with articles, but then things got kind of irrevocably nuked by the previous host. If you think you really understand a certain function, by all means fill up some of these red links. ;)


Somebody's got all the current Wiki pages downloaded, in case another site crash happens, right?

Also, did you know about DaVince scripting tutorial? It's supposed to be an awesome newbie tutorial, but if it doesn't seem complete enough, I welcome all feedback. :)


Skimming it, it's pretty good, but if I had read it prior to making this topic, I still would have had to ask almost all the same questions. It's also very wordy and technically-written, written more like an actual book on Sphere would be. Which a lot of people like, and a lot of people can learn well from, but I'm not very technically-minded myself.

I wanna make something much simpler, much shorter, a lot more visual, while at the same time giving more/different information. For instance, SetRenderScript, which is virtually necessary for any sort of game you might make in Sphere (even if you're doing a straight-up RPG and relying heavily on the Map Engine, you'd need it for stuff like NPC's random movements around the village).

Though I think it's perfectly acceptable and even a good thing to have more than one newbie tutorial, as long as they're significantly different in tone/presentation/etc. That way, a newcomer could use whichever works best for them.

Quote
Oh, one tiny question that probably only Radnen knows. Does Sphere run at exactly precisely 60 FPS constantly? Or does it fluctuate? Like, theoretically, if I had a different specific game event occur on frames 1 through 60 (function1() on frame 1, function2() on frame 2, etc.), would some of the latter functions get cut off every once in awhile due to only 55 frames occuring on a given second? Or are there sixty frames every single second no matter what?

Sphere runs at the framerate you give it. For the map engine, this is defined in MapEngine() or with the SetMapEngineFramerate() function. Sphere will always try to run at the frame rate you defined in the map engine. If it can't process everything in a single frame, the map engine will start skipping frames visually, but none of your own code is ever skipped.

For your own loops, the framerate is unlimited until you manually limit it (either with SetFramerate() or using GetTime() to wait for a certain millisecond). Though if your loop needs even more time, I think it starts slowing down the framerate in order to run all your code.


Got it. Thanks.


Well, that settles it. I'm going to fix-up the Wiki and write an awesome, awesome newbie tutorial.


For filling in the API pages, there is a procedure you should follow to keep the consistency I've instituted. Otherwise, go nuts and I or another senior editor will spell check and grammar check afterwards!


What's the procedure? Or do you mean just keep in line with the style of the bluelink pages?

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: Gauntlet clone, with extra features, and also online.
Reply #42
Procedure

Quote
Somebody's got all the current Wiki pages downloaded, in case another site crash happens, right?

It's on a different host now, and backed up regularly. I mean, why would we not learn from this? ;)

Quote
Skimming it, it's pretty good, but if I had read it prior to making this topic, I still would have had to ask almost all the same questions. It's also very wordy and technically-written, written more like an actual book on Sphere would be. Which a lot of people like, and a lot of people can learn well from, but I'm not very technically-minded myself.

Hm, I did not realize this. I actually wrote it exactly for people who aren't that technically-minded; repeating and over-explaining some of the more difficult concepts. I agree on needing some kind of visual tutorial. I was planning on doing something like that, but probably won't have enough dedication with my own tutorial. Was planning on doing some video tutorials myself, though. And better than the one I made so far.

Quote
What's the procedure? Or do you mean just keep in line with the style of the bluelink pages?

Instructions are at the top of the Functions page. But those are for making articles about functions, not your own newbie; you can go crazy in your own tutorial.
  • Last Edit: December 11, 2013, 04:16:09 am by DaVince

  • Mooch
  • [*]
  • Verified
Re: Gauntlet clone, with extra features, and also online.
Reply #43

Quote
Skimming it, it's pretty good, but if I had read it prior to making this topic, I still would have had to ask almost all the same questions. It's also very wordy and technically-written, written more like an actual book on Sphere would be. Which a lot of people like, and a lot of people can learn well from, but I'm not very technically-minded myself.

Hm, I did not realize this. I actually wrote it exactly for people who aren't that technically-minded; repeating and over-explaining some of the more difficult concepts. I agree on needing some kind of visual tutorial. I was planning on doing something like that, but probably won't have enough dedication with my own tutorial. Was planning on doing some video tutorials myself, though. And better than the one I made so far.


Don't just go by me, though -- maybe I'm just really dumb :p
Ask some other people before you go changing anything.


Quote
What's the procedure? Or do you mean just keep in line with the style of the bluelink pages?

Instructions are at the top of the Functions page. But those are for making articles about functions, not your own newbie; you can go crazy in your own tutorial.


Gotcha.

~ ~ ~

PROJECT UPDATE

I'm cancelling this project. I've spent a week trying to get my Multitap Hack to work, and it's no good. The problem isn't that I'm not an experienced enough coder, the problem is that Sphere works differently than I thought it did; I don't think it's actually possible to do what I was trying to do.

To sum up, I was going to use time-division multiplexing to rapidly switch AttachInput between multiple players, reading their input and performing their actions at different times, but fast enough that players wouldn't notice. That's how the SNES Multitap, after which my script was named, works.

Unfortunately, the Map Engine runs in such a way as to make this particular hack impossible -- anything within a RenderScript runs completely, in a packet, and then the rest of the Map Engine runs, so what ended up happening was, the Multitap code would only AttachInput for the last player in the list.

I didn't get any errors or anything, it's just that it only controlled Player 4, no matter which way I coded it, because the RenderScript runs completely -- I can't have Player 1's input read and run, and then let the entire Map Engine run, and then switch it to Player 2.

Sphere just isn't meant for multiplayer.

It's okay, though! This was just gonna be a quick project to get into the swing of things, which is why it was gonna be a clone. I'll work on something original, instead.

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: Gauntlet clone, with extra features, and also online.
Reply #44
What you want to do is actually possible--what you have to do is have a counter variable that cycles through 4 different values, and each time the renderscript runs you attach input to a different player based on the value of the counter, and then set it to the next value.
miniSphere 4.8.2 - Cell compiler - SSj debugger
Forum Thread | GitHub Repo