• Advertisement
Sign in to follow this  

Model Information and Class Design

This topic is 4579 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

Hi, I have a monopoly game going on. All the game logic is done for it to work in a console window. Now I want to add some graphics. So I guess I'll have to inherit the classes and add the graphical elements to them. I want to know how it is done in the industry. Let say I have a token. Now I must manage the model object (the vertices, textures, et al.), the animation part because it does not move from Go straight to Reading RR anymore it must pass over Mediterranean Avenue, Community Chest, and so on... to the Reading RR. This part, should it be all stored in the Token class or should I divide this information and keep the model informations into a TokenModel class or something like it? Or if I write it another way: Should I keep the model informations (vertices and textures) with the object it represents or should I divide it and reference it from the object it represents? What is the way used in the industry? Thanks ThunderMusic_80

Share this post


Link to post
Share on other sites
Advertisement
I would guess, assuming you mean the token as a game piece, that you would store the token's position, and the destined position to move to. And "frames" for moving your token. Lets say there's 10 "pixels" per land property. So you calculate "Ok I got to move this piece 4 properties away" by 4*10, then move your token 1 pixel per frame, therby achieving piece movement.

Is that what you wanted?

Share this post


Link to post
Share on other sites
yes exactly, but this information comes from the animation logic, that's not the question (maybe I asked it wrong). the question is, usualy, are the model informations (vertices and textures) stored with the logic of the object(this thing about moving the token 40 pixels away) it represents or is it best to store it in another class with an instance referenced by the object containing the logic?

Maybe it doesn't matter much in a monopoly game because each token is represented only once, but let's say I do a "Ladders and snakes" game (to keep with the board games), the same token model is used 2,3,4 times only the color change. I this case, the model should probably loaded once and referenced by the token class, or for simplicity with the graphical pipeline it should be stored 2,3,4 times? What if the token can have deformations? I don't know, one player pitched its opponent token into a wall and broke it, lol, you get the point.

I just got an example (the monopoly game) to base my question on about the objects represented and their informations (logic) VS the models (vertices and textures) of the object. Should the models be stored in the object or stored elsewhere that can be reused and referenced by the objects using it?

thanks

Share this post


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

  • Advertisement