Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  State-Controller-View-Model  (Read 2351 times)
0 Members and 1 Guest are viewing this topic.
Offline stef569

Junior Member





« Posted 2008-10-08 16:46:15 »

Hi,

I can't figure out how these objects should interact with each other
using Active rendering

I'll try to say what I have now:
State -> Handles one gui(MainMenu, InGame), is painted/updated every gameLoop
Controller -> a list of functions that can be applied to the model, should that contain mouseLeftClick() handles left clicks or select() handles left click logic :/
View -> paint/update itself, direct access to model
Model -> send notification when something changed to the view
UserInput -> Swing Actions a view invokes an Action and the action then handles the request(the actions will needs view and controller objects)

Should the State paint/update the gui? or should the state call paint/update on the controller and then paint/update the gui.
Offline gouessej

« In padded room »



TUER


« Reply #1 - Posted 2008-10-09 09:51:20 »

Hi

I don't use State-Controller-View-Model but only MVC. I disagree with you, the view shouldn't access directly to the model, it is not very dangerous if your program is not online, if you have only a model per view and if you only do it to read data. On my view, a State should propagate the update through the controller to the model if concerned and then the model should use the controller to try to update the view or something like that.

Offline Shakedown

Junior Newbie





« Reply #2 - Posted 2008-10-18 03:34:54 »

Take a look at http://www.puremvc.org.  I don't think PureMVC was designed with game development in mind, but they provide good diagrams and documents explaining how it works.  There are many forms of the MVC pattern, and the PureMVC is just one of them.  Still, you could gain something from looking at it, or you could go right ahead and implement their library.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej

« In padded room »



TUER


« Reply #3 - Posted 2008-10-18 09:38:12 »

Take a look at http://www.puremvc.org.  I don't think PureMVC was designed with game development in mind, but they provide good diagrams and documents explaining how it works.  There are many forms of the MVC pattern, and the PureMVC is just one of them.  Still, you could gain something from looking at it, or you could go right ahead and implement their library.
Good pointer, thanks.

Offline Mr_Light

Senior Member




shiny.


« Reply #4 - Posted 2008-10-18 14:17:32 »

I'd just focus on separating the concerns and keeping things consistent. The object communication is well less important and easily fixed should it really be bad. But if you take the separating of concerns and consistency to hart it's really hard to come up with something poor.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 12


Game Engineer


« Reply #5 - Posted 2008-10-18 19:37:56 »

Yeah really what matters is that you create a paradigm and you follow it.

I personally make the View the class that handles all display and absolutely no computation, the Controller the class that handles all input and turns it into a simple and useable list, and the Model takes the information from the controller, decides what to do with it, and then tells the View what to draw.

If you were doing like what I did above, then just make sure you didn't do something like put scanning for nearby objects in the Model, that should go in the Controller because it has to do with input, even if it's not human input... i.e. the model will decide to do something based on nearby objects.

See my work:
OTC Software
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (63 views)
2014-04-15 18:08:23

BurntPizza (61 views)
2014-04-15 03:46:01

UprightPath (74 views)
2014-04-14 17:39:50

UprightPath (57 views)
2014-04-14 17:35:47

Porlus (75 views)
2014-04-14 15:48:38

tom_mai78101 (100 views)
2014-04-10 04:04:31

BurntPizza (160 views)
2014-04-08 23:06:04

tom_mai78101 (255 views)
2014-04-05 13:34:39

trollwarrior1 (208 views)
2014-04-04 12:06:45

CJLetsGame (215 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!