Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Big Picture

Name: Anonymous 2010-09-02 2:49

I suck at application architecture.

How do I do MVC for a video game? All explanations of MVC are completely tied to the web, where you have this nice clean cycle of [database -> page composition -> user submitted data]. A video game does not fucking work that way.

How do I refer internally to different parts of the game state? Let's say I have a top-level object called Game, which has an array of Players, and maybe a World class containing some Terrain and some Entities, some of which are PowerUps, etc. Now how do I find a PowerUp from within the Player source code?

Am I meant to go through the Game object, via game->world->entities->powerups? This is horrible because it creates a dependency chain; my Player source code is now dependent on all of those intermediate classes, even though it doesn't actually need to access them besides getting to the powerups. And how do I even access the Game object in the first place? They say don't use global variables. Does this mean I pass around a Game* to all methods in the entire app? Does this mean every single class in the app should store a reference to the Game*? There is a huge amount of overhead for this, not to mention lost optimization opportunities. Am I meant to make it a singleton? Because that's just a bullshit copout; that IS a global variable.

Is there a good book I can read that will explain all this bullshit?

Name: Anonymous 2010-09-02 3:46

>>1
As you have discovered MVC isn't directly applicable to most video games. Though most code can benefit from the modularization principles that MVC is based on(for instance you should try to separate your game logic from your rendering code). Every programming 'rule' or 'best-practice' has many exceptions.  For instance there are plenty of instances where global variables are reasonable.  Do what feels right.  For instance if you find yourself passing around a Game* everywhere when it would be much easier to just have it be a global variable, make it a global variable.  Then later on if you see the need to modularize the code more, just refactor.  There is no ONE-TRUE-WAY to program and therefor no one book will teach you how to write good code.  The best way is to write a fuck lot of code and learn by experience.

P.S. passing a pointer around has negligible performance impact

Name: Anonymous 2010-09-02 4:14

>>2
OP seems to be an ENTERPRISE web ``developer'' lost in a maze of twisty buzzwords, all alike.

A video game does not fucking work that way.
Then don't fucking try to write it that way. You use the pattern, if any, if it fits the problem, not try to coerce the problem into fitting.

Name: Anonymous 2010-09-02 5:31

How do I do MVC for a video game?
AHAHAHAHAHAHAHAHAHAHAHAHA

Name: Anonymous 2010-09-02 6:29

MVC is faggots

Name: Anonymous 2010-09-02 10:53

>>1
Take a look at this.

http://www.gamasutra.com/view/feature/2280/the_guerrilla_guide_to_game_code.php

Let's say I have a top-level object called Game, which has an array of Players, and maybe a World class containing some Terrain and some Entities, some of which are PowerUps, etc. Now how do I find a PowerUp from within the Player source code?
I imagine that whichever object manages your game world contains code for locating objects. Your player object can query whichever object this is to find out if there are powerups close enough to grab.

Name: Anonymous 2010-09-02 11:09

A lot of games now seem to have objects and actors all defined in a DSL which the game inteprets

Name: Anonymous 2010-09-02 12:27

>>7
That's impossible because everyone knows that you can only write games in C and C++.

Name: Anonymous 2010-09-02 13:12

Video games are for children.

Name: Anonymous 2010-09-02 13:54

>>9
Implying that children aren't our future.
Car seats and for children too, but I don't see you talking bad about those.

Name: Anonymous 2010-09-02 14:06

>>7
A DSL? that evaluates as which specific acronym?

Name: Anonymous 2010-09-02 14:10

>>11
You're an idiot.

Name: Anonymous 2010-09-02 14:22

>>12
That would be YAN, unless the acronym doesn't use English words.

Name: Anonymous 2010-09-02 15:14

>>13
*YAA-A

Name: Anonymous 2010-09-02 17:56

Seriously, which of the many computer-related DSLs is that one?

Name: Anonymous 2010-09-02 18:06

>>15
It's not likely to be Damn Small Linux or Digital Subscriber Line, now is it? Jesus fucking Christ, read SICP.

Name: Anonymous 2010-09-02 18:12

NYJMUA.

Name: Anonymous 2010-09-02 18:13

Name: Anonymous 2010-09-02 18:15

you're the man now dog

Name: Anonymous 2010-09-02 18:53

>>16
Data set language
Data simulation language
Data structure language
Decision support language
Definitive software library
Domain-specific language
Dynamic simulation language
There is a dictionary format for translation software (lit. DSL).

Name: Anonymous 2010-09-02 19:13

What does the "C" in SPAWHBTC stand for?

Name: Anonymous 2010-09-02 19:14

>>21
constantly

Name: Anonymous 2010-09-02 19:31

>>15
Dick-Sucking Lips.

Name: Anonymous 2010-09-02 19:53

>>20
Now sort them by how often they're used and feel like an idiot.

Name: Anonymous 2010-09-02 20:30

>>24
This is /prog/.  I take nothing for granted.

Name: Anonymous 2010-09-02 21:55

>>22
What about the "H"?

Name: Anonymous 2010-09-02 22:20

>>25
Translation: It's not enough for me to feel like an idiot. I want you to feel me like an idiot too.

Name: Anonymous 2010-09-02 22:21

>>27
That's correct.

Name: Anonymous 2010-09-03 6:00

It's gotta be the Definitive Software Library.

Name: Anonymous 2010-09-03 8:42

>>26
ecchi

Name: Anonymous 2011-02-03 8:20

Name: Anonymous 2011-02-17 19:40

check my doubles
Don't change these.
Name: Email:
Entire Thread Thread List