Skip to main content
gamedev.net
🔒 Locked

Object-Oriented Technlogy Problem

Started by myfirstgame 0 replies 150+ views
Original Post
myfirstgame
myfirstgame
I hope this topic can be solved in this topic forum. I want to make a rpg game using visual c++ by object oriented technlogy. By the object-oriented technlogy(oot), it has the model that is MVC, M->model, V->view, C->Control. I want to build a isometric map.I will use two dimension array of map object that is: class Map { int mapName; int mapWidth; int mapHeight; MapElement map[mapHeight][mapWidth] } class MapElement { int picNo; int layerNo; . . } I want to ask the question that if I want to draw the map to the screen, where is the draw method is placed? In the map class, in the mapelement class or in the control object or in the view object?? Where is the draw method need to place?Thx
SabreMan
SabreMan
quote:
Original post by myfirstgame
I want to ask the question that if I want to draw the map to the screen, where is the draw method is placed? In the map class, in the mapelement class or in the control object or in the view object?

The model should contain the map representation (map and mapelement), which should not need to know anything about how the map will get drawn (or even that it is drawn at all). Something needs to know how a map will get drawn to screen, and that should be the responsibility of the view. You need to have some interface (or "protocol") whereby the view knows enough about maps in general to ask a specific implementation of map about how it is modelled. That implies you should have an abstract map base class and derive concrete implementations of map from that. The view''s draw method should then be generic enough to draw any type of map that correctly adheres to the map interface and semantics.

Here''s another suggestion: if you are only planning on having one representation of the map at the moment, then model your system as I have suggested, but do not concentrate too much effort on making the protocol between view and model generic enough to draw all manner of map formats. Get it right for what you are doing, and then worry about making it work for different formats when you actually need to do so.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.