Python
1,241
1
Advertisement
Well, life got in the way of making it through the OpenGL project. I made it a bit further but never seemed to get around to posting about it. I was studying to get into law school and working on starting my website Crazy Hakiko's Classic Play
based on classic computer, console, and tabletop RPGs. It's not much so far, mostly my blog and a Dragon Warrior review, but it's a start.
I have had time to get back into programming (other than MATLAB, there always seems to be time for MATLAB. One of the things I realised while working through the C++/OpenGL book was that I didn't know enough about how Windows programming worked. I was constantly fighting C++, my compiler, and my complete lack of Windows programming knowledge.
I ran into one of my college professors in the Brnes and Noble and he suggested Python. I had fooled around with it a little bit before when I was messing around with Ron Penton's excellent MUD Programming book (one of my favorite learn how to do something books ever) but had never really done any more with it.
I'm in love. It is interperated like my beloved MATLAB, it is easy to read. It reminds me of when I was first learning to program on my Atari 800XL (READY...) copying BASIC text adventures out of ANALOG magazine (the key is under the mat). It is well documented right there on the site you download it from. In fact it is well documented in its own help system.
Obviously I am not going to be writing Halo 3 in this thing (but I wasn't going to write it anyway) but it seems like a great way to get up to speed on Windows and the fundementals of video game programming. I can then apply these lessons to C++ or C#.
Anyway I am having fun with it and thanks to some help from the guys on the scripting forum here I managed to get a program going where I use the WASD keys to spraypaint a window with a snow texture tile I drew in Paint.
It is not well commented, which is unusual for me, hopefully I'll fix that up in the next day or so. I was excited and rushing. It also has some nasty hard coded hacks in it like the limits on x and y movement.
My goal is to get a Wolfenstein 3d like engine up and running. I think I have the inner workings figured out mathematically speaking. I am pretty sure these types of engines are called raycasters but I don't want to go poking around too much until I try out what I think will work. It would seem like cheating.
based on classic computer, console, and tabletop RPGs. It's not much so far, mostly my blog and a Dragon Warrior review, but it's a start.
I have had time to get back into programming (other than MATLAB, there always seems to be time for MATLAB. One of the things I realised while working through the C++/OpenGL book was that I didn't know enough about how Windows programming worked. I was constantly fighting C++, my compiler, and my complete lack of Windows programming knowledge.
I ran into one of my college professors in the Brnes and Noble and he suggested Python. I had fooled around with it a little bit before when I was messing around with Ron Penton's excellent MUD Programming book (one of my favorite learn how to do something books ever) but had never really done any more with it.
I'm in love. It is interperated like my beloved MATLAB, it is easy to read. It reminds me of when I was first learning to program on my Atari 800XL (READY...) copying BASIC text adventures out of ANALOG magazine (the key is under the mat). It is well documented right there on the site you download it from. In fact it is well documented in its own help system.
Obviously I am not going to be writing Halo 3 in this thing (but I wasn't going to write it anyway) but it seems like a great way to get up to speed on Windows and the fundementals of video game programming. I can then apply these lessons to C++ or C#.
Anyway I am having fun with it and thanks to some help from the guys on the scripting forum here I managed to get a program going where I use the WASD keys to spraypaint a window with a snow texture tile I drew in Paint.
#Setupimport sysimport osimport pygameimport randomimport mathfrom pygame.locals import *progpath = os.getcwd()+"/"keys=[False]*324snow_file_name = '\snow.bmp'def kill(): pygame.display.quit() pygame.quit() returndef load_image(name, colorkey=None): fullname ='c:\Python24' + name try: image = pygame.image.load(fullname) except pygame.error, message: print 'Cannot load image:,%s', name raise SystemExit, message image = image.convert() if colorkey is not None: if colorkey is -1: colorkey = image.get_at((0,0)) image.set_colorkey(colorkey, RLEACCEL) print('hi') return image #, image.get_rect()def main(): pygame.init() pygame.font.init() w=320.0 h=200.0 x=0 y=0 window = pygame.display.set_mode((int(w*2),int(h))) pygame.display.set_caption("Trial") screen = pygame.display.get_surface() clock=pygame.time.Clock() snow_surface = load_image(snow_file_name) #Main loop while True: #Event handling clock.tick(60) for event in pygame.event.get(): if event.type==QUIT: kill() return if event.type==KEYDOWN: if event.key==K_ESCAPE: kill() return keys[event.key]=True elif event.type==KEYUP: keys[event.key]=False print event if keys[K_w]: y = y - 5 if y < 0: y = 0 if keys[K_s]: y = y + 5 if y > 200: y = 200 if keys[K_a]: x = x - 5 if x < 0: x = 0 if keys[K_d]: x = x + 5 if x > 640: x = 640 screen.blit(snow_surface, (x,y)) pygame.display.flip() if __name__=="__main__": main() It is not well commented, which is unusual for me, hopefully I'll fix that up in the next day or so. I was excited and rushing. It also has some nasty hard coded hacks in it like the limits on x and y movement.
My goal is to get a Wolfenstein 3d like engine up and running. I think I have the inner workings figured out mathematically speaking. I am pretty sure these types of engines are called raycasters but I don't want to go poking around too much until I try out what I think will work. It would seem like cheating.
Advertisement
Advertisement
Advertisement
Discussion