Tag Info

Hot answers tagged

6

I need a tutorial that does not skip to explain any lines of code. It should also include different independent objects moving/rotating (most tutorials use only one object), as well as imported 3d objects Arcysnthesis is the best modern OpenGL tutorial I know of, using imported objects doesn't add much to the use of the API, and it's usually API ...


5

Keep Bullet functionality in the Bullet class. This just sounded like nails against a chalkboard to me: During the iteration, it checks what type of object it is, such as Bullet etc. Once it has checked this, it will calculate where the bullet should move to next based upon the Velocity property. Aaagh. D: It's not the base Entity class' ...


3

Wavefront obj files usually are combined with material files (.mat) which define the textures used. The meshes of a model are divided in different material groups. Each material tells you which textures to use and other information of the mesh. In your case, there are separate meshes on the model. These meshes are head, body and hands. They all have their ...


3

I like to use a callback based input manager. The Player class calls the static register method of the input manager with the input to register (either some hard coded values like W or an alias like Forward) and a method to call back when the event happens. In Java this will probably be programmed with an anonymous overloaded object of a callback class. ...


3

How about instead of threads or continuous looping, you use an event system to notify listeners (people who care about when the timer/action is 'finished'). Edit: This pattern is called the observer pattern. There are many ways to implement the function callback system, including delegates and function pointers. It is up to you which one you use, though ...


3

What you want to do is homogenize the interface to that information, so that the debug menu itself need only deal with a single concrete API to get information concerning what it needs to display. Your first step, thus, is to ask yourself "what information do I need?" At a bare minimum, I would expect a debug menu to display key-value pairs: the name of a ...


3

Do you really need two ways of deleting an object? If there is no concrete reason for an object to be able to destroy itself, you could scrap the WorldObject::removeFromWorld() method entirely. Otherwise, your compiler will probably allow you to call a method that destroys the caller, but I wouldn't say this is a good idea. Consider what could happen if you ...


2

As far as I know, if you don't use the object after it's destroyed there is no problem (otherwise you will be accessing a deleted object which is probably undefined behaviour). You could avoid the trouble of managing the memory by having std::unique_ptr<WorldObject> instead of WorldObject* and you would remove from the map simply by calling ...


2

I'll share my design as of current implementation I did for my game. ObjectPool & Managers For objects whether it's enemy objects, collectable items, powers-up, effect (more like particle), etc, I managed them through my own implementation of ObjectPool as you will know roughly number of instances you would need in the game for certain time, so it will ...


1

You seem not to have a TextMesh component in your game object, and you are not checking if GetComponent method has returned any. You can add it once at runtime if it doesn't exist: var text = gameObject.GetComponent(TextMesh); if( text == null ) { text = gameObject.AddComponent(TextMesh); } Or to make it better, you can make var text a private class ...


1

In my case, I went about a lot of this through composition (more precisely through the Strategy Pattern). I built an interface, and made LinearMovement and CircularMovement classes. My friend later added a ParabolicMovement class. Any of these can be provided to a game object at will; you can swap them out at any time. The result is that the function that ...


1

A standard "tween" algorithm usually works by simplifying a more general hermite spline function, to eliminate the necessity of manually providing initial and terminating velocity values. But if you wish to be able to switch from one tween to another, you can no longer do that, and you'll need to use a full, non-simplified spline calculation. Here's some ...


1

This is entirely subjective to the design requirements of your game but, generally speaking, usually most systems use an event-based system where objects register for events. It allows for a pretty flexible system where you can design anything from HID input to timers to trigger events. If you would like to see a pretty strong example of how this can be ...


1

You are using Direct3D 11. So the only thing your mesh should be doing is setting up the Input Assembly stage and issuing some form of Draw call. So your mesh should only call IASetIndexBuffer, IASetInputLayout, IASetPrimitiveTopology, and IASetVertexBuffers, followed by one or more Draw* calls. Everything else should be handled by whatever code called the ...


1

The easiest way to plumb the connections is to create an intermediary class that all game objects know about, much like every program knows about the OS it's running in. This class is responsible for taking requests to create or destroy a game object and passing it onto your Main class. This intermediate communications class can be one of several things: a ...



Only top voted, non community-wiki answers of a minimum length are eligible