Spherical forums

User-Made => Projects => Topic started by: Mooch on November 30, 2013, 11:40:15 pm

Title: Gauntlet clone, with extra features, and also online.
Post by: Mooch on November 30, 2013, 11:40:15 pm
Using Sphere 1.5 [recommended] on Windows XP Professional

To get myself back into the swing of programming after awhile, I'm gonna try to make a simple Gauntlet-style game. It'll be a straightup clone at first, but then I'm gonna see if I can make it unique.

Due to medical problems that make it difficult for me to use a computer for long periods of time, and doubly due to my inexpertise in programming in the first place, this is gonna be a long, slow project. I'm mainly making this topic to motivate myself to think things through and stick with it.

Anyway, I'm going to implement one tiny feature at a time. It's probably best for me if I only describe what I'm working on at the moment; if I start listing all the features I wanna include, I'll just get too carried away, too daunted and give up.

So! First, simple thing's first. Laughably simple, since Sphere has the MapEngine -- just get four players moving around the screen at the same time. No online yet, I'll just have them all controlled from the same keyboard. I'll post again when I finish, or hit a roadblock.

EDIT: Okay, roadblock one. Well, question, actually. When importing a tileset, is it possible to have it offset the tiles? 'cause I found a nice Guantlet II tileset, but there's borders between the tiles, and I'd like to not have to edit the file myself to get rid of them.

Also, can I choose an "invisible color" for tiles? I know you can for sprites, but what about tiles?

Also also, can a map have a background color? So that I could have it show through the invisible parts of the tiles, of course.

'Nother Problem: Trying to create a spritesheet.

1) How do I change the dimensions of sprites? It's 16x32, I want it 16x16.

2) When I edit or paste an image into one frame of one direction, it edits or pastes it into all the frames for every direction!
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 01, 2013, 02:38:19 am

EDIT: Okay, roadblock one. Well, question, actually. When importing a tileset, is it possible to have it offset the tiles? 'cause I found a nice Guantlet II tileset, but there's borders between the tiles, and I'd like to not have to edit the file myself to get rid of them.


No, you'll have to do that manually or write some code to do that for you. :/


Also, can I choose an "invisible color" for tiles? I know you can for sprites, but what about tiles?


Yes, there is an alpha slider in the tile image editor, slide it to 0 and floodfill the area. It's no different than what you do for all other images in Sphere whether you are using my editor or the vanilla editor.


Also also, can a map have a background color? So that I could have it show through the invisible parts of the tiles, of course.


Well yeah, you create a tile of a certain color and then flood fill that on a bottom-most layer.


1) How do I change the dimensions of sprites? It's 16x32, I want it 16x16.


Go to the menu. Hit spriteset. Then hit resize. Type in your size and go.


2) When I edit or paste an image into one frame of one direction, it edits or pastes it into all the frames for every direction!


Well there are two views in the spriteset editor, which I guess makes it a bit confusing to first use. There is the direction view and the tileset view. You want to do the manipulations in the tileset view and then change the frames in the direction view. The reason why you see the frames automatically update is because they are all tied to the same graphic in the tileset. Once you realize the tileset graphic and the direction frames are linked then you just create new images for the new frames and go on from there.

Edit:
I should say your goal is MASSIVE. To get 4 players walking, tied to different inputs is not easy. Sphere makes the key mapping easy by having a player configuration hidden under the hood, but the movement input is set up to a single entity only. To manipulate four different people requires mastery over Sphere's command queue. It's not overly difficult, it is possible, but it's not a standard built-in component of the map engine.

I'd try to get a single person walking around. Teleporting. Leveling. Killing monsters. Loot. Then worry about adding three others afterwards, and internet stuff last.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 01, 2013, 05:44:09 am


EDIT: Okay, roadblock one. Well, question, actually. When importing a tileset, is it possible to have it offset the tiles? 'cause I found a nice Guantlet II tileset, but there's borders between the tiles, and I'd like to not have to edit the file myself to get rid of them.


No, you'll have to do that manually or write some code to do that for you. :/


Oh well. GameMaker has it, I got used to it, heh. I'll just edit the png.



Also, can I choose an "invisible color" for tiles? I know you can for sprites, but what about tiles?


Yes, there is an alpha slider in the tile image editor, slide it to 0 and floodfill the area. It's no different than what you do for all other images in Sphere whether you are using my editor or the vanilla editor.


Ah, there it is. Thanks. I'm using the vanilla editor because "Sphere Editor.exe is not a valid Win32 application." I can't get your editor to work. Probably should've made a topic about that, I assume your editor has a bazillion features the normal one doesn't.



Also also, can a map have a background color? So that I could have it show through the invisible parts of the tiles, of course.


Well yeah, you create a tile of a certain color and then flood fill that on a bottom-most layer.


I was not aware there were multiple tile layers. The 1.5 editor isn't very newbie-friendly, apparently. Or I'm especially dumb, which is not at all unlikely.


1) How do I change the dimensions of sprites? It's 16x32, I want it 16x16.


Go to the menu. Hit spriteset. Then hit resize. Type in your size and go.


Ah! Didn't see that pop up on the menu.



2) When I edit or paste an image into one frame of one direction, it edits or pastes it into all the frames for every direction!


Well there are two views in the spriteset editor, which I guess makes it a bit confusing to first use. There is the direction view and the tileset view. You want to do the manipulations in the tileset view and then change the frames in the direction view. The reason why you see the frames automatically update is because they are all tied to the same graphic in the tileset. Once you realize the tileset graphic and the direction frames are linked then you just create new images for the new frames and go on from there.


Oh! I see. Man, that is NOT made clear anywhere. I know -- I'm gonna make a newbie-friendly tutorial and slap it up on the Wiki as I go along and learn things. That way, nobody else will have to scratch their heads at this stuff, we can just point 'em to my tut.

Edit:
I should say your goal is MASSIVE. To get 4 players walking, tied to different inputs is not easy. Sphere makes the key mapping easy by having a player configuration hidden under the hood, but the movement input is set up to a single entity only. To manipulate four different people requires mastery over Sphere's command queue. It's not overly difficult, it is possible, but it's not a standard built-in component of the map engine.


Aw, whaaat? I thought AttachInput would be, how to say, instanced. Like, if I have four people all playing together online, AttachInput would only control their character.

I guess that explains why, despite the socket stuff in the API, nobody's doing anything with online multiplayer -- Sphere is built to be single-player.

Well, fudge-sicles. There's no way I'm gonna be able to do something as complex as multiplayer input on my own. I guess I'll abandon the Gauntlet clone, then, and think of something singleplayer to work on.

I don't suppose it'd be a simple matter for you to, on the next Sphere release, add AttachInput1, AttachInput2, etc. commands to the API, huh?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 01, 2013, 10:18:55 am
Um. I don't see why you wouldn't be able to control four characters at the same time from a single keyboard. Yes, they all come from the same single command queue, but you're pressing different keys for different characters so it's not really an issue. Heck, even several keyboards would work, as long as you set up different keys for different players. Adding controller support for this would also not be difficult.

The main hurdle with having four people on the same keyboard, though, is that most keyboard seem to have a hardware limitation where you can only press 4 to 5 keys at the same time. If you press more keys than that, they're just not sent to the system at all (so this is a problem for any software, any OS, etc). Having multiple keyboards or gamepads could solve this, easy.





2) When I edit or paste an image into one frame of one direction, it edits or pastes it into all the frames for every direction!


