Author Topic: Upcoming SGDK2 Implements Rules in HTML5  (Read 280481 times)

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #60 on: 2012-01-27, 02:54:26 PM »
I can't really easily profile what's happening on the device, but Chrome has a pretty good profiler, and it says that a large chunk of the time is spent during drawing.  A surprisingly large amount of time is also spent in the getTile method that takes in x,y and returns tiles[y % something * something else + x % something more else].  Is the modulus operator really inefficient or something?  Note that this was for a sample I was working on which had a layer with a single tile and a virtual size to cover the screen, so I don't know if that made it worse.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #61 on: 2012-01-29, 09:19:19 AM »
Hm... just discovered the ondevicemotion event for HTML5.  I wonder if I could use that to provide inputs on mobile devices.  Looks like support for it is not very consistent yet.  But I got a new phone yesterday (LG Optimus T) partly so I could start testing mobile game compatibility/support, and that device can detect motion.  I don't know yet whether its browser supports motion events, but hopefully someday if not today.  I can't tell what browser the device runs.  I suppose there are other browsers I could download.  Wow there's Dolphin Browser, Opera mini, Opera mobile, Skyfire, Dolphin Browser Mini, Boat Browser, UC Browser, Boat Browser Mini, Angel, Galapagos, Ninesky (ooh, explicitly supports HTML5 and flash), NetFront Life Browser, good grief, 15000+ results!  Why the hoop'n'daddy are there so many browsers!?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #62 on: 2012-01-29, 04:30:03 PM »
Well, I made a game that runs nicely on my phone (and presumably an iPot touch) at: http://sgdk2.enigmadream.com/ben/Spudzu.html.  Click the map to drop lights that attract the little yellow creature.  I designed it to run at 15 FPS, and it seems to have no problem doing so.  Let me know if it runs about the same for you.  The background clearing is a little glitchy, especially on large displays that show more map than exists, but it works pretty well on small displays.  There are a few pixels of background that still don't paint right, but I was too lazy to do it correctly for just a few pixels.  Maybe nobody will notice :).

P.S. I made some changes to SGDK2 in the process and committed them to SVN:
  • Implement GeneralRules.Clicked to check if mouse was just clicked down or touch interface was touched.
  • Implement MapMouseToSprite in HTML5 projects.
  • Correct ClearInputs function implementation in HTML5.
  • Implement SetInputsTowardSprite and setInputsTowardCategory functions for HTML5.
  • Enhance MapMouseToSprite to allow specification of hotspot.
  • Improve tracking of old mouse position in .NET code.
« Last Edit: 2012-01-29, 04:40:42 PM by bluemonkmn »

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #63 on: 2012-01-30, 07:53:37 AM »
Did you have any issues at first with frame rate, or was my problem just a fluke, do you think?  Because it runs just fine on my iPot Touch.  Knee thing I would change though is the scrolling insets.  The character gets somewhat close to the edge of the screen.
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #64 on: 2012-01-30, 08:32:52 AM »
Did you have any issues at first with frame rate, or was my problem just a fluke, do you think?  Because it runs just fine on my iPot Touch.  Knee thing I would change though is the scrolling insets.  The character gets somewhat close to the edge of the screen.

Hearing of your issues with low frame rate, I designed this game to work at a low frame rate.  So I have not attempted anything with a high frame rate yet to see if I would have any issues.  Did you have (m)any real-time transforms being drawn in your test project that ran at a slow frame rate.  The reason I took out the background from the sample project was because it significantly slowed the running to have a full screen of tiles all being drawn with real-time transforms.

Also, about your "Knee" comment:
1. I think you had some other word besides "Knee" in mind there
2. I am reminded of your other comment about being an adventurer until you were shot in the knee with an arrow.  I heard that comment on Skyrim yesterday so now I know what you're talking about.  I had heard it before, I'm sure, but my memory is very good at purging useless information ... so good it sometimes purges useful information too.  BTW, when did you play Skyrim?
3. The scroll margins are narrow because when you're playing on a small device if you have wider scroll margins, you get a flickering effect from the player trying to stay within completing scroll margins.  But you *can* drag the map.  On my device, when I use Dolphin, which allows my to turn off all the framing of the browser window, I can get a decent size view where I could increase the scroll margins.  But I don't know how large I dare to make them before I risk some browser of some phone causing the scrolling to go nuts.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #65 on: 2012-01-30, 09:24:56 AM »
1) Damn You Autocorrect.  Should be "One".
2) Never played Skyrim.  Just heard of many, many other people mentioning that comment coming up a lot in Skyrim.
3) Would it be possible to have scroll margins be display-size dependent? So that if you're playing on a small screen, it works as intended, but if playing on a really big screen, it still scrolls without needing to go all the way over to the edge?  Scrolling around is possible, yes, but somewhat difficult due to the tapping to scroll also placing the light on the spot you tapped.  So you have to be careful to tap where the character already is.

