Tag Info

New answers tagged

2

How do I use the engine's vertex shader while still allowing the programmer to provide his/her own vertex shader for other calculations in their game? What is the normal approach here? There is no normal approach because engines generally don't let you do that. Generally speaking, engines take one of two approaches: either the user provides none of a ...


2

Higher-end engines typically use a higher-level abstraction than an individual shader. Simpler games just allow each model/material to specify shaders and then to use HLSL includes or the like to allow all common code to be easily reused. You'll need a bit of discipline in applying the shader includes properly and it can be a bit repetitive sometimes, but ...


1

It may be worth pointing out a few design diagram talks from the Game Developers Conference 2013. These are some very practical and road-tested examples -- and it seems they've been presented at many conferences across the years. (The other answers have done an admirable job of demonstrating why and how design-focused diagrams can be tremendously helpful ...


12

I like to think that everything around us can be represented, one way or another, through a diagram. Even if it is just a linear diagram representing the transition between the states of a particular object throughout time (like a living being, going through a number of states from birth to death). I use diagrams to lay down my thoughts and ideas for the ...


6

I'd say there are two types of diagrams. Formal diagrams and scribbles. Regarding formal diagrams, I do them when I'm working with other programmers, but I rarely do so when I'm programming alone. However, that doesn't mean I sit and code whatever comes to mind. In my opinion, the most important thing when programming (or actually anything in life) is to ...


8

Diagrams are a great way to communicate, document and aid your design, and design is the most significant part of software development. UML has a lot of features but you are not meant to use them all at the same time, only the ones that are useful. When navigating in a new city, do you actually stop and look at a map, rather than just continue and follow ...


14

I certainly do - both structural and behavioral - my rule of thumb is that I make diagrams when the cost of making the diagram is less than trying to remember what the hell I was thinking a month later - or when I need to clearly explain myself to some other developer Class diagrams when the inheritance hierarchy becomes sufficiently complex Object ...


-1

They use customized UDP libraries. Their goal is to have a TCP-Alike connection model. So they want to send UDP packets because is faster but they want to ensure a packet ACK receival acknowledge to not lose any (or some) packets. So they implement their own UDP way to reply back by the same protocol that they receieved the packet successfully.


4

They should use the same movement component for both, if the movement component is velocity. However, the systems that modify the velocity will be different. The ball will use the physics component to bounce off the paddles and walls, where the paddles will use the mouse/keyboard input component to move. So the physics system will be modifying the movement ...


3

The simplest way to enforce a relationship without strong coupling is to use a Mediator. There could be an Unlocker system that keeps track of the player's keys and listens to collision messages between the player and doors. By moving this dependent logic upwards, you keep the player, the key, and the door decoupled. Here's some C# code to illustrate. If ...


6

Precise answer usually (or always?) depends on the specific situation and circumstances but I think it's a good idea to try to model the real-world relations between objects. Like in your example - the human is the only entity that actually does something (takes action). So probably this class should call key and door's methods. Key doesn't have to know or ...


1

I do tiles collision in a dedicated TilesCollisionSystem where relevant objects register their TilesCollisionComponent. The component contains a pointer to the geometry used for collisions. Some objects only register to the TilesCollisionSystem (some particles for example). This way there is a dedicated system for tiles collision and it goes only through ...


1

Well, this is some specific case of the Observer pattern. There is a solution that involves callbacks. This is the best way of doing this if you want loose coupling, and I think it's also the cleanest one. This won't involve any global managers or singletons. Basically, you'll need to have some sort of SettingsStore. There you store the settings. When you ...


0

I have only done minor experiments with Android so this answer will be platform agnostic. Ignore it if you want an Android specific solution. For specific case of the "Get ready" screen my laziest and favorite way is to load an image into the game window and outside the game main loop. Enter the resources loading code, the image will remain visible as ...


0

Read your settings from a file into into variables. Have your Screen Manager track if the screen it just came from was the Options screen, and if it was, reload your settings from the variables. When the user is exiting your game, write the settings in the variables back to the file.


2

One option is messaging and event handling. This basically works by setting up objects that "listen" for when the appropriate message is sent out and do something (like playing a noise or even handling game logic) when they receive it. So essentially you would have a sound listener object that would be in charge of playing sounds. When the action happens ...


0

Note that I'm not knowledgeable about those games specifically, so I can only answer in the general sense. A lot of modern games do both game state synchronization and event delivery to some degree. Each approach has a different use-case, as Anomalous Underdog pointed out. One advantage of the sync-the-world model is that you can reuse the general state ...


1

Without messing your current architecture, I see two ways. First, you could store a pointer to the Game instance in the OptionsScreen class. Second, you could the Game class fetch current settings in a given interval, say every second. To actually adapt to the new settings, the Game class has to implement some sort of reset functions which fetches the ...


1

This is what I do for my game. I have 2 separate functions for initialising stuff, 'init' and 'reset'. Init is only called once at startup and does things that do not rely on any settings, such as loading main assets. Reset does things like laying out the UI based on screen resolution, so is called every time the settings change. init(); bool quit = false; ...


1

From what I've seen, the easiest approach is read an options file on startup to determine current display settings; then, when your options screen is displayed, load all current options from a file. When changes are finalized via an apply or ok button, they are saved back to a file. If any changes effect the display, notify the user that the game must be ...


1

The mistake that is often made is to write your own allocators so that you can have more control over how much memory is used by each system and have more visibility on what is going on. A much better way to achieve this is to use a memory profiler. There are plenty of memory profilers out there, my profiler MemPro being one example. This is a totally ...


3

It can be 1, it can be 3, it could even be more. This is a design decision that you need to make, based on a number of factors. Some of them are soft decisions based on your circumstances and preferences: How much functionality (data and behaviour) is shared between the different types of bullets? How large and complex is the project going to be in the ...


3

This is a really hard question to answer properly, because it really depends on the actual use case, your implementation, etc. The more similar the behavior is, the more likely you could handle them all with one class, but due to this not necessarily being the case, other options might be more interesting. E.g. if the only difference is their speed or ...


0

While it is, of course, possible to implement animations within an AI architecture, it would be a poor methodology for a number of reasons. One such reason would be an agent that chooses to walk but cannot for some reason. Another reason would be needless complexity (many decisions would have to implement an exact-copy of an animation node because they ...



Top 50 recent answers are included