Jump to content
  • Advertisement
Sign in to follow this  

Python/Pygame 2D Isometric Tile Map Editor

This topic is 2904 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'm still very new to programming. In fact, the only language I know to any respectable extent is Python, along with the pygame libraries.

With that said, I've been developing this map editor for the last month or so, and I just started re-writing it to conform to the Model-View-Controller (MVC) architecture. This is mainly for two reasons:

A) It will be extremely easy to pickle and unpickle maps this way.
B) It will be extremely simple to implement multiplayer support for maps this way.

To my understanding, in MVC there are three base classes used; Model, View, and Controller, which are all attributes of a class Game (or Program, the lowest level object in an application).

Basically, I create a Model as an attribute to Game, which stores all data and values related to the map.

Then, I create a View as an attribute to Game which has a reference to the Model object, and is supposed to reference resources for the Model's attributes as well as handle rendering and camera and everything else related to what you see.

Finally, I have the Controller as an attribute to Game which has a reference to both the Model object and the View object. This handles user I/O and changes values in both the Model and the View when necessary.

The thing is, I am stumped with how I am supposed to assign things like images to game objects, which are inherently stored in the Model. I can't pickle images, and I can't send them through a network connection as attributes to objects. I can write a function that just blits the appropriate image to the screen and never assigns the image to an object, but that becomes extremely slow and inefficient as the cache dictionary grows with image references. Should I make an Image class and have an Image object take in a GameObject to determine what image (and any changes to the image along with the image's position) the Image object will use for blit and draw calls in View? Or is there a better way to go about doing this?

Any hints or tips are greatly appreciated. Thanks


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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!