That said, I ran it on an iPad. Pretty cool.
« Last Edit: 2012-01-30, 09:28:35 AM by durnurd »
Edward Dassmesser

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #66 on: 2012-01-30, 03:38:20 PM »
Not sure if here is the best place to continue reporting issues I've found, or if I should create a new topic.

That said, I've found an issue with saving the game.  If the very first thing done is saving the current state of the game, before specifying what should be saved (where it should supposedly save everything), it fails to save, because GeneralRules.saveUnit.maps is undefined.

Another issue is with rules whose function name is only one character long (such as = or +).  The CamelCase function assumes the names to be at least 2 characters long.  When it reaches the method to apply camel case to such a function name, it throws an index out of bounds exception.

A third issue, which is another with the Blocked method.  It has "Math.ceiling" in the "left" case, where it should be "Math.ceil"
Edward Dassmesser

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #67 on: 2012-01-30, 03:42:39 PM »
Sorry, I just had to post a reply comment loling at the arrow to the knee thing. lol.  :laugh:

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #68 on: 2012-01-31, 06:18:37 AM »
Not sure if here is the best place to continue reporting issues I've found, or if I should create a new topic.

That said, I've found an issue with saving the game.  If the very first thing done is saving the current state of the game, before specifying what should be saved (where it should supposedly save everything), it fails to save, because GeneralRules.saveUnit.maps is undefined.

Another issue is with rules whose function name is only one character long (such as = or +).  The CamelCase function assumes the names to be at least 2 characters long.  When it reaches the method to apply camel case to such a function name, it throws an index out of bounds exception.

A third issue, which is another with the Blocked method.  It has "Math.ceiling" in the "left" case, where it should be "Math.ceil"

Very strange that you are observing that behavior with the CamelCase function. I have an "=" function in my Spudzu project (to jump), and it returns "=" when I call CamelCase on it.  "=" is the first character, and a 0-length string is the remainder starting from position 1.  In the immediate pane, I can enter

? "=".Substring(1)

and it returns

""

Only when I enter

"=".Substring(2)

does it throw an exception.  Something else must be going on.  Do you have a 0-length function name?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #69 on: 2012-01-31, 07:45:56 AM »
I suppose that's possible, but I thought I had noticed it occurring on a "+" function.  I would assume there would be other issues with a zero-length function name though.

Edit: After removing the code I added to make it work in the case I had problems with, it's working fine again.  It may very well have been an empty string function name, but I would've expected that to show an error rather than just not work (there were no errors listed in the top, and compiling with F7 worked correctly).
« Last Edit: 2012-01-31, 09:12:41 AM by durnurd »
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #70 on: 2012-02-01, 06:02:41 AM »
I've corrected everything except the CamelCase problem since it's not clear what the problem was.  Revision 200 committed.  Seems like a milestone.  It's our bicentical version update - woohoo! ;)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #71 on: 2012-02-05, 07:52:12 AM »
Durnurd, do you have a project that I might be able to use as an mobile device template project and demo (perhaps with some overlay for directional inputs), or should I be working on one of those myself?

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #72 on: 2012-02-08, 08:16:18 AM »
I had made something that sort of worked, using a custom Player and four plans to change the inputs when touching inside them.  But it was kind of messy, and didn't take too long to  make. so you may just as well start from scratch.
« Last Edit: 2012-02-09, 09:05:25 AM by durnurd »
Edward Dassmesser

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2736
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Upcoming SGDK2 Implements Rules in HTML5
« Reply #73 on: 2012-02-11, 07:35:45 PM »
Okay, I think I'm ready to release SGDK 2.2.2 with a template designed for mobile devices/iPads:
sgdk2.enigmadream.com/ben/Mobile.html