[Tutor] Adding network play to an open source game.
Hi. First of all, I'm not an amazing programmer. But, I do have large goals, somtimes too large. There is an open source game, konquer, (it's on the ubuntu repos.) that I would like to extend with python to include a network based game. But, I only know how to do simple sockets Is this too big a project for first year programmer? (I've been programing for 3, but have taken classes only one year.)The program is like a board game. You move your fleets to different planets, one at a time. The game is written in C++(I think). Just as a preliminary thing, I will go through how I think it will work. One computer in the network will be designated as the 'server' that everyone will send information to. Each turn, four pieces of data will have to be sent to the 'server' that I can think of right now.: 1. how many fleets have left 2. from what planet 3. going to which planet 4.taking how long to get there. From there, the server will then issue those to each player, and tell which player is next, and wait for his reply. I don't really know how to start, so I guess I will start here. I appreciate your reply. _ Need to know the score, the latest news, or you need your Hotmail®-get your fix. http://www.msnmobilefix.com/Default.aspx ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Adding network play to an open source game.
Thanks for your advice. You're probably right, I do need to figure out sockets first... But it's a goal to work towards... I don't know if I would keep up computer programming if I didn't have a specific goal. A few things: I have the author's email of konquer (it was in the source). I don't think he's actively developing it, but once I get to a nice start, I could try a nice email to him about it. You're also right, I don't know C++, but would like to learn it. Anyone have any advice on good tutorials/books/examples of python network programming? I saw a cherryChat program that I can start to understand, anything else? From: [EMAIL PROTECTED] To: tutor@python.org Date: Fri, 8 Feb 2008 22:26:12 -0500 Subject: Re: [Tutor] Adding network play to an open source game. I wish to warn you that I've never done anything like this before, but I have a couple of thoughts here. First thought is, network games tend to be slow because sending state information to everyone with enough frames per second to make it decent game play is a lot of information to send... So the least information you have to send the better. Fortunately, now that I read a little more closely... A board game is not going to be bad about this... Second thought is... start with simple sockets, work with the server model and the clients, do not mess with the game at first. Get dummy data to behave properly first before you ever try anything with the game itself. Third thought. C++ is a different language from python. This will further intensify your trouble. In fact, depending on your knowledge of C++, this could greatly intensify your trouble. You could have step two there going just perfectly, but getting python and C++ to talk could throw you in loops. I would say that generally for a programmer of a year, this seems like a very significant goal. Not only do you have to understand quite precisely what the C++ program is doing, (difficult especially in a game, IMO), but you have sockets to deal with, client, server, and just as difficult, C++/Python interaction. Also, given that you didn't write konquer~ someone else's code is harder to read than your own. Trust me. My suggestion is, if you are going to tackle this, very definitely take it in very defined steps. Work on sockets here, then C++/Python here, etc. I don't wish to discourage you, but I wouldn't try this yet. (Of course, I've never taken classes...) ;-) Hi. First of all, I'm not an amazing programmer. But, I do have large goals, somtimes too large. There is an open source game, konquer, (it's on the ubuntu repos.) that I would like to extend with python to include a network based game. But, I only know how to do simple sockets Is this too big a project for first year programmer? (I've been programing for 3, but have taken classes only one year.)The program is like a board game. You move your fleets to different planets, one at a time. The game is written in C++(I think). Just as a preliminary thing, I will go through how I think it will work. One computer in the network will be designated as the 'server' that everyone will send information to. Each turn, four pieces of data will have to be sent to the 'server' that I can think of right now.: 1. how many fleets have left 2. from what planet 3. going to which planet 4.taking how long to get there. From there, the server will then issue those to each player, and tell which player is next, and wait for his reply. I don't really know how to start, so I guess I will start here. I appreciate your reply. _ Need to know the score, the latest news, or you need your Hotmail®-get your fix. http://www.msnmobilefix.com/Default.aspx ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _ Shed those extra pounds with MSN and The Biggest Loser! http://biggestloser.msn.com/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Thought of some other things.
Date: Thu, 7 Feb 2008 00:05:54 -0500 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; Tutor@python.org Subject: Re: [Tutor] Thought of some other things. On Feb 6, 2008 11:38 PM, Timothy Sikes [EMAIL PROTECTED] wrote: First off, I was running my script from my flash drive-That could have caused something. Next, I have possible found something IN the location where I ran the script, I found a pic_db.bat with stuff in it... It still doesn't explain why the program crashed, but it does explain why I didn't think it was doing anything. Your question is unclear, Timothy. Running from the flash drive is not going to cause your program to crash. The interpreter is in the PATH of your computer and you can run your program from flash drive, cd or from the floppy drive. pic_db.bat could be anything. Google for it and verify if it is not a virus. Paste the error message you received for more specific response. Thanks, Well, the problem was I wasn't getting an error message. My computer would just stop and log me off. Sorry I didn't specify before, but the pic_db.bat is the result of the 'make_db' command. So it basically started to work, then crashed my computer. I meant to ask whether or not anyone could see anything that would cause my system to restart, but it's not necissary now. For some reason, when I ran this script the second time, only this time saving the list of files to a list, and then using the 'make_db' command on each and every file in the list seemed to work. If anyone can tell me why my computer restarted off the top of thier head, great, but otherwise Im not going to worry about it now Thanks though! -- -- O.R.Senthil Kumaran http://phoe6.livejournal.com ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor _ Climb to the top of the charts! Play the word scramble challenge with star power. http://club.live.com/star_shuffle.aspx?icid=starshuffle_wlmailtextlink_jan___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Pixelize ubuntu python script acting odd.
so I recently installed ubuntu and started messing around with some of the programs. Pixelize takes a picture, then using a database of other pictures, makes a picture out of the database. The only way I know of to add pictures to the database is through the command 'make_db ' It doesn't seem to accept folders, only files. So I made this script in order to get a large number of files into it without having to type them all manually. def runThrough(): walk = os.walk(/media/sda1/Documents/Pictures/2007) #location of the pics I want to use count = 0 for root, dirs, files in walk: try: for x in files: if x.lower().find(.jpg) -1: #If it's a .jpg... count = count + 1 operation = 'make_db ' + root + '/' + x os.system(operation) # Call the command line with the operation above print root + '/' + x #This is optional, I did this for debugging print str(count) + files done except OSError: print root + / + x + was not included in the list #This was run to get rid of all the obnoxious spaces in the file names #try: #for x in files: #loc = root + '/' + x #pic = loc.replace(' ', _) #os.rename(loc, pic) #count = count + 1 #print str(count) + files done #except OSError: #print root + '/' + x + was not included But here's the problem... My computer has randomly restarted (or logged me off possibly) every I have run the program, about thirty seconds into the program. os.system('make_db ' + ) manually works in python, I tried it. Note: the same thing with double quotes does not work. I have changed some stuff since I last ran this, but I haven't run it again, because my computer randomly logging me off kinda bothers me. I am using Gusty Gibbons Ubuntu. Thanks. _ Shed those extra pounds with MSN and The Biggest Loser! http://biggestloser.msn.com/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Thought of some other things.
First off, I was running my script from my flash drive-That could have caused something. Next, I have possible found something IN the location where I ran the script, I found a pic_db.bat with stuff in it... It still doesn't explain why the program crashed, but it does explain why I didn't think it was doing anything. Thanks again _ Shed those extra pounds with MSN and The Biggest Loser! http://biggestloser.msn.com/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] IronPython, the wii remote, and blender
Well, I was playing my Wii the other day and then sat down to mess around on blender. Then I had an idea! What if the Wii remote could be used as an input device for blender? It would be great for 3d modeling, and you could always switch back to a mouse and keyboard for more precise control. So my next thought was Is it possible? Obviously it would be somehow, but whether it would be feasible or not for me I had to research. I remebered that they have a wii remote library for vb.net and C#(http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx), and IronPython is a .net framework. Would it be fairly easy to convert their code to work with IronPython? After that is working, I would might need some help from someone who already knows the blender source, or who can write externals for it fairly well. Basically, is it feasible to do the above? If I decide to carry this project out, it would take a lot of planning. Is there anyone out there willing to help? Oh, and if this is just a crazy idea, please tell me so. = (I got this message in plain text this time!) _ Shed those extra pounds with MSN and The Biggest Loser! http://biggestloser.msn.com/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Dos and os.walk with Python
Hi.I wrote a python script that goes through a specified directory and returns a list of all the files that haven't been modified since a certain date. I was hoping to be able to then continue with the program to bring up dos, and zip, then move the files (to my external hard drive). I have Windows XP. I don't know if it's okay to ask about Dos in python mailing list, so I hope it's alright. Here is my program, I don't know if there are any formatting rules for posting programs, so I hope this will sufice.import os, sys, timedef earlierThan (path, year, exclude=[]):all = []walk = os.walk(path)for root, dirs, files in walk:for i in files: try:if (time.localtime(os.path.getmtime(root + \\ + i))[0] yearand doesNotHave(exclude, root)) : all.append(root + \\ + i)except OSError: #I think that I might need a more specific error message, as this one would handle something #That's not necessarily a broken file name. (I got one of them when I ran it).print root + \\ + i + was not included in the listreturn all def doesNotHave(exclude, root):for x in exclude:if root.startswith(x) -1:return Falsereturn TrueI've had little experience with dos. I believe I should use the COMPACT, and then the MOVE dos command... Would it go something like this?g = earlierThan(G:\My Documents, 2007, [Music])for x in g: os.system(COMPACT /F + x) os.sytem(MOVE + x + + H:\Backup)Thanks _ Need to know the score, the latest news, or you need your Hotmail®-get your fix. http://www.msnmobilefix.com/Default.aspx___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Forgot something...
Sorry, but in my previous message, I realized that I hadn't changed the code from doesNotHave... It's supposed to be x.find(), not x.startswith..Oh, and I also am not worried about messing up any files too much, because I have them all backed up on another computer already _ Helping your favorite cause is as easy as instant messaging. You IM, we give. http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Dos and os.walk with Python
I'm getting the Digest version of the mailing list, if there's any better way to respond to a specific message, I would like to know. thanks : From: [EMAIL PROTECTED] Subject: Tutor Digest, Vol 47, Issue 66 To: tutor@python.org Date: Fri, 25 Jan 2008 02:09:13 +0100 -- Message: 9 Date: Fri, 25 Jan 2008 01:11:00 - From: Alan Gauld [EMAIL PROTECTED] Subject: Re: [Tutor] Dos and os.walk with Python To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; format=flowed; charset=iso-8859-1; reply-type=original Timothy Sikes [EMAIL PROTECTED] wrote I don't know if it's okay to ask about Dos in python mailing list, If its related to programming in python as well its fine :-) I don't know if there are any formatting rules for posting programs It helps if we can see the formatting, especially since Python relies on layout. This was just a mess on my screen! I've tried to sort it out... I can't seem to figure out how to make hotmail keep those spaces and new lines. ah oh well --- import os, sys, time def earlierThan (path, year, exclude=[]): all = [] walk = os.walk(path) for root, dirs, files in walk: for i in files: try: if (time.localtime(os.path.getmtime(root + \\ + i))[0] year and doesNotHave(exclude, root)) : all.append(root + \\ + i) except OSError: #I think that I might need a more specific error message, #as this one would handle something #That's not necessarily a broken file name. (I got one of them when I ran it). print root + \\ + i + was not included in the list return all def doesNotHave(exclude, root): for x in exclude: if root.startswith(x) -1: return False return True -- That last function is a little odd. startswith already returns a boolean so comparing to -1 is weird. I'm not sure what you think it will do. yeah, I meant to have it as .find() Consider: 'fred'.startswith('x') False 'fred'.startswith('x') -1 True 'fred'.startswith('f') -1 True I'm not sure when it would ever fail the test so I think your function will nearly always return False. I've had little experience with dos. I believe I should use the COMPACT, and then the MOVE dos command... Would it go something like this? You could use these but you'd be better just using Python to do it via the shutil and os modules and avoid the DOS commands completely IMHO. Okay, I've found the move command from the shutil module, but I don't see one that compressess files... Are there some? or am I just not seeing them...thanks. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld -- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor End of Tutor Digest, Vol 47, Issue 66 * _ Helping your favorite cause is as easy as instant messaging. You IM, we give. http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Windowss sidebar gadgets with Python?
Hello all.I have been working with Python for a couple years off and on, and am currently enrolled in a java class. Python was my first language, and I think it's probably my favorite. But anyway, I was wondering about whether a Windows SideBar application could be built with Python. I'm not completely sure how they work, as honestly, HTML just confuses me I know you can use JavaScript, but I don't know if you can apply it with Python. I'll probably be back with more questions, as I like to develop different Python scripts and programs for my enjoyment, and I'm starting basic Socket and Network programming.Thank you _ Put your friends on the big screen with Windows Vista® + Windows Live™. http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_012008___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor