scidave's Recent Forum Activity

  • These might be useful as well:

    http://neil.fraser.name/software/lpt/

    http://blog.wensheng.com/2008/10/python ... ndows.html

    I did a lot of parallel port programming awhile back so would love to see something cool done through Construct.

  • I did a quick test and looks like Construct events are going to be ALOT faster. It doesn't surprise me because since we have to use a Construct array then you have to use the Construct call to populate the array and I don't see a way to use Numpy and Python tricks for performance speedup.

    Filled a 2000x2000 array with int 5.

    In Python:

    start = time.clock()
    for x in xrange(1,2000):
       for y in xrange(1,2000):
          Array.SetAtXY(x,y,5)
    end = time.clock()
    final = end -start
    Text.SetText("Final time: " + str(final)) 
    
    [/code:3cnb83ic]
    
    In Construct just use two named loops, the inside loop a subevent to the first.
    
    Basic Python w/ range(): 20.40
    Python w/ xrange(): 20.19
    Construct For Loop: 2.28
    
    I didn't bother to check the performance for Numpy array generation with a Python array, but either way 2.28 seconds is hard to beat.
  • As always I defer to ROJOhound for the hard problems..

    but if Python did integrate with Construct arrays, I would believe that it could potentially be a lot faster using the Numpy library which at its core is all C/C++. You can also inline C code inside a Python script using Numpy.

    http://www.scipy.org/PerformancePython

    Excerpt from the site for a speed comparison:

    Here are some timing results for a 500x500 grid for 100 iterations. Note that we also have a comparison of results of using the slow Python version along with Psyco.
    Type of solution
    Time taken (sec)
    Python (estimate)
    1500.0
    Python + Psyco (estimate)
    1138.0
    Python + NumPy Expression
    29.3
    Blitz
    9.5
    Inline
    4.3
    Fast Inline
    2.3
    Python/Fortran
    2.9
    Pyrex
    2.5
    Matlab (estimate)
    29.0
    Octave (estimate)
    60.0
    Pure C++
    2.16
    
    [/code:x96idh12] 
    
    My guess is right now they are not integrated enough, but I think it would be well worth it to add that support.
  • This was a really neat example. I especially liked the boxer on the left...funny looking guy.

    p.s. You set a new record for examples cranked out!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Very nice example! I'll have to remember this for easy pseudo-plugin type work...

  • This syntax should work:

    System.CreateByName("objB", 1, 0, 0)

    SOL.objB.SetPositionToObject("objA", "point")

    Note: The quotes around objA.

    There might be a bug in the other function as the prototype shows it takes the # of arguments you are sending... maybe ROJO has an idea.

  • I'm curious more for my knowledge... Always interested in how people are using Python and if there are more efficient ways to do stuff.

  • But i wonder, why the scripteditor does not detect such syntax?? does it need a fix?

    Yes, a fix is definitely needed. Python integration has gotten a lot better in the last few releases pretty much all due to ROJOhound, but yes it could be better.

  • Is it possible in construct to create special scripts in python and pass to one of functions (or classes) in the script one or more of the construct objects as a parameter ? or send a new object from the script to construct ?

    Do you have an example of what you are trying to do? I'm not sure why you would need to pass Construct objects as parameters to Python functions since you can already access objects in local event sheets or globally if object is Global.

    On the flip side, how would Construct be able to operate on a new Python object? I guess I don't fully understand the question.

  • import random

    if MouseKeyboard.OnKey('A'):

    Text.SetText("Hi Mom")

    Sprite.SetValue('sizeaccel', (random.choice(array1)))

    Create a text object and use it to debug your program and you can use the debugger as well. For example, to see if your code is functioning right you can put a SetText call to see if that code is reached. I don't have Construct with me at the moment so not sure your syntax is correct or not....but you should try setting the 'sizeaccel' value to let's say "1" to debug that portion of your script.

    I think you need a "do once" type event for this as well since you only want that code executed one time you press the A key.

    EDIT: This post will help you (this question sounded familiar

  • e7 was really cool. Very smooth and eerie ambiance...I made it to about level 13 and then had my browser closed accidentally.

  • Yes, SOL is what you want. The post from ROjohound in this thread is what you are looking for:

scidave's avatar

scidave

Member since 4 Jul, 2009

Twitter
scidave has 1 followers

Trophy Case

  • 15-Year Club
  • Email Verified

Progress

16/44
How to earn trophies