none
Duck shoot exe only runs well when the SB ide is open RRS feed

  • Question

  • I've just discovered another bug with my duck shoot program, and this one is a little rough.

    When I run the program from the exe the spear animation slows right down. While the exe is running and I open SB ide the spear starts animating at the right speed. Close the ide while the exe is running and it slows down again. Open the ide again while the exe is running and the spear animation runs good again.

    Perhaps naively I coded the spear animation to run in a different thread using the timer. I'm running .NET 4.

    The reason I put it in a different thread is that I thought i'd get a finer collision test, i.e. smaller delay but (derr) a bigger displacement rate. I think i'll have to code it in the same thread as the duck. :(

    .... unless this is an issue I've got with .NET4 and my mates have a different version. Not a very robust solution though. Looks I've got no choice but to ditch the timer.

    Any thoughts?  CCF763

    Also I use the timer to run the sound track as well. A play and wait thing. I couldn't work out a better way to do this.

    I've isolated the spearSpeed variable at the top of the program. It's used in Fire() line 247.

    Thursday, August 29, 2013 11:37 PM
    Moderator

Answers

  • I remember when I run an old game called NyanCat (WXR400-16),

    it was slower when SB's IDE was closed!

    Maybe the IDE does some optimization to the .Net virtual machine?

    Anyways, SB uses .Net 3.5 SP1. Even though .Net 4 is installed, version 3.5 is still necessary!


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Friday, August 30, 2013 12:42 AM
    Answerer

All replies

  • I remember when I run an old game called NyanCat (WXR400-16),

    it was slower when SB's IDE was closed!

    Maybe the IDE does some optimization to the .Net virtual machine?

    Anyways, SB uses .Net 3.5 SP1. Even though .Net 4 is installed, version 3.5 is still necessary!


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Friday, August 30, 2013 12:42 AM
    Answerer
  • Thanks goto

    .NET4 should be backward compatible with 3.5 surely?

    Hey I just graduated it to VB in VSE 2012. Blow me out! First time I've used anything other than SB.

    Anyway the VS ide shows an accurate output of how it runs in the VSE ide, that was after I ran and saved it in VS.

    The only thing I can think of is ditching the timer thread and putting it in the main programs thread.

    The music should be cool in a different thread still.

    So it maybe, that without the optimisation thing, that the timer thread ticks along quite slow. Oh! I'll change the timer interval from 0 to > 0 and see what happens. Maybe 0 is no good. Maybe it needs to set to an actual amount.

    Thanks for the thought

    Friday, August 30, 2013 12:56 AM
    Moderator
  • Nah. Changing the timer interval from 0 to something didn't work.

    My mistake. Looks like this timer ticks along a lot slower without the ide open. I'll just have to put it in the main thread. I'm a bit worried about how fine the collision test is going to be though.

    Maybe I'll use the main thread for animations only and put everything else in a different thread, if I have to.

    Friday, August 30, 2013 1:05 AM
    Moderator
  • .NET4 should be backward compatible with 3.5 surely?

    AFAIK, .Net 4 doesn't replace any of the previous .Net versions!

    Even .Net 3.5 doesn't replace .Net 3.0 and so on!

    If a program was written for .Net 2.0, we gotta have that exactly version installed in order to run it!


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Friday, August 30, 2013 1:46 AM
    Answerer
  • Goto. thanks for the .net info

    fyi:  I'm coding sb on v4 and it's working ok.

    Hey and guess what? I just optimised my timer animation and it works well without the ide. :)))

    I noticed the smallest program delay I could use is 0.5

    If I goto 0.4 it takes off. Also 1 appears to produce the same result a 0.5

    So I'm pleased to release my zip(non ide version). So if you wish to run this just compile it 1st in the ide and close sb and run the exe.

    dana here it is ZPJ288

    Any thoughts or fb always welcomed and appreciated. Gee I learnt heaps writing this.

    Friday, August 30, 2013 2:52 AM
    Moderator
  • Goto thanks for that sample. I like the resize window part. I've been thinking about doing that for a while now.

    Yeah and ran it with sb closed. Exactly the same sort of speed reduction. It's slower in both programs by like a factor of 5.

    So all I can think of to get around this is to be aware of it when coding a new program and make sure it will run with 2 different versions.

    1 for the ide, like posting import id's and another for zipping and sending to people without sb.

    Friday, August 30, 2013 7:09 AM
    Moderator
  • I just got an idea from  Florian Auer's  Starfield Simulator and applied it to my Duck Shoot to solve the speed issue resulting from the "optimisation" of the Timer object when the sb  ide is open.

    So now you can run the program locally with the ide open or closed.

    Basically it does a speed test (using Clock) in the Timer handler and adjusts the Program.delay and Speed variable based on the result.

    Here's the local version 1.0   XCC705-1

    This is the 1st game I've coded, what do you think?

    Sunday, September 1, 2013 8:24 AM
    Moderator