Well there are two views in the spriteset editor, which I guess makes it a bit confusing to first use. There is the direction view and the tileset view. You want to do the manipulations in the tileset view and then change the frames in the direction view. The reason why you see the frames automatically update is because they are all tied to the same graphic in the tileset. Once you realize the tileset graphic and the direction frames are linked then you just create new images for the new frames and go on from there.


Oh! I see. Man, that is NOT made clear anywhere. I know -- I'm gonna make a newbie-friendly tutorial and slap it up on the Wiki as I go along and learn things. That way, nobody else will have to scratch their heads at this stuff, we can just point 'em to my tut.

If it helps, I made a (bit too fast) video tutorial on basic usage of the sprite editor. It explains exactly this. http://youtu.be/3jt8r-KKPkU
Edit: wow, looking back at it, I really need to remake this video tutorial. My previous recording software bugged out, making things too fast and messy.


I also have to say... You've been trying out some not quite conventional stuff that makes me realize that Sphere really needs some new and changed functionality... Hopefully, when TurboSphere and Sphere-SFML are complete, issues like these will be addressed and functionality will be added. Sorry to read that the engine isn't quite convenient for some of your purposes right now, though. :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 01, 2013, 02:40:09 pm

Um. I don't see why you wouldn't be able to control four characters at the same time from a single keyboard. Yes, they all come from the same single command queue, but you're pressing different keys for different characters so it's not really an issue. Heck, even several keyboards would work, as long as you set up different keys for different players. Adding controller support for this would also not be difficult.

The main hurdle with having four people on the same keyboard, though, is that most keyboard seem to have a hardware limitation where you can only press 4 to 5 keys at the same time. If you press more keys than that, they're just not sent to the system at all (so this is a problem for any software, any OS, etc). Having multiple keyboards or gamepads could solve this, easy.


For those who are experienced it's not too bad, but I don't know if a newbie can so easily do it. It's not an out-of-the-box thing for Sphere, like single player movement is.

Hmm, a good start I guess:
Code: (javascript) [Select]

function Move(name, inputs) {
    if (!IsCommandQueueEmpty(name)) return;

    if (IsKeyPressed(inputs.up)) QueuePersonCommand(name, COMMAND_MOVE_NORTH, false);
    else if (IsKeyPressed(inputs.down)) QueuePersonCommand(name, COMMAND_MOVE_SOUTH, false);
    else if (IsKeyPressed(inputs.left)) QueuePersonCommand(name, COMMAND_MOVE_WEST, false);
    else if (IsKeyPressed(inputs.right)) QueuePersonCommand(name, COMMAND_MOVE_EAST, false);
}

var inputs = [];
inputs[0] = { up: KEY_UP, down: KEY_DOWN, left: KEY_LEFT, right: KEY_RIGHT };
inputs[1] = { up: KEY_W, down: KEY_S, left: KEY_A, right: KEY_D };
inputs[2] = { up: KEY_U, down: KEY_J, left: KEY_H, right: KEY_K };
inputs[3] = { up: KEY_NUM_8, down: KEY_NUM_2, left: KEY_NUM_4, right: KEY_NUM_6 };

var players = ["player1", "player2", "player3", "player4"];

function Update() {
    for (var i = 0; i < players.length; ++i) {
        Move(players[i], inputs[i]);
    }
}

function game() {
    CreatePerson("player1", "player.rss", false);
    CreatePerson("player2", "player.rss", false);
    CreatePerson("player3", "player.rss", false);
    CreatePerson("player4", "player.rss", false);

    SetUpdateScript("Update()");
    MapEngine("map.rmp", 60);
}


I guess that's the minimum. You'll have to set the people in different places, otherwise they'll be on top of each other. Notice I didn't use AttachInput(), that means triggers won't fire, and NPC's can't be talked to. But there are ways around that. The above is a good start tho.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 01, 2013, 08:00:15 pm

Um. I don't see why you wouldn't be able to control four characters at the same time from a single keyboard. Yes, they all come from the same single command queue, but you're pressing different keys for different characters so it's not really an issue. Heck, even several keyboards would work, as long as you set up different keys for different players. Adding controller support for this would also not be difficult.


That was actually my plan; I was gonna design this for use with game controllers. I was gonna have the 1, 2, 3, 4, 5, 6, 7 and 8 keyboard keys be used as Up, Down, Left, Right, B, A, Select, Start for Player 1, and q through i for Player 2, and a through k for Player 3, and z through , for Player 4.

Linerally like that so you can easily hook the corresponding commands up to the different game controllers you have plugged in.

The main hurdle with having four people on the same keyboard, though, is that most keyboard seem to have a hardware limitation where you can only press 4 to 5 keys at the same time. If you press more keys than that, they're just not sent to the system at all (so this is a problem for any software, any OS, etc). Having multiple keyboards or gamepads could solve this, easy.


No need -- just use a keyboard emulation program like GlovePIE. Indeed, I wanted to specifically design this for use with GlovePIE and Wiimotes. It's a fantastic program, you should take a look at it.





2) When I edit or paste an image into one frame of one direction, it edits or pastes it into all the frames for every direction!


Well there are two views in the spriteset editor, which I guess makes it a bit confusing to first use. There is the direction view and the tileset view. You want to do the manipulations in the tileset view and then change the frames in the direction view. The reason why you see the frames automatically update is because they are all tied to the same graphic in the tileset. Once you realize the tileset graphic and the direction frames are linked then you just create new images for the new frames and go on from there.


Oh! I see. Man, that is NOT made clear anywhere. I know -- I'm gonna make a newbie-friendly tutorial and slap it up on the Wiki as I go along and learn things. That way, nobody else will have to scratch their heads at this stuff, we can just point 'em to my tut.

If it helps, I made a (bit too fast) video tutorial on basic usage of the sprite editor. It explains exactly this. http://youtu.be/3jt8r-KKPkU
Edit: wow, looking back at it, I really need to remake this video tutorial. My previous recording software bugged out, making things too fast and messy.


Heh, nice. I thought of using "directions" as animations, too ^_^ Actually, I thought of having 16 x 16 sprites, but actually making them 16 x 32, but only drawing the sprite as 16 x 16 pixels on the lower half of the sprite area, and having the hitbox only be in that area, and using the top half for expression bubbles, like question marks and exclamation points.

I think the main point of confusion is that it's simply not clear at all that the sprite window at the right is part of the process of making a Spriteset.

Either way, I'm gonna get to work on my tutorial.

I also have to say... You've been trying out some not quite conventional stuff that makes me realize that Sphere really needs some new and changed functionality... Hopefully, when TurboSphere and Sphere-SFML are complete, issues like these will be addressed and functionality will be added.


I always push the bounds of any system I use ^_^

I originally got into game programming with Graal Online back in the early 2000s, before they went pay-to-play. That had a C-like scripting system that was so awesome and good, it spoiled me. It had ultra-useful commands like PlayerTouchesMe[Direction], TouchedBy[Entity]. I had to do so little work myself, and got such great results out of it.

Then I got into RPG Maker 2000 and quickly outstretched the limitations of that. Again, so much work was done for me, though, that I got lazy. I got into Game Maker later, but didn't like its closed source.

Actually, funny story, I came across Sphere by complete, utter accident. There's this guy called Musashi who has a website of tabletop RPG and MMORPG-related rants (originally started back in 1995, so it's mostly talking about the original Everquest @_@) and in one article, he mentioned "writing a Sphere shard."

It turns out he was talking about something completely different, some sort of Everquest custom game hosting thing or something, but when I googled "Sphere program editor" I got this.


Sorry to read that the engine isn't quite convenient for some of your purposes right now, though. :)


