scidave's Forum Posts

  • I use Windows 7 x64. Everything works fine.

  • I think most end users will have the JVM (if you use older Java features), so I wouldn't let that hold you back trying to do this. Also, C++ meshes with JNI much better than C.

    But I agree with Ashley that this probably would not be good to support officially, but as a school project it sounds interesting to attempt. Doesn't sound easy at all though.

  • Would moving up and down be okay

    Yes, just up and down. Nothing else needed.

    If you could have any power-up you wanted, what would it do?

    First would be temporary shields. Second place would be a either a triple shot, or a large radius explosion bomb.

  • n the subject of object picking, isn't it best if the server dishes out a unique ID to each player that is permanent while they are online, then when you send a movement packet to the server, it affixes your ID to the packet, then sends it to all clients near you (in my game, it would be all clients in your sector). When they recieve the packet, they use events to pick the correct Player instance (Player.Value('ID') = IDinPacket]) or something? (we could pass the contents of the packet to construct using a function with parameters. Or can we do all this in python now without having to pass anything to construct's events?)

    On object picking...I've been getting hung up on using Sprite[instance] access which with the new version of Construct perhaps this is not the best way to go. You will notice in the tuts that that method is used ALL over the place to move objects. It is nice because it has good performance.. I'm not sure what the performance would be to pick an object based on ID (of course you could improve it by only picking objects in your sector/screen which should be sufficient).

    So you could probably do something like this:

    1. New player connects

    2. Server issues unique ID to the client with command to spawn a new "myplayer" instance. You are planning to use instances of the same player sprite, correct? When the new sprite is spawned, the 'ID' of the sprite is set in Python using:

    System.Create('Sprite',1,0,0)
    objRef=SOL.Sprite  #this gets the reference of the new Sprite.
    objRef.Value('ID') = uniqueID [/code:1927f3g8]
    
    3. This same info is sent to all other players in the same sector so they too can spawn the new instance.
    4. Each tick, player movement, etc is sent to the server along with the uniqueID.
    5. The server forwards the movement info to all clients in same sector
    6. Each client then picks by value as you mentioned to update the correct myplayer instance.  This can all be done in Python now.
    
    So instead of:
    [code:1927f3g8]# function to manage player movement
       def Network_move(self, data):      
          myplayer[data['player']-1].SetPosition(data['playerx'],data['playery'])    
          [/code:1927f3g8]
    
    You would have:
    [code:1927f3g8] def Network_move(self, data):
         if myplayer.Value('ID') == data['uniqueID']:
              myplayer.SetPosition(data['playerx'],data['playery'])
    
    [/code:1927f3g8]
    
    I haven't tested the above out, but believe it will work.  You would of course need to limit your search through myplayerto only those objects in sector for performance reasons.
    
    See this thread, which you probably have already read.
    
    So with this new approach you lose the coolness of being able to act on your sprite instances directly, you get around all the problems of accessing instances by index when a sprite is destroyed.. which screws up the numbering system.
  • Nice example Lucid, clean and simple.

    In regards to the error.. If you are trying to run it as an exe then follow this guide:

    -------------------------------------

    As far as getting PyGame to work with Construct just use this:

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

    This has the dependencies for Pygame. You will need to unzip the contents of the Library.zip file into your Construct/Data/Python directory. You will need to check all of the .pyc files per the quickguide, but you can skip PodSixnet and other unrelated .pyc files. The other dependencies (modules.zip) have to be redistributed with your game. Now you don't need ALL of those, but it will be up to you to decide which ones you need based on which parts of Pygame you use!

    ---------------------------------------------------------

    Also, make sure you are using .99.93. (from your screenshot looks like 94) so you should be good.

  • Nice game! Very smooth graphics, explosions, and sound effects.

    Some suggestions for improvements (but I suck at games sometimes so take it for what it is worth):

    1. I found it too hard. On average, I'm only able to last 1-2 min.

    2. It was too monotonous even though it was very short play. I just hold down the W & E keys and swing back and forth trying to shoot down green ships. There is little chance for strategy and all the explosions are mind numbing (can't see where enemies are) after awhile.

    3. A game without strategy isn't bad, it is just that I think some variety is needed and a chance to use more skill in shooting. As of right now, it is pretty much try to get in front of the green ships without getting hit by bullets from the larger ships.

    4. I wish I could move forward and backwards, because the enemy will always kill you once it reaches the end of the screen. Or instead give a temporary bomb/force-field capability.

    5. Needs additional types of enemies.

    6. Add some powerups to give player more capability.

    Still really nice work for a beta.

  • Congrats! That is fantastic to hear such good news. Nothing better than to work on things you love to do!

  • But that seems to cause an infinite loop because the message continually sends. I know I could just make pressing the Enter key a separate event, but I was just curious about this OR operator. Sorry if that has nothing to do with this. I appreciate the help.

    Try adding a "Trigger Once While True" system condition to that OR condition to see if that solves the problem. Cheers!

  • Good questions! btw... I really hope you finish your space game, because that is my #1 favorite genre. and online is even cooler!!

    1) It seems you use lists to give each player a unique ID (based on their location in the list). In a MMO style situation, you'd want to make sure that everyone has a unique ID that stays the same for the whole time they are online. Lists would work fine, however, when user 2 disconnects, we want the next user who logs in to take his place, this way we don't end up with a huge list (because the list re-uses empty entries). I assume this is the best way to do it? How do you do this in python, or is there a more appropriate way?

    A couple of clarifications... I don't use lists to give each player a unique ID. On the server side, I assign each player a playernum based on their location in the WeakKeyDictionary.

    player.Send({'action': 'number', 'num': len(self.players)})
          player.playernum = len(self.players)[/code:13ofx2w7]
    
    When a player (client) connects to the server the following code is called:
    [code:13ofx2w7] def Connected(self, player, addr):
          self.players[player] = True [/code:13ofx2w7]
    
    This adds a reference to the player to the Dictionary.  This reference is what is used to send data to the player:
    
    [code:13ofx2w7]def SendToOthers(self, data, player):
          for p in self.players:
             if p != player:
                p.Send(data)[/code:13ofx2w7]
    
    Notice that in the above function, a check is made if the current player connecting is "yourself" and only sends to everybody else.  Also note that the player number is not part of any of the sending of data from client to server or vice-versa. The player number is primarily used on the client side to determine which myplayer instance to control.
    
    Also, each time a player disconnects their entry is indeed removed from the list/Dictionary, so the dictionary can never grow out of proportion:
    [code:13ofx2w7]def DelPlayer(self, player):
          statusText.AppendText("Player dead/disconneted" + str(player.addr) + "\n")
          if System.globalvar("listenServer") == 0:
             myplayer[player.playernum - 1].SetPosition(deadp.X,deadp.Y) 
             del self.players[player]
             self.SendToOthers({'action': 'dead', 'player': player.playernum},player)[/code:13ofx2w7]
    
    If you wanted 
    

    also, wouldn't each client need a unique "ID" so you can send messages directly to certain clients from the server?

    You already can send messages to certain clients using the "player" weak reference. It is important to note that an instance of a client connecting to the server is a channel. The channel and player are one and the same. There is no private channel that multiple players exist on. For example, lets say in your game you want "Bob" to chat only with "Jill" instead of flooding the message to all players. When "Bob" sends his chat message to the server, he could tag it with an option that inlcudes "Jills's" name. Then the server would have a function called "Send to Player", which would take the name as input, figure out which player had a class variable name called Jill (for p in players... if p.name == "Jill", p.send...) and only send to that specific player.

    2) I couldn't quite work out how channels work. Can we send messages to all players on a channel? And can channel names be strings? Surely its important to ensure that we can send messages to certain groups of clients, but not everyone connected?

    Remember that a channel is a player connected to the server. I get what you are asking for though...you want groups of players. You can do this by creating additional dictionaries and adding the "Player" references to those dictionaries. Then when you want, let's say friendly factions/groups to communicate with each other, instead of sending to the "players" dictionary/list you instead send to "Faction1", etc... You could add an additional capability to each client to be able to create a new faction or group or whatever and you could even add some authentication word/string as well. So clients might have to connect with the name of the faction and the code word.

    Keep in mind that PodSixNet is client-server architecture... all data must travel through the server. There are no peer to peer channels between different clients. You can however, create "logical" channels, but lets call them groups so it doesn't confuse the issue.

    Now that Python support really rocks, I plan on updating the Tuts (sometime in the next couple months.. don't want to make any guarantees and may add in a few extra features to the chat example to describe this.

    There are some areas for abuse to look out for:

    1. Right now, when a player connects they are a new "myplayer" instance on the client side. They send their player number to the server to update their position. However, there is no check on the server to make sure that the player they are updating is indeed themselves. A simple check to see if their self.playernum (which is only settable by the server) is equal to the "player" the incoming player want to control should solve this.

    2. When a player is dead or disconnects they are removed from the dictionary on the server and packets no longer go to that player. However, their character still exists. This could cause a DOS if somebody repeatedly connected/disconnected creating a plethora of players. I can't remember why I didn't delete the player... I believe it threw off the numbering system. For example, lets say that you were player #3 and player #2 got killed. If you deleted the #2 instance of myplayer, I believe the #3 instance now becomes #2. Well, that is a problem because now player #3 doesn't have anybody to control because his instance is now #2. A couple of options: don't use playernumber tied to instances...this solves the problem of controlling the wrong or non-existant instance.. but then how do you control the instance? You need some type of mapping to an instance (for sake of code simplicity, unless I'm missing a better way). The second option is to update everybodies ID's when somebody dies, well actually this would have to happen in all cases since instance numbers change. When somebody disconnects or dies, you could send out an update to all of the players changing their global playernum (and thus which instance they control) and also send out a delete player "X". Some synchronization would need to be done to make sure this happened smoothly. I didn't want to overly complicate the Tut so I went with the simple/naive solution of copying the dead/disconnected instance off the playing board (which is not practical due to the DOS possibility in your MMO case).

    Any ideas from Construct gurus (that bothered to read this far on better ideas to control a sprite instance?

    Well that is enough of a brain dump for now. Please let me know if you have any questions!

  • That's what I don't get. I exported it to an .exe and imported all the necessary python modules, but I still received error messages. I installed the PodSix library properly too and replaced the .pyc files. Any idea/suggestions?

    Hi Jonathan. glad you liked the tut. Here is my guess at what is wrong.

    For the problem with Sysinfo.. have you added the SysInfo object to your project and if you have multiple layouts, is it global?

    For the myserver problem.. are you accessing "myserver" before you set the value of myserver? For example, the myserver.pump() call that needs to occur once each game loop. Trying to make that call before you do a "myserver = MyServer(localaddr = (host,port))" is going to throw that error. You solve this problem by either setting a group or a check on a global to make sure you don't do a myserver.pump() until "myserver" is set properly.

    In general, whenever you get a "not defined" error it means you are accessing a variable before you have set it.

    If you are still having problem after the above: Are you using Construct version .99.93 or later? If not, you should upgrade and try again as it may be a path problem.

    Hope this helps!

  • Does it need more, though? What do you think?

    I don't think it needs more... but more would be cool! If there was some strategy behind using certain powerups against certain enemies then I could see a need for more. Still, I really love the powerups and it's a lot of fun.

    One complaint is that if you get a powerup, but then immediately get another powerup you lose ever being able to use the first one. Not a big deal though.. just wondering if that was intended. Also, there does seem to be a bug with powerups. If you restart the game, at least with the "E" option, each time there are less and less powerups. So by the third restart the game is really hard because no more powerups exist!

    Right now it does seem little hard, no?

    I think you need to increase the deaccelerating so the guy stops a little faster when you let off a key.

    And this was my main goal from the very beginning.

    It definitely is tough! I forgot about right click... a little easier with that. I actually played for a little while longer on the last try.

    Anyway, great game. Looking forward to the next version!

  • Nice game. It was interesting the different concepts. I couldn't really get into it.. in that I was just doing whatever motion repeatedly to get to the next challenge and i didn't sense any of the emotions. Maybe tie some game play elements into how you stroke the lyre would get the player more involved. Still a cool concept and I had to play till the end so that says something!

  • Just tried it out. Very cool missiles , rockets, bullets. On the whole the firepower/powerups are awesome!!!! I actually wasn't the biggest fan of the movement. Yes, it was smooth but I felt it was harder to reverse direction than I would have liked.

    I must suck at this game as well, because I can't figure out how to avoid the hands too. It just keeps circling and circling and kills me everytime! If it wasn't for dying all the time I would have really liked it. Any tips on avoiding death? It just gets to crazy between jumping to avoid the clock hands, trying to pick up powerups, and trying to shoot and avoid enemies. I can only do two at most.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I didn't think PyJoy supported windows? If it does, it should be pretty easy to export the library following the guide in the Tutorials section.

    Actually, ever since .99.84 Construct supported external libraries so it's been possible for awhile to have Joystick support using PyGame. It's just that this recent version fixes ALOT of Python bugs, especially the Path bug that was affecting Tulamide, alee, and probably countless others.

    So, .99.93 is pretty much mandatory now if you want good Python support... I don't have a Joystick handy, but when I get it in I'll work up a quick airplane shooter, an post .cap, with it using Pygame.