Tag Info

New answers tagged

2

The simplest way to do this is to compute a correcting rotation every time the camera moves: axis = cross(newPosition, oldPosition); angle = acos(dot(normalize(oldPosition), normalize(newPosition))); ...and then rotate the camera's orientation matrix/quaternion/basis vectors by this correction. But since the movements are likely to be small and frequent, ...


0

This type of accumulated error is usually dealt with by tracking the original point(s) (say, the vertices of a mesh), and their transformation (say, as a matrix or quaternion and scale/translation vectors) separately. When you transform the object, you don't modify the original points. You just update the transformation data. Then a new set of output points ...


0

I managed to fix it. The problem was indeed my main loop. What was causing the issue was that I was using the wrong driver when creating my device. My code for creating a device was this : IrrlichtDevice *device = createDevice(); But this apparently uses the wrong video card driver, so I had to pass one manually like so: IrrlichtDevice *device = ...


0

The problem is not you texture, this should be solved when you put something in background, like texture or geometry, I had similar problem.


1

You might also wan't to consider a component based approach for your game. I can point you to these two articles on the subject: 1 - 2 If you search for "component based game architecture" or "entity component system" you should be able to find a lot more on the subject.


2

Multiple inheritance In C++, you want to be careful with multiple inheritance. It can really add complexity to your code. Especially when you include two objects that have the same base class. This is known as the diamond problem. There are, however, cases were multiple inheritance has it's uses, as seen below. How to properly use multiple inheritance In ...


2

Generally timeGetTime() is best for timing game logic - GetTickCount isn't quite high enough resolution, and QPC & RDTSC are a lot more trouble than they are worth for that purpose. For profiling on the other hand, either RDTSC or QPC can be quite worthwhile. I prefer RDTSC over QPC, though microsoft recommends QPC. The four common time functions ...


1

Shader programming is a highly specialised section of general Graphics Programming. Like any other highly specialised section of development, it depends on two factors; namely the Team-Size and the Goals you wish to achieve 1. Team Size: On smaller teams, having an entire resource (read: person) dedicated to ONLY shader programming might be a huge ...


1

Shader coding is a pretty specific skillset, however it is one that anybody who calls themselves a graphics programmer nowadays should be familiar with since writing shaders has become absolutely crucial to that profession. It's not quite as simple as just jumping in and integrating samples you can find online, because you need to make different shaders work ...


0

Well, you usually need someone to make your game looks good whether was a good artist a great shader writer or both. The actual question that should be asked, do we need an expert level shaders writers with low level hardware knowledge or not? If you are making the next AAA title and want to squeeze every last cycle from your GPU then and want your game ...


4

Frameworks in C++ tend to use their own string implementation to solve Unicode and localization issues. Unicode support in C++ is generally not that good even in C++11. std::string can't store Unicode characters. If you want to take advantage of unicode and probably localization you may want to use their string.


0

This seems that the screen buffer is not being cleared. Make sure you have something like driver->beginScene(true, true, video::SColor(255,0,0,0)); in your main loop.


0

I would not be sure in the C++ method, but using the editing view port I would recommend watching these quick tutorials for building a basic level. https://www.youtube.com/watch?v=I8WBF4AyAX4&list=PLZlv_N0_O1gaCL2XjKluO7N2Pmmw9pvhE He builds an office with a sliding door in like 20 minutes, along with textures, lighting, etc. So pretty sure you could ...


1

It should be either from the image file itself, or from a shader which rejects all perfectly white pixels, or something like that, but since the shader isn't the simplest thing to implement, I'll bet it's the image file. I'll also bet you made or found this image with a white background, then tried to delete that white to make the background transparent. ...


0

I've had the same type of quirk, and after some experimentation I've found that it's caused by the while (window.pollEvent(event)) loop. I re-worked my method just to read the message (window.pollEvent(event)); at the beginning of the while(window.isOpen()){ and then go from there. This causes the frame rate to skyrocket, and you'd definitely want to ...


0

Try using gl_FragColor instead of color in simple.fs


5

On tile based GPUs (commonly seen in mobile hardware) it is beneficial to clear the renderer, as it allows the GPU to dispose of the existing cached frame data. Here's a quote from OpenGL Insights, dealing with the benefits of clearing the framebuffer on a tile based renderer: "On a tile-based architecture, avoiding clears can be disasterous for ...


2

No you don't need to. As you said yourself, if you whole scene is drawn-over by the new rendered frame, then it makes no visual difference. And as comments rightfully mentionned, it might have a positive or a negative impact on performance: profile on your target platform(s) to make your decision. In the old days, it was common place to actually re-render ...


