Jump to content
  • Advertisement
Sign in to follow this  
Sweptile65

Python RPGs Beginner

This topic is 1013 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to create 2D RPGs in Python using Pygame or other such libraries. I have experience in making small games like snake, football penalty shoots etc. using Pygame. However, now I would like to move over to some 2D RPGs like the old GameBoy Zelda or Sword of Mana games. Please guide me to how I should start and learn about it.

Share this post


Link to post
Share on other sites
Advertisement

What do you see as different compared to eg Snake?

Apparently, you can code that, while a RPG causes some block to you. What are you stuck on?

 

 

I would start by making a very small world, eg 4x4 tiles or so with only walls (nothing else in the room), and program that. Then extend by having to reach a certain tile.

Does that look like a good step to you?

Share this post


Link to post
Share on other sites


Apparently, you can code that, while a RPG causes some block to you. What are you stuck on?

 

My main problem is the lack of knowledge on maps, tilesets etc. I tried various things myself and using the internet but was not satisfied.

Share this post


Link to post
Share on other sites

A common approach is to have a (flat) world as a rectangular 2D grid mapped out in X and Y. Each cell contains one thing.

In your case, a cell is either floor or wall. The simplest approach is a top-down view.

You need a sprite for each type, say a 64x64 pixels green image for a floor, and red 64x64 pixels image for a wall.

 

A map is a 2d array where you specify what each cell in the grid contains, eg

map = [ [ 1, 1, 1, 1, 1],
        [ 1, 0, 0, 0, 1],
        [ 1, 1, 0, 1, 1],
        [ 1, 0, 0, 1, 1],
        [ 1, 1, 1, 1,,1] ]

for y, row in enumerate(map):
    for x, cell in enumerate(row):
        if cell == 1:
            draw_wall(x*64, y*64)
        else:
            draw_floor(x*64, y*64)

The 'map' is the central thing. The player is at one of the 0 values (eg pos=(1, 1) ). You can go to the right if map[pos[1], pos[0]+1] == 0, ie if the cell next to the current location is a floor.  (You could draw yellow circle at the center of the 'pos' cell).

 

This is the core of a map and a tile set. You can extend of course, instead of simple a red 64x64 image, make something that looks like a wall. Have a stone floor and a wooden floor instead of a green rectangle. You give each variation a unique value in the map, and you code the display and the movement. Instead of a yellw circle, make an image that looks like a player seen from above.

Add a "door" cell. When the player moves into it, he goes "through the door" and you draw a new room by changing the map.

 

 

Hope this is helpful, feel free to ask further questions :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!