Ye Olde Blah

ShiningSource.org => General Programming Forum => Topic started by: Job on January 09, 2007, 05:06:37 am



Title: New Javascript Engine
Post by: Job on January 09, 2007, 05:06:37 am
I've been gaining some valuable Javascript experience with some recent unrelated projects and knocked up a pretty nice Javascript Engine
http://www.bloo.us/javascript/tileengine/
Lets see how far it gets. I'm going to make this engine Open Source.


Title: Re: New Javascript Engine
Post by: solmyr on January 09, 2007, 05:17:55 am
This looks very interesting! Can't wait to see what develops from this.


Title: Re: New Javascript Engine
Post by: Job on January 11, 2007, 06:12:07 am
This thing works great even with layers. I added a character layer on top, with a number of characters on it. It's starting to look like a Shining Force engine.
Pairing this up with a reverse Ajax approach will definitely make a nice multiplayer engine.


Title: Re: New Javascript Engine
Post by: Elvenfyre on January 11, 2007, 08:18:02 am
Loving it Job.
Keep the good work up.
Let me know if you need a tester :D

my alias @ hotmail for msn.


Title: Re: New Javascript Engine
Post by: Job on January 23, 2007, 02:34:14 am
I actually found a way to implement smooth scrolling. I was never able to do this with flash. I'm still debugging though.

http://www.bloo.us/javascript/tileengine/


Title: Re: New Javascript Engine
Post by: Elvenfyre on January 23, 2007, 05:51:35 am
OK a couple of bugs I came up with.  Firefox 2.0.0.1

Perhaps you should shift the screen when the char is one more square away from the edge?
Because when moving the screen up or left, the char disappears when you've just moved the screen - until you press a key then he reappears.
When moving the screen(mainly right or down, but on the odd occasion left) a second "hero" appears(he goes away when you press another key too).
Also at one point when i did cause this second hero to appear on walking left, the obstacles on the screen had been misplaced by one square(the obstacles were 1 higher than the bush graphics) - and the mirror image hero didn't go away.

I'm getting 0 cpu useage when leaving it running with the dudes moving round etc, and up to 87% useage when I move.
Athlon 2500, 1.25GB ram, nVidia 6600GT


Title: Re: New Javascript Engine
Post by: solmyr on January 24, 2007, 04:23:58 am
This looks really cool! I'm getting the same results as Elvenfyre though, with the duplicate (and somtimes triple) hero and a jump in the animation when it starts. Also, the buttons (up,down,left,right) don't do anything for me though.  I tried it in Firefox 1.5 and IE 6.


Title: Re: New Javascript Engine
Post by: Job on January 24, 2007, 06:12:37 am
Thanks for the bugs reports guys, i'm aware of most of these issues, i hope i can improve performance a little on the scrolling.


Title: Re: New Javascript Engine
Post by: Elvenfyre on January 31, 2007, 01:43:26 am
Perhaps the smooth scrolling is causing more problems than its worth?


Title: Re: New Javascript Engine
Post by: Devlyn on April 24, 2007, 07:31:01 am
That looks pretty cool.

It indeed looks like the scrolling could use some optimization. Perhaps you can post that piece of the code here and we can take a look at it? :)


Title: Re: New Javascript Engine
Post by: Job on April 29, 2007, 04:51:15 am
I finally got some time to work on this thing and fixed plenty of issues. I managed to keep smooth scrolling while maintaining fairly good performance.

Dev, if you want to look at the code check TileEngine.js in your Temporary internet files. The smooth scrolling makes the code a little more complex and it needs a little staring at.

Basically i use a table of 16*10 cells, with 48*48 sized tiles. For smooth scrolling, we need to move Bowie from cell A to adjacent cell B, progressively rather than at once.
I actually move the contents of cell A by x pixels and the contents of cell B by -x pixels in intervals (using setTimeout), and yes i'm surprised this works at all.  :)