0

I believe that the best approach is to split the texture in many files and loading them on demand. Probably your problem is that you're trying to load larger textures that you would need for a complete 3D scene and you are using Allegro for that. For the big zoom-out you want to be able to apply, you have to use mipmaps. Mipmaps are lower-resolution ...


1

Have different spritesheets for every weapon-component you load as separate image resources. When you want to draw a character, you first draw the character-sprite, and then the sprites of each weapon-component, one after another. Keep in mind that in some cases it might be necessary for some parts to change the drawing offsets of other parts. You might, ...


2

Level design is not easier. You may not need a less deep and thorough understanding of each involved topic, but there is much more topics to reckon with. Roughly you must have notions in : sculpting, animating, drawing, programming, geometry, esthetics(part of philosophy), applied psychology, artificial intelligence (don't forget the NPCs), architecture ...


2

Particle effects which are procedurally calculated by the game engine have the advantage that they can interact with the world: Particles which collide with objects can either bounce off or disappear. A precalculated animation would just pass through any obstacles Particles emitted by a moving object can stay where they are while the object moves on. This ...


0

Perhaps, some custom animation will require a bit of coding. Usually, particles in engines are physically simulated instances. Wıth this option you have more control over your particles as particles are now dynamic entities that you have direct control over.


0

Direct2D bitmaps are hardware device dependent resources and not generally easily accessible from the CPU side of the system. They don't even have lock or map methods. This makes it difficult to get at the pixels of a bitmap; it's not really designed to be used that way. If you only have the D2D bitmap object available, you can render it to a HWND-backed ...


0

I'm not sure if you'd like my method but based on what you said, "New Game, Settings, Exit" then I'm assuming the menu would be the main screen right? I'm a texture user , by the way, and not a surface one. //Let's assume that your method of input is a mouse //since this is long, you can create a class for this then recall it in the gameloop //WE CREATE ...


0

I know how you feel, SDL2 is somewhat different from the earlier one, to make it easier, I'll explain how SDL_Renderer, SDL_Window, and SDL_Texture works. //CREATE WINDOW SDL_Window *window = SDL_CreateWindow("Title", 100, 100, 400, 600,SDL_WINDOW_SHOWN); /*You have created a variable named window which is in the type of SDL_Window, SDL_Create Window ...


1

Wouldn't it be simpler(and smarter) to just have arrays of the base class, then stick in the needed subclass at some index? This doesn't work. Child classes are likely to be a larger size than the base class, since child classes usually add some new data members. If you have an array of a base class (which is, say 32 bytes in size) you can't fit a ...


2

The rules for whether or not you should call Release on a D3D object are simple: It is your responsibility to balance your calls to functions that increase reference counts with those that decrease reference counts. Explicitly calling AddRef, for example, should be balanced by a call to Release when you are finished with that reference. Most functions that ...


0

Okay well... I couldn't work out what was going on with the lerp in Ogre. I tried vectors and floats and it just wasn't happening as expected. However, it occurred to me that surely the shaders would have a lerp functionality in them. Perhaps one that actually works. I modified my vertex shader like this : uniform vec4 oldcolor; uniform vec4 newcolor; ...


1

The problem with your image is that the green box is first rotated then stretched. With no rotation, this gives the correct rectangle, but then it fails. Anyway, I don't think you understood clearly how the algorithm works. The algorithm consists to check whether the projection on an axis of the two shapes intersects, for each axis of a nicely selected ...


0

As expected, it was a really simple solution. I suppose I stared so long at the problem that I was losing the ability to see anything at all. The solution was to send the correct buffer type (GL_ELEMENT_ARRAY_BUFFER instead of GL_ARRAY_BUFFER) to the glBindBuffer(...) call. ORIGINAL CODE glGenBuffers(1, &indexbuffer); glBindBuffer(GL_ARRAY_BUFFER, ...


1

It's not very clever—basically you update the data in memory and then call direct3d/openGL/whatever to do a new render at each update. A single rendered image is called a frame. So in a video game, you render like 50 frames in a second (written 50 FPS). As Raxvan, I suggest you to read a book about computer graphics as the subject is vast and cannot be ...


0

There is an algorithm called BFS (Breadth-first_search). You can apply this algorithm on each empty cell that has a fixed gem above it, to find the nearest top where you can drop a gem and you can also modify the algorithm to build the shortest path to use it in the animation. The algorithm will try to move in zigzag if it is the shortest path, but you can ...


4

As congusbongus notes in his answer, many games benefit from dividing content into "scenes". A scene might represent a particular level, a room, a minigame, or lots of other possibilities, depending on the game. In such a system, menus can be implemented as scenes as well, and this works well for simple games with only a few menus. Personally, I like to ...


2

The typical way to implement this is using game screens or scenes. Your game loop updates and draws the current screen, whatever that may be Your menu(s) live in one screen or set of screens, your game world lives in another screen Choosing certain menu options (e.g. start game) switches the current screen In this sense, it's just a plain programming ...


1

So, the answer it turns out is to create a child scene node of the sunNode positioning it some distance away. Ogre::SceneNode* sunBBNode = sunNode->createChildSceneNode("sunFlare", Ogre::Vector3(0,0,-1000)); Creating the billboard is easy. In this case, I am just using the Examples/Flare material from the default Ogre media. Ogre::BillboardSet* ...


0

I'm not 100% sure what your exact problem is but I do know in my code, that.. glEnableVertexAttribArray(attrib_coord3d); glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexAttribPointer(attrib_coord3d, 3, GL_FLOAT, GL_FALSE, 0, 0); I don't do that every time I draw, I do it once when I load a 3D model, and then after that I just bind the vertex array to ...


0

You also need to reflect the lighting environment (i.e. light positions and directions) for the lighting on the reflection to be correct. It's useful to think about the reflection as being applied to the camera, i.e. as part of the view transformation, rather than as part of the model transformation. That way, the logic you already have to ensure lights ...


2

ngoaho91 is basically hinting in the right direction but is not spelling it out explicitly, so I will try to make it more explicit. So you took the framework and started implementing the logic within the separate framework classes. The problem why you can't simply test the game logic in isolation, is because it is not isolated. You write that you ...


2

Implement your own Point class. That's good design if UI Point is seperate from logic Point. //Point.h class Point { public: int x,y; }; Point different to cocos2d::Point. In Projectile class, you include and use it. //Projectile.h #include "Point.h" class Projectile { public: char* image; Point* position; }; Then render class, include the ...


0

You will send the entire state of the given simulation to any player who joins. That does not mean you need to send the entire representation of the host/server representations, but you do need enough that the client can accurately render and interact within the simulation. This might include things like: Sprites Names Position Velocity Bounding sizes ...


2

When you have a multiplayer game, you have to be aware that the players are able to cheat with everything that is computed locally. When you want the game to be fair, you have no other option than to move all game mechanics (movement, mob AI, collision detection, damage calculation, ..., ... ) to a central server. But let's assume that the community around ...


0

The renderer cannot accept SDL_Surface*'s so you will have to convert them to textures by SDL_Texture* texture = SDL_CreateTextureFromSurface(render, surface) The renderer is basically an SDL_Window* that is hidden from the user where the graphics are rendered at first, then the rendered data gets switched with the window's data To do this you must use ...


3

Without ever having implemented this... First you will have to control every step of the new gems on their way to their final place. Or in other words, move your sprites only on field on your grid and then calculate their next field. Now generate new gems and drop them into that column. On each step you check if the gem can fall further down. If not check ...


1

The way I usually handle constant buffers is to define a struct in C++ that matches the layout of the constant buffer as defined in HLSL; then I can just create an instance of the struct and fill in the data. You can also create a more data-driven system where you use the offset and size information retrieved from shader reflection. You'll need to allocate ...


0

You don't necessarily have to throw away inheritance to ensure data locality. One very common approach used by level based games is to allocate a large chunk of memory at level start and construct all game objects in this chunk. It doesn't matter that game objects will have different sizes in this case, they are still laid out sequentially in the memory. ...


1

So what you would probably need to do is the following: Create a simple model in Blender, 3Ds Max, Maya,... whatever 3D package Export that model to .fbx (check settins if you have materials or something Take this .fbx file and drag it in the Content Browser of Unreal Engine. At this point you should fill in some data about the model, normally you only ...


1

If you're using win32 then you can handle mouse and keyboard events using RawInput. Info can be found on MSDN. You would handle windows messages for raw input devices in the window process. For example, if handling the input for a keyboard and mouse, register those devices in the WM_CREATE case of your application window process like so: switch( uMsg ){ ...


0

If you only care about the artistic effect of the think, you might as well just clear the screen to black and set the scissor testing by hand, before drawing the cinematic frame. See the docs: D3D9, D3D11


1

The black bars are nothing more than the cleared back buffer. The video is simply being centered and played between these two bars. This effect is known as Letterboxing. The only thing you need to do in DirectX is simply render the video accordingly (vertically aligned). That being said, a lot of the time these bars are shown because aspect ratio of the ...



Top 50 recent answers are included