Oh, it's just 'cause I'm such a novice programmer. If I were experienced, I'd easily be able to do anything I want (I mean, Sphere uses Javascript -- look at all the stuff people do with that). It's just, for now, I have to rely so much on built-in functionality of the IDEs I use that if there's not something there, if I have to resort to doing something on my own, I have to find a workaround.



Um. I don't see why you wouldn't be able to control four characters at the same time from a single keyboard. Yes, they all come from the same single command queue, but you're pressing different keys for different characters so it's not really an issue. Heck, even several keyboards would work, as long as you set up different keys for different players. Adding controller support for this would also not be difficult.

The main hurdle with having four people on the same keyboard, though, is that most keyboard seem to have a hardware limitation where you can only press 4 to 5 keys at the same time. If you press more keys than that, they're just not sent to the system at all (so this is a problem for any software, any OS, etc). Having multiple keyboards or gamepads could solve this, easy.


For those who are experienced it's not too bad, but I don't know if a newbie can so easily do it. It's not an out-of-the-box thing for Sphere, like single player movement is.

Hmm, a good start I guess:
Code: (javascript) [Select]

function Move(name, inputs) {
    if (!IsCommandQueueEmpty(name)) return;

    if (IsKeyPressed(inputs.up)) QueuePersonCommand(name, COMMAND_MOVE_NORTH, false);
    else if (IsKeyPressed(inputs.down)) QueuePersonCommand(name, COMMAND_MOVE_SOUTH, false);
    else if (IsKeyPressed(inputs.left)) QueuePersonCommand(name, COMMAND_MOVE_WEST, false);
    else if (IsKeyPressed(inputs.right)) QueuePersonCommand(name, COMMAND_MOVE_EAST, false);
}

var inputs = [];
inputs[0] = { up: KEY_UP, down: KEY_DOWN, left: KEY_LEFT, right: KEY_RIGHT };
inputs[1] = { up: KEY_W, down: KEY_S, left: KEY_A, right: KEY_D };
inputs[2] = { up: KEY_U, down: KEY_J, left: KEY_H, right: KEY_K };
inputs[3] = { up: KEY_NUM_8, down: KEY_NUM_2, left: KEY_NUM_4, right: KEY_NUM_6 };

var players = ["player1", "player2", "player3", "player4"];

function Update() {
    for (var i = 0; i < players.length; ++i) {
        Move(players[i], inputs[i]);
    }
}

function game() {
    CreatePerson("player1", "player.rss", false);
    CreatePerson("player2", "player.rss", false);
    CreatePerson("player3", "player.rss", false);
    CreatePerson("player4", "player.rss", false);

    SetUpdateScript("Update()");
    MapEngine("map.rmp", 60);
}


I guess that's the minimum. You'll have to set the people in different places, otherwise they'll be on top of each other. Notice I didn't use AttachInput(), that means triggers won't fire, and NPC's can't be talked to. But there are ways around that. The above is a good start tho.


Whoa, thanks! See, this is always my problem -- I can look at your code there, and open up the API, and I can figure out what's going on. I can understand that code, HOWEVER, I would never have been able to come up with that code on my own in the first place. I can look and understand and even modify and improve, but I can't generate; I just don't have the mind for it.

But won't using a for-loop lock up the system?

Not that I can't change it. I was messing around in Canvas for awhile, and I figured out a way to print text character-by-character while allowing you to move your player around (ala Chrono Trigger). If you just use a for-loop, when the text starts to print, your character is frozen, and you can't control it again until the text stops printing. But I made a general-purpose iterator that constantly ran in the game loop, and just used it to print the text.

I can easily use that code here. Modified a bit of course, but I actually know how to do it ^_^

Looks like Gauntlet's back on! Thanks :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 01, 2013, 09:23:21 pm
The main hurdle with having four people on the same keyboard, though, is that most keyboard seem to have a hardware limitation where you can only press 4 to 5 keys at the same time. If you press more keys than that, they're just not sent to the system at all (so this is a problem for any software, any OS, etc). Having multiple keyboards or gamepads could solve this, easy.


I believe that key state polling still works no matter how many keys are held down. On my laptop's keyboard and my two USB keyboards the limit is 8 keys. But that's only for events--if you poll key state (at least on Linux) you still get accurate readings of which keys are pressed. It just won't generate new events for a new key if more than 8 keys are held down at once, though it will still generate events for the eighth key.


Actually, funny story, I came across Sphere by complete, utter accident. There's this guy called Musashi who has a website of tabletop RPG and MMORPG-related rants (originally started back in 1995, so it's mostly talking about the original Everquest @_@) and in one article, he mentioned "writing a Sphere shard."

It turns out he was talking about something completely different, some sort of Everquest custom game hosting thing or something, but when I googled "Sphere program editor" I got this.



Musashi is one of the Sphere old-timers. It could have been a bona-fide Sphere reference, even if in name only.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 01, 2013, 10:41:53 pm

Actually, funny story, I came across Sphere by complete, utter accident. There's this guy called Musashi who has a website of tabletop RPG and MMORPG-related rants (originally started back in 1995, so it's mostly talking about the original Everquest @_@) and in one article, he mentioned "writing a Sphere shard."

It turns out he was talking about something completely different, some sort of Everquest custom game hosting thing or something, but when I googled "Sphere program editor" I got this.



Musashi is one of the Sphere old-timers. It could have been a bona-fide Sphere reference, even if in name only.


What's a Sphere "shard" though?

http://mu.ranter.net/design-theory

Here's his site. Anyone know if that's him?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 01, 2013, 11:00:19 pm
No, never mind. That Musashi is Howard Collins, the Sphere-Musashi is Chris Crawford.

Also, that page you linked has no 'Sphere Shard' text on it...
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 02, 2013, 03:38:14 am

No, never mind. That Musashi is Howard Collins, the Sphere-Musashi is Chris Crawford.

Also, that page you linked has no 'Sphere Shard' text on it...


Whoop. Just linked to the main page. Here's the (two, actually) refs...
http://mu.ranter.net/design-theory/general-topics/beware-the-rp-police
http://mu.ranter.net/design-theory/magic/keeping-magic-magical
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 02, 2013, 04:07:03 am
OK, so that is completely unrelated.

Ah well. The site was still a good read  :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 02, 2013, 07:33:16 am

OK, so that is completely unrelated.

Ah well. The site was still a good read  :)


Yeah, I don't know that Mu guy personally, and I can't even remember how I came across the site, and I've never even played an MMORPG, but I am an amateur RPG designer and fan, and I love his articles. Don't agree with him 100% (he's clearly hardcore into realism, I'm fine with the more fantastical), but everything he's got up there is worth reading.

@Radnen: Hmm. I'm messing around with the code you gave me, and I'm having trouble figuring out a few things. A ton of things, actually, but I don't wanna take up too much of your time or generosity, so I'll just stick with one for now.

How can I get the characters not to spawn on top of each other? I tried using SetPersonXYFloat, but it doesn't do anything. I also tried SetPersonLayer to try putting all the characters on different layers, and that doesn't work either. They all spawn at the Entry Point of the map, and if I give them Bases, become unmovable since they're all stuck in each other.

(If I use Import Image to Spriteset and don't do any further editing, they have no bases and move just freely, so I know they can be moved. It's just a matter of getting them to spawn far enough apart that their bases don't overlap. Ugh, that'll be a pain down the line -- making the characters collide with the walls, but not each other, like in the real Gauntlet games... Oh well, one thing at a time.)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 02, 2013, 09:56:08 am
GlovePIE looks interesting, though the political messages about green energy and all that make me not really want to download it. :P

