Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


dmreichard

Member Since 24 Apr 2005
Offline Last Active Jul 04 2015 09:33 AM

#5068364 Movement Game Logic in a Python Text-Based Game

Posted by dmreichard on 08 June 2013 - 11:25 PM

However I am a bit stuck on how to simulate player movement in Python. I looked around the internet for movement logic specifically in Python, but so far I have had no luck. So I come to you guys, the experts. Does anyone have a good method of simulating player movement? In case anyone is interested I am 51% of the way through the CodeAcademy Python track so I haven't completely learned the basics of Python yet.

 

From reading this it sounds like you are attempting to tackle a project a bit out of your scope at the moment. Let me clarify something first that there is no "movement logic" specifically in Python. Python is simply a programming language, a tool. To solve the problem of how to simulate player movement would involve thinking about how you are breaking down the representation of your player and a room. What data structures are you going to use to represent these game entities? Will rooms have references to each other by cardinal directions and a list of game objects and/or players?

 

I think you should read more about Python and experiment with classes, modules etc. before tackling a text based RPG. One way to think about programming is taking a large problem and dividing that into several smaller problems to solve then piecing it all back together. The language itself is simply a tool or means to an end however, if you don't know how to use the tool with some proficiency your problem will be rather hard to solve indeed.




#5036682 Any point Learning XNA?

Posted by dmreichard on 26 February 2013 - 07:01 AM

this book is very helpful: (for 3D)

http://www.packtpub.com/xna-4-3d-game-development-example-beginners-guide/

 

Just to point out, I think hikarihe meant for 2D, as the book listed above does not delve into 3D development. It is however an excellent book!




#5021955 Learning C#?

Posted by dmreichard on 15 January 2013 - 04:44 PM

I am not personally aware of any "C# For Beginners" that actually start from a 0 programming knowledge standpoint. Seems to be the majority (if not all) reference material on C# assumes that you are coming from C++ or Java and have a general understanding of programming techniques and verbiage before getting started.

 

 

 

C# is not a good "first language to learn."

 

 

I have to disagree with you both on this one. While I feel other languages especially those that are interactive such as Python are perhaps a better choice starting out, I don't believe learning C# first is a bad choice. Suggesting that one learns C++ instead of C# because of C# being multi-paradigm seems even moreso hypocritical, considering that C# confines you more than C++ does in that way.

 

As for the OP's question, there are plenty of beginner C# tutorials and reference material you may find doing a search query on Google. I would recommend when looking at books on Amazon you also check reviews from programmers on said particular book. Don't necessarily rely on the reviews that are posted on Amazon itself.

 

I will however recommend if you are just starting out that you try Python. Many will argue that it is a much simpler language (though no less powerful) than C# and I agree whole heartidly, however my primary reason for recommending it is because of it's interactive prompt. This will allow you to quickly try new things that you have learned and encourages experimentation. When learning to program you won't learn just by reading but by further experimentation, and this format works well for that. There is also an excellent free online book, http://greenteapress.com/thinkpython/thinkpython.html, which is a great introduction to Python and programming in general.




#5021306 Blender/Python books and tutorials

Posted by dmreichard on 14 January 2013 - 01:04 AM

I have been enjoying the free course offered here: http://gryllus.net/Blender/3D.html

I also bought the suggested textbook: http://www.amazon.com/The-Complete-Guide-Blender-Graphics/dp/1466517034

 

So far I am picking things up rather quickly using these resources on Blender3d.

 

As for Python there is an extraordinary amount of reference material and tutorials on the internet. A simple Google search will turn up many useful results. Is there a particular version you are targeting? In most cases the documentation right from the main site at http://www.python.org will be very useful.




#5010044 Beginner Python Game Issue

Posted by dmreichard on 12 December 2012 - 08:17 PM

While probably not best for starting off, once you have more experience under your belt and move on to bigger projects I highly recommend the PyCharm IDE found at http://www.jetbrains.com/pycharm/. You may use it free for 30 days and after that you must purchase a license. At the time of this writing a personal license may be purchased at $99 USD.


#4996947 Pause not working

Posted by dmreichard on 03 November 2012 - 01:18 PM

An easy way to think about event-based vs polling in this context is being reactive vs proactive, respectively. For example, when you press or release a key this adds an event corresponding to that action in the pygame event queue. One normally retrieves the event queue and then interates through it for events they are interested in capturing. You are therefore reacting to the event.

Polling is the opposite of being reactive. You are basically on each iteration of the game loop saying, "Is this key being pressed right now?" as opposed to "Did this key get pressed?"

There are many resources on the uses and benefits of each, and a google search should turn up useful information.

I found the actual pygame API reference located at http://www.pygame.org/docs/ to be most beneficial versus any tutorial on pygame for explaining the library itself.


#4996917 Pause not working

Posted by dmreichard on 03 November 2012 - 11:47 AM

You are correct in that set_repeat() is causing you headache. What is happening is that every time you press the spacebar to pause, it is actually pausing many times in a row. It is taking you several tries to actually land on a paused state. I would recommend you either poll keys for paddle movement, or keep track of paddle velocity when using the event based input handling.

An example:
[source lang="python"]# Event Based Example####################paddle.vy = 0 #velocity going up and down# ... some game logic hereelif event.type == KEYDOWN and event.key == K_DOWN: paddle.vy += 1elif event.type == KEYUP and event.key == K_DOWN: paddle.vy -= 1elif event.type == KEYDOWN and event.key == K_UP: paddle.vy -= 1elif event.type == KEYUP and event.key == K_UP: paddle.vy += 1# Polling Based Example######################keys = pygame.key.get_pressed()if keys[K_DOWN]: paddle.y += 1elif keys[K_UP]: paddle.y -= 1[/source]

In the event based example, you would update the actual position of the paddle in your update function that should be called to update game entitites.

Please note that this is a basic example. You would probably want to incorporate a timestep into both methods, so that you don't notice the paddle speeding up or slowing down based upon framerate.


PARTNERS