scidave's Forum Posts

  • Why isn't this on the wiki tutorials? Lots of nice concepts and ideas here.

    I was thinking the same thing when I saw this pop up. never even knew it was here!

    If no one beats me to it, I'll put it up on the wiki sometime tomorrow.

  • Can Python access and/or modify behaviors? From what I've tried so far it does not seem to be possible.

    For example, if I want to change sprite[CustomMovement].XSpeed, how would I set that or get the value of in script?

    Thanks!

  • Now, I can't seem to get private variable access in Python to work. I'm using the latest .99.84

    I have a sprite called "player" and a private variable called "score".

    I tried player.Value("score") which doesn't error but doesn't retrieve anything. I regular event retrieves the value fine so I know something is there. I also tried player.GetValue("score") which causes an error.

    Any ideas why this doesn't work?

  • what if you end up being the only guyon here

    Lol... I think it is a good idea! I'll be here a well.

  • We should have a "clean up the wiki week" or month. Kinda like a clean the highway trash day. During this week we would answer no questions on the forum directly but instead update the wiki and then post a link to it.

    There is so much information on the forum that if we just instead moved it into the wiki (in the proper form) it would be incredible.

  • Ive got a game in development and have been looking into this networking for a while.

    What type of game are you making? Right now any type of network chat program is trivial with Construct and Python. However, I am still experimenting with even the simplest of two player network games. One thing I don't want to break is Construct's ease of the event system and built-in behaviors, and graphical drag and drop design.

    It is non-trivial figuring out how to fit the Python library into Construct's event system, without resorting to writing most everything in Python code, for a real game. I think once I figure out the best method then it should be fairly easy to follow the example and do similar games. It is kinda like the inventory system for the adventure tutorial, it took me quite a while to come up with the scheme and then everything looked really easy when it all came out in the end.

    Like will you release source or make a tutorial on how adding networking can be done?

    I do plan on creating a tutorial and releasing source to a simple game and the chat program sometime before 1.0. It would help to know what type of network games people plan on making so I can keep that in mind when making the tutorial.

    p.s. Dead reckoning/interpolation will not be supported though. That is far too complex for the libraries I'm working with (at least without much more work) so only simple games without latency concerns will be supported/explained in the tutorial.

  • A couple of improvements that would make life much easier for writing Python code in the script editor:

    1. Bug when you cut and paste a line of text over into the editor. It appears fine, but when you close out the editor you see weird indentation in the code. You have to go back in and manually fix offset.

    2. Allow people to use "Tab" for indentation as an option instead of three spaces.

    3. This is the biggest one. Put some type of intellisense or syntax hint for code. For example, if I want to popup a messagebox I type System.MessageBox and at that point have no idea how many parameters it takes. Even if I go back and look at the format of the event (which is what I am doing) I still have to guess at the formatting of the 5 parameters. For example, the first two are obviously strings, but the next two are selected from a dropdown list. After some trial and error I got it to work, but that shouldn't be necessary.

    4. Also, please add a feature to allow somebody to select all .pyc when building executables, or optionally select all .pyc under a directory.

    Thanks!!

  • Here is the bug tracker link:

    https://sourceforge.net/tracker/?group_ ... id=1003219

    You need to have a sourceforge login to add to the tracker.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks everybody. Python really opens up lots of interesting possibilities.

    I'd still prefer a plugin, but with all your work so far you've pointed to an alternative that's worth to try.

    I would prefer a plugin too. The pros with a plugin are you would have better speed and that it would be better integrated with Construct. The positives for Python is that it is really easy to add network support, the code amount is minimal (e.g. the Chat Server is only 40 lines of Python and about half of that was cut and paste boilerplate code) and it is easy to extend the support without making a whole new plugin. Once I move on to an actual game I'll let you know if I hit any walls with integration with Construct behaviors and other stuff.

    Also, good link about the port numbers.

    In general, you want to set the server to listen on a port higher than 1024 since it takes an admin to listen on low/privileged ports. For those curious about what is listening on their system you can type: "netstat -an | more" at a command prompt and you will see ip addresses and ports. The server uses TCP so nothing can be listening on the TCP port you choose.

    I updated the chat server to show what IP it is listening on. I didn't put any error checking on the port so pick a high port or do a netstat to see what is available.

  • Here is a simple network chat program that I worked up today to learn more about network programming with Python. It may be one of the first Construct network programs!!

    <img src="http://i42.tinypic.com/2ntfo8o.jpg">

    http://www.box.net/shared/o766hzisiy

    The Python dependencies should be redistributed with the client and the server. For, the server you just put in the port that it will listen on (you should select a high number like 6000). For the client, you pick the player nickname, the IP address of the server, and the port of the server. I only tested with two clients but it should support many more. Time permitting I'll add new features to this or move on to a real network game.

  • Yes, it is possible and shouldn't be that hard. Probably around 25-30 lines of Python code to do the encrypting and decrypting.

    I'd recommend Pycrypto (get the 2.6):

    http://www.voidspace.org.uk/python/modu ... l#pycrypto

    An alternative would be Ncrypt (get 2.6...):

    http://tachyon.in/ncrypt/

    Here is an example of how you would use PyCrypto:

    http://www.codekoala.com/blog/2009/aes- ... -pycrypto/

    p.s. Feel free to let me know if you have any questions as you try it out. Sometimes there is some trickiness in converting a pure Python solution to a hybrid Python/Construct solution!

  • This discussion made me think of this thread:

    I don't see why we couldn't have highscore and achievements.

  • Very, very cool. Construct can do some really amazing stuff.

  • Thanks! Makes perfect sense now.

  • Now it seems like I am having problems in the opposite direction. I can't set a global variable from Python script.

    For example:

    A global called startGame.

    In script:

    globalvar('startGame') = 1

    global('startGame') = 1 <--- i know shouldn't work based on the fixes

    globalvar("startGame") = 1

    I seem to have tried every combination I can think of and I get an error "can't assign to function call" I've tried casting to string, to int.. all sorts of combinations. Just doesn't work.

    Any ideas?