Quote
Actually, I thought of having 16 x 16 sprites, but actually making them 16 x 32, but only drawing the sprite as 16 x 16 pixels on the lower half of the sprite area, and having the hitbox only be in that area, and using the top half for expression bubbles, like question marks and exclamation points.

There's absolutely no need to do that! Just make your sprite normally, and have your text balloon as a separate spriteset that you show at the appropriate times with CreatePerson(). This will save you a lot of hassle as you don't have to consider every single character/animation/balloon combination.

Quote
I think the main point of confusion is that it's simply not clear at all that the sprite window at the right is part of the process of making a Spriteset.

Agreed; it's not intuitive and causes confusion for pretty much everyone the first time around. I think Radnen's editor does it better (not sure; haven't been able to check it in a while).

Quote
Oh, it's just 'cause I'm such a novice programmer. If I were experienced, I'd easily be able to do anything I want (I mean, Sphere uses Javascript -- look at all the stuff people do with that). It's just, for now, I have to rely so much on built-in functionality of the IDEs I use that if there's not something there, if I have to resort to doing something on my own, I have to find a workaround.

Look, it's not just you being a novice here. I've used Sphere for a long time, and I can find plenty of faults in the API. Some things just aren't intuitive, and ultimately, they really ought to be. Then again, some of the design decisions are pretty outdated (Sphere is OLD!) and could definitely be replaced by much better solutions at this point. All that said, there's a lot I do like about Sphere's API. :)

Quote
But won't using a for-loop lock up the system?

Why would it? That loop finishes as soon as it's iterated through the entire players array... Only loops that have some condition that can never become false would make the engine get stuck. ;)


Quote
I tried using SetPersonXYFloat, but it doesn't do anything. I also tried SetPersonLayer to try putting all the characters on different layers, and that doesn't work either. They all spawn at the Entry Point of the map, and if I give them Bases, become unmovable since they're all stuck in each other.

Where are you putting SetPersonLayer and SetpersonXYFloat? You need to invoke these once the map is loaded, not before that.

There's a problem here, though:
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 02, 2013, 12:01:10 pm
I wouldn't use SetDefaultMapScript since it'll play each time a map is changed. I'd use:

Code: (javascript) [Select]

QueuePersonScript("player1", "code();", true);

// ...

function code() {
    SetPersonXYFloat("player1", x, y);
    SetPersonXYFloat("player2", x, y);
    SetPersonXYFloat("player3", x, y);
    SetPersonXYFloat("player4", x, y);
}


The above is just an example you'll need to set the xy's and make sure to put the QueuePersonScript after you create the person but before you call MapEngine(), and put the code() function (which you can rename to anything) somewhere else in the code file.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 02, 2013, 02:14:53 pm
Oh, hey, I never would have thought of using a person script for that. Pretty clever solution. :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: N E O on December 02, 2013, 02:17:48 pm
There used to be an old multiplayer demo of Bomberman for Sphere that may or may not still be useful for learning multiplayer basics with AttachInput. Somebody here still have that?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 03, 2013, 06:18:16 am

GlovePIE looks interesting, though the political messages about green energy and all that make me not really want to download it. :P


Lars Ulrich is a douche. Doesn't mean you shouldn't listen to Metallica :p

Quote
Actually, I thought of having 16 x 16 sprites, but actually making them 16 x 32, but only drawing the sprite as 16 x 16 pixels on the lower half of the sprite area, and having the hitbox only be in that area, and using the top half for expression bubbles, like question marks and exclamation points.

There's absolutely no need to do that! Just make your sprite normally, and have your text balloon as a separate spriteset that you show at the appropriate times with CreatePerson(). This will save you a lot of hassle as you don't have to consider every single character/animation/balloon combination.


Oh, nice.

Quote
I think the main point of confusion is that it's simply not clear at all that the sprite window at the right is part of the process of making a Spriteset.

Agreed; it's not intuitive and causes confusion for pretty much everyone the first time around. I think Radnen's editor does it better (not sure; haven't been able to check it in a while).


I still can't get it working. I'd really prefer to use it, especially so as I write my newbie guide, I can have directions for the vanilla editor and Sphere Studio.

Quote
Oh, it's just 'cause I'm such a novice programmer. If I were experienced, I'd easily be able to do anything I want (I mean, Sphere uses Javascript -- look at all the stuff people do with that). It's just, for now, I have to rely so much on built-in functionality of the IDEs I use that if there's not something there, if I have to resort to doing something on my own, I have to find a workaround.

Look, it's not just you being a novice here. I've used Sphere for a long time, and I can find plenty of faults in the API. Some things just aren't intuitive, and ultimately, they really ought to be. Then again, some of the design decisions are pretty outdated (Sphere is OLD!) and could definitely be replaced by much better solutions at this point. All that said, there's a lot I do like about Sphere's API. :)


A ground-up Sphere rewrite by Radnen, you say?

In all seriousness, you should create an exhaustive list of API features you'd like to see added/modified. If nothing else, then for something to think about. Since I'm just beginning (re-beginning, technically), the only major things that're obvious to me that I'd like to see different in the API is multiplayer support, including multiple AttachInputs (for at least four players) and being able to load multiple maps simultaneously (so when playing online with others, you don't all always have to be on the same map).

Since multiplayer gaming is so popular, I think those would be massive boons for Sphere. Though the web-based implementation Radnen (and others?) are currently working on is definitely the best starting place. I can't wait 'til that's finished.

Actually, ooh! Rad, you said it'd be at least a year, right? It should probably take me that long to get something playable churned out. That'll be a happy coincidence.

(Also, since I didn't find it until 2009/2010, I didn't know Sphere was old. How old we talking?)

Quote
But won't using a for-loop lock up the system?

Why would it? That loop finishes as soon as it's iterated through the entire players array... Only loops that have some condition that can never become false would make the engine get stuck. ;)


Before the site relaunch, when I first joined the old Sphere forum, I was trying to make Chrono Trigger-style text boxes where you could walk around while they type out the text, and I used a for-loop and it froze player input until the text finished typing.


I wouldn't use SetDefaultMapScript since it'll play each time a map is changed. I'd use:

Code: (javascript) [Select]

QueuePersonScript("player1", "code();", true);

// ...

function code() {
    SetPersonXYFloat("player1", x, y);
    SetPersonXYFloat("player2", x, y);
    SetPersonXYFloat("player3", x, y);
    SetPersonXYFloat("player4", x, y);
}


The above is just an example you'll need to set the xy's and make sure to put the QueuePersonScript after you create the person but before you call MapEngine(), and put the code() function (which you can rename to anything) somewhere else in the code file.


Woo hoo! That worked! Radnen, you rock. I'm gonna try to see what I can accomplish on my own for a few days. First of all, your demo script doesn't allow diagonal movement -- the characters can only move one, cardinal direction at a time. Secondly, it'd obviously be preferable to have an event handler for all the input rather than hard-coding it.

This is where I excel -- taking working code and tweaking it to my needs.

Thanks again ^_^


There used to be an old multiplayer demo of Bomberman for Sphere that may or may not still be useful for learning multiplayer basics with AttachInput. Somebody here still have that?


Heh, I wonder if we could do what Nintendo did with the SNES Multitap. It doesn't actually add third and fourth player code or functionality. What it does is rapidly switch what the console is interpreting as players 1 and 2 between the first two controllers plugged in, and the second two plugged in. So controller 3 is actually reporting as controller 1, and controller 4 is reporting as controller 2, just at different times than the proper controllers are.

Which is why a game has to be programmed specifically to use the Multitap, 'cause the game code has to be written to interpret player 1/2 and player 3/4 input at different times.

...

Actually, that sounds like a pretty awesome, totally-doable way to do multiplayer in Sphere. Kinda like how biplanes with machineguns had little stoppers to make sure the bullets only fired when the propellers weren't in the way, someone (not me, not good enough yet) could write code that AttachInputs to one player on millisecond 1, 5, 9, 13, etc.; to a second player on milliseconds 2, 6, 10, 14, etc.; a third player; a fourth player.

That way, everyone can use the useful, pre-programmed AttachInput and get its full functionality (triggers, NPCs).
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 03, 2013, 07:10:19 am
It would probably be a lot easier to just manhandle the Map Engine and manually set Person positions, check for obstructions, and such. I used to do that sort of thing a lot, even for single player games.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 03, 2013, 07:14:29 am
Quote
A ground-up Sphere rewrite by Radnen, you say?

He's doing that; it's called Sphere-SFML. And Flying Jester is writing TurboSphere. Both are pretty promising (and FJ's thing is cross-platform). :)

Quote
(Also, since I didn't find it until 2009/2010, I didn't know Sphere was old. How old we talking?)

It's been around since a bit before 2000, I believe. Also the reason there's reimplementations being made right now; current Sphere with its old engine and editor has a bunch of different issues (some of which being outdated libraries that don't get updated any more).

Quote
Before the site relaunch, when I first joined the old Sphere forum, I was trying to make Chrono Trigger-style text boxes where you could walk around while they type out the text, and I used a for-loop and it froze player input until the text finished typing.

Ah, I see. It does freeze player input since it's a loop and you're not explicitly checking for any input in that loop, so that's something you'd have to implement yourself when desirable. In this case, though, the loop takes shorter than even a single frame, so...
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 03, 2013, 11:52:17 pm

It would probably be a lot easier to just manhandle the Map Engine and manually set Person positions, check for obstructions, and such. I used to do that sort of thing a lot, even for single player games.


Manually setting Person positions is fine. Manually checking for obstructions? Way beyond me. Besides, what would be the point in using the Map Engine at all if not for its default collision detection?


Quote
A ground-up Sphere rewrite by Radnen, you say?

He's doing that; it's called Sphere-SFML. And Flying Jester is writing TurboSphere. Both are pretty promising (and FJ's thing is cross-platform). :)


Oh! I thought Sphere-SFML was merely a thing to make your Sphere games run in a browser, I didn't know it was totally recoding. Will games made with the old Sphere run in SFML (need a catchier name there, Rad) or TurboSphere?

Quote
(Also, since I didn't find it until 2009/2010, I didn't know Sphere was old. How old we talking?)

It's been around since a bit before 2000, I believe. Also the reason there's reimplementations being made right now; current Sphere with its old engine and editor has a bunch of different issues (some of which being outdated libraries that don't get updated any more).

Quote
Before the site relaunch, when I first joined the old Sphere forum, I was trying to make Chrono Trigger-style text boxes where you could walk around while they type out the text, and I used a for-loop and it froze player input until the text finished typing.

Ah, I see. It does freeze player input since it's a loop and you're not explicitly checking for any input in that loop, so that's something you'd have to implement yourself when desirable. In this case, though, the loop takes shorter than even a single frame, so...


I was confused, I see the difference now. Radnen used a for-loop to iterate a task that essentially happens beneath the player's awareness, I was using a for-loop to run an in-game event.

I eventually solved my CT-style text problem, when messing around in Canvas. I'll have to post the code once I get it working in Sphere. Or rather, rewrite it in Sphere.

Quick Question
Is function game() the actual game loop for a Sphere game, or would I have to make my own game loop with Javascript? I'm guessing it's not a loop, since in Radnen's sample code, the CreatePerson commands don't happen over and over again, they only happen once.
...
Or do they keep happening? Are they being called every time function game() loops?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: mezzoEmrys on December 04, 2013, 12:01:27 am
The function game() occurs once, MapEngine() is what keeps the game running after that, if you want it to loop you'd need game() to call itself at the end.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 04, 2013, 12:24:29 am


It would probably be a lot easier to just manhandle the Map Engine and manually set Person positions, check for obstructions, and such. I used to do that sort of thing a lot, even for single player games.


Manually setting Person positions is fine. Manually checking for obstructions? Way beyond me. Besides, what would be the point in using the Map Engine at all if not for its default collision detection?


You can ask the map engine if things are/would be obstructed.




Quote
A ground-up Sphere rewrite by Radnen, you say?

He's doing that; it's called Sphere-SFML. And Flying Jester is writing TurboSphere. Both are pretty promising (and FJ's thing is cross-platform). :)


Oh! I thought Sphere-SFML was merely a thing to make your Sphere games run in a browser, I didn't know it was totally recoding. Will games made with the old Sphere run in SFML (need a catchier name there, Rad) or TurboSphere?


You need to make minor changes for your Sphere 1.x game to work in TurboSphere. Sphere's objects aren't set up in a JavaScripty way. For instance, in Sphere 1.x:
Code: [Select]

var Red = CreateColor(255, 0, 0);

In TurboSphere:
Code: [Select]

var Red = new Color(255, 0, 0);


Or more interestingly:
Code: [Select]

var Picture = LoadSurface("pic.tga");
var Surf = CreateSurface(16, 16, Red);

TurboSphere overloads constructors:
Code: [Select]

var Picture = new Surface("pic.tga");
var Surf = new Surface(16, 16, Red);


I have tried, and it is pretty easy to write scripts to adapt the TurboSphere to run Sphere 1.x code.

But I rather prefer the more constructor-y way.


Quick Question
Is function game() the actual game loop for a Sphere game, or would I have to make my own game loop with Javascript? I'm guessing it's not a loop, since in Radnen's sample code, the CreatePerson commands don't happen over and over again, they only happen once.
...
Or do they keep happening? Are they being called every time function game() loops?


I'd recommend putting a game loop inside gam(). I wouldn't recommend recursing game. You will quickly run into errors about being too deeply recursed. Plus...it would be kind of weird.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 04, 2013, 12:31:24 am


Quote
A ground-up Sphere rewrite by Radnen, you say?

He's doing that; it's called Sphere-SFML. And Flying Jester is writing TurboSphere. Both are pretty promising (and FJ's thing is cross-platform). :)


Oh! I thought Sphere-SFML was merely a thing to make your Sphere games run in a browser, I didn't know it was totally recoding. Will games made with the old Sphere run in SFML (need a catchier name there, Rad) or TurboSphere?


You should be able to drop in any old Sphere game and it should just work. But of course, there are problems since I'm not finished yet. It seems to handle newer Sphere v1.5+ games better than the old ones (they just simply crash sometimes). :/ (I think it might be in the dataformats, I only support the latest spriteset, windowstyle, formats etc. That said the new formats are pretty much unchanged since the Sphere 1.* days. So only really old games wouldn't work).
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 04, 2013, 08:51:39 am

The function game() occurs once, MapEngine() is what keeps the game running after that, if you want it to loop you'd need game() to call itself at the end.

Yeah, game() occurs only one, but MapEngine() isn't what keeps the game running after that. That's only the case if you actually run the map engine, but if you create any old loop yourself, that will be what keeps the game running instead. Plenty of non-map engine Sphere games do this! :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 06, 2013, 01:38:22 am

The function game() occurs once, MapEngine() is what keeps the game running after that, if you want it to loop you'd need game() to call itself at the end.


...?

If game() only occurs once, and MapEngine() is within game(), how does MapEngine() keep running? Is it hard-coded in the Sphere engine to keep running once called?

Also, if game() only occurs once, is it a necessary function or can I just name it anything?

(Ugh, pretty much every link in the new Sphere wiki API page is a redlink.)

Oh, and can I just use setInterval() for my loop? That's what I did when I was messing around in Canvas.




It would probably be a lot easier to just manhandle the Map Engine and manually set Person positions, check for obstructions, and such. I used to do that sort of thing a lot, even for single player games.


Manually setting Person positions is fine. Manually checking for obstructions? Way beyond me. Besides, what would be the point in using the Map Engine at all if not for its default collision detection?


You can ask the map engine if things are/would be obstructed.


Oh, I see. I thought you meant write my own collision detection code.




Quote
A ground-up Sphere rewrite by Radnen, you say?

He's doing that; it's called Sphere-SFML. And Flying Jester is writing TurboSphere. Both are pretty promising (and FJ's thing is cross-platform). :)


Oh! I thought Sphere-SFML was merely a thing to make your Sphere games run in a browser, I didn't know it was totally recoding. Will games made with the old Sphere run in SFML (need a catchier name there, Rad) or TurboSphere?


You need to make minor changes for your Sphere 1.x game to work in TurboSphere. Sphere's objects aren't set up in a JavaScripty way. For instance, in Sphere 1.x:
Code: [Select]

var Red = CreateColor(255, 0, 0);

In TurboSphere:
Code: [Select]

var Red = new Color(255, 0, 0);


Or more interestingly:
Code: [Select]

var Picture = LoadSurface("pic.tga");
var Surf = CreateSurface(16, 16, Red);

TurboSphere overloads constructors:
Code: [Select]

var Picture = new Surface("pic.tga");
var Surf = new Surface(16, 16, Red);


I have tried, and it is pretty easy to write scripts to adapt the TurboSphere to run Sphere 1.x code.

But I rather prefer the more constructor-y way.


That's not bad at all. Yeah, it sounds like a script could very easily make those conversions.


Quick Question
Is function game() the actual game loop for a Sphere game, or would I have to make my own game loop with Javascript? I'm guessing it's not a loop, since in Radnen's sample code, the CreatePerson commands don't happen over and over again, they only happen once.
...
Or do they keep happening? Are they being called every time function game() loops?


I'd recommend putting a game loop inside gam(). I wouldn't recommend recursing game. You will quickly run into errors about being too deeply recursed. Plus...it would be kind of weird.


Gotcha.




Quote
A ground-up Sphere rewrite by Radnen, you say?

He's doing that; it's called Sphere-SFML. And Flying Jester is writing TurboSphere. Both are pretty promising (and FJ's thing is cross-platform). :)


Oh! I thought Sphere-SFML was merely a thing to make your Sphere games run in a browser, I didn't know it was totally recoding. Will games made with the old Sphere run in SFML (need a catchier name there, Rad) or TurboSphere?


You should be able to drop in any old Sphere game and it should just work. But of course, there are problems since I'm not finished yet. It seems to handle newer Sphere v1.5+ games better than the old ones (they just simply crash sometimes). :/ (I think it might be in the dataformats, I only support the latest spriteset, windowstyle, formats etc. That said the new formats are pretty much unchanged since the Sphere 1.* days. So only really old games wouldn't work).


Sweet! So tell me something -- when Sphere, any ol' version of Sphere, is running, is it actually running the code of the game as Javascript, or is it converting it into something else before its run?

EDIT: 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.

Yeah, 'cause I remember using EvaluateScript(math.js) last time I was using Sphere, back in late 2011, so that I could use math.floor for my dice rolling script. Okay, gotta find what js file addEventListener is in. Or Sphere's equivalent, if there is one.



The function game() occurs once, MapEngine() is what keeps the game running after that, if you want it to loop you'd need game() to call itself at the end.

Yeah, game() occurs only one, but MapEngine() isn't what keeps the game running after that. That's only the case if you actually run the map engine, but if you create any old loop yourself, that will be what keeps the game running instead. Plenty of non-map engine Sphere games do this! :)


Well, even if you are using the Map Engine, you need your own game loop, don't you? I mean, I suppose ultra-simplistic games might not need a loop, but I can't imagine say, a platformer or an RPG that doesn't have a game loop constantly running certain kinds of code.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 06, 2013, 02:20:11 am



The function game() occurs once, MapEngine() is what keeps the game running after that, if you want it to loop you'd need game() to call itself at the end.

Yeah, game() occurs only one, but MapEngine() isn't what keeps the game running after that. That's only the case if you actually run the map engine, but if you create any old loop yourself, that will be what keeps the game running instead. Plenty of non-map engine Sphere games do this! :)


Well, even if you are using the Map Engine, you need your own game loop, don't you? I mean, I suppose ultra-simplistic games might not need a loop, but I can't imagine say, a platformer or an RPG that doesn't have a game loop constantly running certain kinds of code.


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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 06, 2013, 02:20:36 am
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.

MapEngine() is a function, so it calls some code. What it calls is something with a while(true) loop in it. That loop is what runs forever and why it doesn't quit. The Map Engine looks something like this, at it's very basic core:

Code: (javascript) [Select]

function MapEngine(file, rate) {
    ChangeMap(file);
    SetFrameRate(rate);
    while (true) {
        UpdateMapEngine();
        CallUpdateScript();
        RenderMap();
        CallRenderScript();
        FlipScreen();
    }
}


So when you call:
Code: (javascript) [Select]

function game()
{
    // ... work ...

    MapEngine("file.rmp", 60);
}


Just know it goes into another loop that runs the correct code. So in order for it to do anything while the map engine is running you will have to se the update and render scripts. Now, in a better MapEngine than I showed you (the one Sphere uses) the RenderScript will run at the framerate, and so is ideal for your drawing operations - they will also be drawn above the map and they will be drawn at the framerate desired. Update scripts on the other hand run as fast as they can, and if you were to do any drawing in them; it'll be drawn below the MapEngine.

Now you know Sphere's MapEngine. :)

Quote from: mooch

Sweet! So tell me something -- when Sphere, any ol' version of Sphere, is running, is it actually running the code of the game as Javascript, or is it converting it into something else before its run?


In the Sphere 1.* engines the code is actually interpreted by the underlying JavaScript engine, so it's just running it. Now, in my SphereSFML, the code is instead compiled to .NET code, so it's quite fast (so it's turning it into something else). TurboSphere on the other hand uses v8 JavaScript and also compiles it, but to assembly and so is faster still, plus it has many keen optimizations in place (because Google is awesome). But the differences in code execution between the two aren't much since graphics are your major bottleneck. /rant
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 06, 2013, 02:35:33 am
addEventListener is not a part of Sphere's JS--but it is used in web JS (something of the same name exists in Java too, I think). But that's web JS, for web browsers. It's part of the DOM (the API that the layout engine exposes...but we have a Sphere, not a layout engine).

What exactly are you trying to do with it?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 07, 2013, 05:34:52 am
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?

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.

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.


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/

MapEngine() is a function, so it calls some code. What it calls is something with a while(true) loop in it. That loop is what runs forever and why it doesn't quit. The Map Engine looks something like this, at it's very basic core:

Code: (javascript) [Select]

function MapEngine(file, rate) {
    ChangeMap(file);
    SetFrameRate(rate);
    while (true) {
        UpdateMapEngine();
        CallUpdateScript();
        RenderMap();
        CallRenderScript();
        FlipScreen();
    }
}


So when you call:
Code: (javascript) [Select]

function game()
{
    // ... work ...

    MapEngine("file.rmp", 60);
}


Just know it goes into another loop that runs the correct code. So in order for it to do anything while the map engine is running you will have to se the update and render scripts. Now, in a better MapEngine than I showed you (the one Sphere uses) the RenderScript will run at the framerate, and so is ideal for your drawing operations - they will also be drawn above the map and they will be drawn at the framerate desired. Update scripts on the other hand run as fast as they can, and if you were to do any drawing in them; it'll be drawn below the MapEngine.

Now you know Sphere's MapEngine. :)


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.

Quote from: mooch

Sweet! So tell me something -- when Sphere, any ol' version of Sphere, is running, is it actually running the code of the game as Javascript, or is it converting it into something else before its run?


In the Sphere 1.* engines the code is actually interpreted by the underlying JavaScript engine, so it's just running it. Now, in my SphereSFML, the code is instead compiled to .NET code, so it's quite fast (so it's turning it into something else). TurboSphere on the other hand uses v8 JavaScript and also compiles it, but to assembly and so is faster still, plus it has many keen optimizations in place (because Google is awesome). But the differences in code execution between the two aren't much since graphics are your major bottleneck. /rant


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?


addEventListener is not a part of Sphere's JS--but it is used in web JS (something of the same name exists in Java too, I think). But that's web JS, for web browsers. It's part of the DOM (the API that the layout engine exposes...but we have a Sphere, not a layout engine).


Phooey! So I'm gonna have to find out how to do what I want to do and pretty much already know how to do, in Sphere's API. That's always a big slowdown for me -- knowing how to do something in one language or implementation of a language, but not another.

What exactly are you trying to do with it?


Have a proper event handler to deal with multiple player input so that I can have diagonal movement. If you try Radnen's sample code he gave me, it only lets players move in one direction at a time. But I've done stuff in Canvas that allows diagonal movement. Something like this...

Code: [Select]
var keysDown = {};

addEventListener("keydown", function (e) {
keysDown[e.keyCode] = true;
}, false);

addEventListener("keyup", function (e) {
delete keysDown[e.keyCode];
}, false);

var update = function (modifier) {
if (38 in keysDown) { // Player holding up
hero.y -= hero.speed * modifier;
}
if (40 in keysDown) { // Player holding down
hero.y += hero.speed * modifier;
}
if (37 in keysDown) { // Player holding left
hero.x -= hero.speed * modifier;
}
if (39 in keysDown) { // Player holding right
hero.x += hero.speed * modifier;
}


That's from the Canvas Tutorial I linked to above. That's ripped raw just for an example, that code won't work on its own, obviously. I have my tweaked code somewhere on another harddrive, I'm just too lazy to look it up. You can take a gander at the link to see how it works in the tutorial game.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 07, 2013, 07:04:54 am

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.


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.

===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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 07, 2013, 07:14:19 am

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
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 07, 2013, 09:14:14 am
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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 07, 2013, 03:04:33 pm
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. :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 08, 2013, 02:11:09 am

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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 08, 2013, 02:54:24 am

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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 09, 2013, 06:57:28 am
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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 09, 2013, 08:03:38 am
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).
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 09, 2013, 10:51:56 am

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.)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 09, 2013, 11:11:33 am
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 (http://wiki.spheredev.org/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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: N E O on December 09, 2013, 03:55:38 pm
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!
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 09, 2013, 05:51:19 pm
Indeed. I for one would be very grateful for anyone adding to the wiki...

Speaking of, I should really contribute to it more, too.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 10, 2013, 04:22:24 pm

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 (http://wiki.spheredev.org/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?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 11, 2013, 03:48:59 am
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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 13, 2013, 01:06:45 pm

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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Fat Cerberus on December 13, 2013, 01:51:52 pm
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.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: N E O on December 13, 2013, 03:34:18 pm
UGH. Where was the Bomberman tech demo I was telling y'all about?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 13, 2013, 03:52:19 pm

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.


That's exactly what I did, and it wouldn't work. I managed to get all four players being controlled at once (that was an odd one), and just the first or just the fourth player controlled, but not each controlled independently.

Though even if it's possible, I'm still canning the Gauntlet clone. I've got a simple project perfect for Sphere that'll be original, so maybe, if I make it good enough, I can launch a Kickstarter to develop a 3DS / Wii U version, which would be awesome.


UGH. Where was the Bomberman tech demo I was telling y'all about?


Do you remember who made it?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: N E O on December 13, 2013, 10:36:06 pm
Damn, it's not in the repo. :(

I don't know the author off the top of my head, sorry. It was available around the time of the old flik_zelda, kooparoids, and puffpuff demos, though, so anyone here who may still have it check around those dates?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 14, 2013, 01:34:10 pm
I should probably tell you this: renderscript is intended for rendering code in the map engine. You might want to try and see if doing it in an updatescript (with SetUpdateScript) works; this runs at a different moment.

Quote
Sphere just isn't meant for multiplayer.

How do you think this could be changed? I think being able to properly control multiple characters with multiple controls would be interesting.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 14, 2013, 02:59:15 pm
NEO: No prob. I don't have any of the old games. Hopefully someone does, and can re-post them to the Drive.

Vince: The best way I can think of would be for there to be API commands for multiple AttachInputs. Instead of AttachInput(entity), it could be AttachInput(player,entity). Like, AttachInput(1,"Steve"); AttachInput(2,"Blaine"), etc.

Of course, that'd require recoding at the C++ level.

And yeah, I never really knew the difference between SetRender and SetUpdate. I might mess around with it some more, getting a multitap-esque thing working for Sphere would be really cool, but I'm gonna focus on other things for now.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 14, 2013, 03:58:26 pm
Moock, I agree on the AttachInput. I think I'll add that to my SFML version. :)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 14, 2013, 05:50:05 pm

And yeah, I never really knew the difference between SetRender and SetUpdate. I might mess around with it some more, getting a multitap-esque thing working for Sphere would be really cool, but I'm gonna focus on other things for now.

Several differences, two that I at least know of:
SetUpdateScript() runs before rendering anything at all.
SetRenderScript() runs after at least having rendered the map, and before the map engine does its FlipScreen() (which explains why you don't need FlipScreen() for a renderscript).

These facts might not make a difference for the functionality of what you were trying to achieve, though. Now that I think about it I think it's mostly done like this to separate rendering from logic.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 14, 2013, 06:16:51 pm

Moock, I agree on the AttachInput. I think I'll add that to my SFML version. :)


*dances like a fool*

Wait, I thought the SFML thing was, you drag and drop your Sphere project into it, and it spits out a version that works on the web. If you're adding unique features, then will Sphere-SFML have its own editor?



And yeah, I never really knew the difference between SetRender and SetUpdate. I might mess around with it some more, getting a multitap-esque thing working for Sphere would be really cool, but I'm gonna focus on other things for now.

Several differences, two that I at least know of:
SetUpdateScript() runs before rendering anything at all.
SetRenderScript() runs after at least having rendered the map, and before the map engine does its FlipScreen() (which explains why you don't need FlipScreen() for a renderscript).

These facts might not make a difference for the functionality of what you were trying to achieve, though. Now that I think about it I think it's mostly done like this to separate rendering from logic.


Ah, that does make sense.

Will SetUpdateScript work even if you're not using Map Engine?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 14, 2013, 06:51:15 pm
Quote
Wait, I thought the SFML thing was, you drag and drop your Sphere project into it, and it spits out a version that works on the web. If you're adding unique features, then will Sphere-SFML have its own editor?

Sphere-SFML is stand-alone, runs on .NET. It's just that with SFML you have an option to export/compile to HTML5 in some way or another.


Quote
Will SetUpdateScript work even if you're not using Map Engine?

Nope, updatescripts are also meant for the map engine. But you don't need them outside of the map engine, since you can just call any old function from any of your own loops. Consider this:

Code: (javascript) [Select]

function MyOwnGameLoop() {
  SetFrameRate(60);  //Forces short breaks with every FlipScreen() so the frame rate is forced to 60 and not "however much your system can handle". (Note: known for somewhat buggy behaviour in some Sphere versions)
  while (true) {
    UpdateStuff();
    HandleInput();
    SomeOtherThing();
    RenderStuff();
    FlipScreen();
  }
}


Versus this in the map engine:

Code: (javascript) [Select]
SetUpdateScript("UpdateStuff();");
SetRenderScript("RenderStuff();");
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 14, 2013, 07:01:18 pm

Quote
Wait, I thought the SFML thing was, you drag and drop your Sphere project into it, and it spits out a version that works on the web. If you're adding unique features, then will Sphere-SFML have its own editor?

Sphere-SFML is stand-alone, runs on .NET. It's just that with SFML you have an option to export/compile to HTML5 in some way or another.


Well, it's only used through the browser if I ran it through JSIL. Then again I'm running into data limitations which is making that route a sort-of no-go for now. So in the end, Sphere SFML is just a fast, modern reimplementation of Sphere for Windows computers. (Linux and Mac is possible, since Mono has came a long ways).
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 14, 2013, 10:59:32 pm

Will SetUpdateScript work even if you're not using Map Engine?


Update scripts run when the map engine updates the map. With no map engine running, the update does not run.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 15, 2013, 04:28:58 pm
Edit: Oops, nevermind the first part of this message, if you already saw it. Saw my error and fixed it.



Quote
Wait, I thought the SFML thing was, you drag and drop your Sphere project into it, and it spits out a version that works on the web. If you're adding unique features, then will Sphere-SFML have its own editor?

Sphere-SFML is stand-alone, runs on .NET. It's just that with SFML you have an option to export/compile to HTML5 in some way or another.


Well, it's only used through the browser if I ran it through JSIL. Then again I'm running into data limitations which is making that route a sort-of no-go for now. So in the end, Sphere SFML is just a fast, modern reimplementation of Sphere for Windows computers. (Linux and Mac is possible, since Mono has came a long ways).


Aww, no web output? That was gonna be such an awesome feature, 'cause then players wouldn't have to download anything, they could just go to a website and play.

Oh well, if the API has multiplayer input, I'll be happy.

Hmm...maybe I should post a Dream API, just for the heck of it. With all the general-purpose features I can think of.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 15, 2013, 05:33:44 pm
If you are wondering about recursion errors check your code out:
Code: (javascript) [Select]

function WriteSomething(){
    font.drawText(0,0,"All this program does is display this message.");
    WriteSomething(); // issue here.
}


Notice you are calling the same function within itself? It is recursive in that fashion, so naturally, it'll go on forever and run out of stack memory. Stack memory is the memory used for function calls. There is a limited space of stack memory, but that doesn't mean you can have a limited number of functions. When you removed this it worked. Now you know what recursion is :). (It's not a bug or a bad thing. In fact if you can use it right it's awesome, but it is also tricky).
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: DaVince on December 15, 2013, 05:52:30 pm
If I remember correctly, Sphere used to have a hard limitation of recursing a function 1000 times before erroring out with "Too many recursions". This was a safety feature made to prevent getting stuck in a resource-intensive type of loop. Not sure how it is in current Sphere; did this limit go up as we started giving JS more memory to work with?
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 15, 2013, 06:22:00 pm
Yes, Sphere was given more JS memory, but it still has the same hardset limit of 1000:

Code: (javascript) [Select]

function game()
{
test(0);
Abort("ok");
}

function test(num) {
if (num == 998) return; // 998 = ok, 999 = not ok
test(num+1);
}
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 16, 2013, 08:56:59 am

If you are wondering about recursion errors check your code out:
Code: (javascript) [Select]

function WriteSomething(){
    font.drawText(0,0,"All this program does is display this message.");
    WriteSomething(); // issue here.
}


Notice you are calling the same function within itself? It is recursive in that fashion, so naturally, it'll go on forever and run out of stack memory. Stack memory is the memory used for function calls. There is a limited space of stack memory, but that doesn't mean you can have a limited number of functions. When you removed this it worked. Now you know what recursion is :). (It's not a bug or a bad thing. In fact if you can use it right it's awesome, but it is also tricky).


My problem was that I put the whiletrue loop in the function, not the game loop. Here's my new, working code...

Code: (javascript) [Select]
var font = GetSystemFont();

function WriteSomething(){
font.drawText(0,0,"All this program does is display this message.");
FlipScreen();}

function game(){
while (true){
WriteSomething();}}
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: N E O on December 16, 2013, 03:01:27 pm
@Mooch - AttachPlayerInput(entity_name, player_index) allows choosing to attach up to 4 different players to entities. IIRC, this is how the Bomberman demo accomplished it.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 16, 2013, 06:59:16 pm

@Mooch - AttachPlayerInput(entity_name, player_index) allows choosing to attach up to 4 different players to entities. IIRC, this is how the Bomberman demo accomplished it.


...

...

How did we miss that? Exactly? Me and DaVince and Radnen and whoever else have been posting in this topic lamenting no multiplayer input for days now, and none of us noticed that?

Obviously, if you try to have that all on the same keyboard, you get problems; one person can't move right while another's moving, etc. Presumably, though, if you're playing online with others, that shouldn't be a problem. Or if you're using multiple gamepads or keyboards.

Though I'd still like to try to get my Multitap Hack to work. Then you could have an arbitrary amount of input coming from one keyboard.

Also, Gauntlet clone's still canned. I'm working on something else. Not gonna post anything 'til I have something to show off. Trying to work out all the code on my own, too, and not be asking so many questions and taking up so much of everyone's time. It's going good, I'm OOP-ing!

...

Still can't believe I missed that. Although the Wiki's got so many redlinks, and the Help file in sphere/docs/contributed is incomplete and presumably from an older version of Sphere (there's no AttachPlayerInput); I've read through what's documented of the API twice now and I still don't understand half of it.

Thanks for pointing that out.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 16, 2013, 09:06:16 pm
Quote
How did we miss that? Exactly? Me and DaVince and Radnen and whoever else have been posting in this topic lamenting no multiplayer input for days now, and none of us noticed that?


There's always been multiplayer input, I never said never. ;)

What I didn't know is if there existed a function in the API that did that for you. I'm still a bit skeptical, but it seems plausible.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Fat Cerberus on December 16, 2013, 09:30:08 pm
Yeah, just looked it up myself, and it turns out the normal AttachInput() is just a convenience function.  Straight from api.txt for Sphere 1.5:

Code: [Select]
AttachPlayerInput(person_entity, player_index)
  - makes the 'person_entity' respond to the input
    Currenty player_index has to be from zero to four (max four players)
    Note: AttachInput is equilivent to AttachPlayerInput(person_entity, 0)


Which when I think about it, does make sense seeing as config.exe allows you to map inputs for 4 players.  It'd be stupid if AttachInput only worked for one player.
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Radnen on December 16, 2013, 10:08:48 pm
I remember when config.exe didn't have that extra input stuff, but I'm an oldie. Which was why I was skeptical. I never used it!
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Mooch on December 17, 2013, 07:15:40 am
The lesson here is, re-familiarize yourself with your tools every once in awhile. You never know when they've sprouted new features ;)
Title: Re: Gauntlet clone, with extra features, and also online.
Post by: Flying Jester on December 17, 2013, 08:10:47 am
Well, the latest it could have been added was 2008. And I think it existed before that, at least in 2006 when a certain one of Flikky's tutorials was written.