none
Different behavior when App is published then when it is ran locally RRS feed

  • Question

  • I wrote my Small Basic app that is my version of the old Gorilla game.  You know, two players enter an angle and velocity and try to hit eachother.  When I run it locally it works just fine.  When I run it through my web browswer as a silverlight app I know longer see my projectile move.  Check it out at http://smallbasic.com/program/?VXM884.

    To move the bullet across the screen I have a while loop that changes calls Shapes.Move with the new coordinates, then sleeps for moment before continuing.  This is a sample of the code:

    While fireInProcess = 0

    x = x + (verticleSpeed / 100)

    y = y - (upVelocity / 100)

    Shapes.Move(bullet, x, y)

    Program.Delay(2)

    ' Apply Wind

    verticleSpeed = verticleSpeed + finalWindPower

     

    ' Apply Gravity

    upVelocity = upVelocity - gravity

    PerformCollisionDetection()

    EndWhile

    Any ideas why it works locally but not when published?  Any help would be appreciated.  I am running Windows 7 x64.

    Wednesday, February 17, 2010 1:21 AM

Answers

  • Delay too short. Silverlight need more time to perform a rendering (it need you endup your sub).

    If you want to use the online version, you will need to use a Timer instead of a While loop...


    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Friday, February 19, 2010 7:14 PM

All replies

  • Good luck with that, but your code looks well organized regardless.  I can only imagine that it's not because of something you did.
    Wednesday, February 17, 2010 5:43 AM
  • I tried using Animate rather than Move for the bullet, renaming the bullet variable to bulletShape (Just in case it was a future reserved word), changing the shape to a triangle (like the explosion which works), removing and increasing the Delay, removing all CollisionDetection, and the bullet still did not display.

    Looks like an issue with the server based compile or runtime. Something for the developers to look into.

    Great little language. Pity it does not have a boolean concept, but really nice nonetheless.
    Wednesday, February 17, 2010 6:11 AM
  • Looks like an issue with the Small Basic libraries in Silverlight, Peleg.  Could someone please help me with a small repro?  I'll try to get this fixed over the weekend.
    Wednesday, February 17, 2010 8:25 AM
    Moderator
  • I tried to make a small repro but it didn't work.  I keep working on it.
    Thursday, February 18, 2010 3:08 AM
  • Delay too short. Silverlight need more time to perform a rendering (it need you endup your sub).

    If you want to use the online version, you will need to use a Timer instead of a While loop...


    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Friday, February 19, 2010 7:14 PM
  • Please note that the silverlight version seems more UI-responsive than the dekstop version about Shapes : http://smallbasic.com/program/?XGW748

    The test case about the bug derivates from the precend one but use Program.Delay :
    http://smallbasic.com/program/?MJS319

    Please note while the first version perform a Drag'N'Drop, the second only takes a click and perform moves.

    [EDIT: The fact is that WPF render *every time* (making small basic games slow) while Silverlight wait the program to idle, which is making everything smarter, but bad supporting the delay, which leaves a thread opened]

    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Saturday, February 20, 2010 9:53 PM