Tag Info

New answers tagged

1

If anyone is interested or stumbles upon such problem. I implemented complete batch rendering. Meaning that now i can batch render objects from the same type with one draw Call. Further more i am working on implementing a LOD algorithm for the terrain and also implementing Frutrum Culling to limit maximum objects rendered per frame. This results in huge ...


1

You have a very strange code here. Why do you have glDetachShader(program, vertex_shader); glDetachShader(program, fragment_shader); lines in your shader init code? They should be used when you destroy your shaders. Remove them completely or call them on quit. If it won't help, then I suspect that glDisableVertexAttribArray() resets vertex attribs' ...


0

One recommendation remplace pow(dt,2) to dt*dt (Sorry I can't comment, soy I put here!! Also y recommend this book


0

C++ and C# can interact quite easily. (In the practice C++ issues relative to name mangling often force to have an intermediate C layer) There are several resources you can have a look such as Mono P/Invoke docs and unity docs on native plugins. Calling a C# function from C++ code is simply as using a function pointer (a C# delegate can be marshalled to ...


2

In the broadest sense, yes a callback is nothing more than a function call. But rather than trying to over-engineer an input system by using function pointers, I would consider approaching input from two angles, and allowing both to be available. Observer There are times where it makes sense for part of your code to react to state transitions in a ...


0

Unity uses its own messaging system to call methods like Update. You can use it as well with for example Component.SendMessage. I think that the underlying implementation of the message system uses some form of reflection to determine what methods a class has and call the appropriate ones. (This post's answer explains it better)


1

Scripting languages often expose a set of API functions that allow you to inspect and determine attributes about a loaded script, in your case what functions are defined. This varies by scripting language naturally and will also depend on your native language to scripting language bindings. In Lua for example, I can load a script and then check whether a ...


0

I highly recommend RakNet; it's relatively lightweight and implements a virtual connection over UDP for you (you don't have to manually send acks). I've had great success in using it across multiple projects.


0

There are multiple approaches: Cut-out texture Create a fully transparent texture. Fill the texture with the ellipse shape on the CPU. Render the texture with alpha blend. You only need one texture per ratio of radii, so chances are you can generate some offline. Geometry Create a tessellated sphere, pass radii to vertex shader, deform shpere into ...


1

Store road attributes in separate structs and have pointers to them from your DCEL edges. It doesn't matter if some edges point to the same location in memory—the attribute data has still been allocated only once.


2

One can split game development between these four phases: prototyping gameplay refinement development performance refinement Gameplay exploration I believe happens mostly on the prototyping phase and these are some advice I try to follow: Begin designing with a paper prototype. After you have a clear idea of what the game could be, start coding it so ...


0

This portion of your code is not technically blend state, but could be affecting the behavior here: glDepthMask(FALSE) glDepthFunc(GL_EQUAL) D3D11 does have corresponding state to this, and you can set it by creating and binding a ID3D11DepthStencilState object, in a similar way to what you're doing with the ID3D11BlendState. See ...


0

Please also expand on this: "world matrix of the UI" and show how it's constructed. If you do not explicitly supply a World, View, or Projection, Identity is used. This has the effect of multiplying everything by 1 (no change). Using a world matrix without a view matrix is the same as using a view matrix without a world matrix; (X*1)==(1*X)==(X). I ...


2

I agree with Trevor Powell's answer that speed of iteration is critical for you to stay in the creative mood instead of just polishing. A big source of inspiration for me is Bret Victor's talk, "Inventing on Principle". Unfortunately, it's hard to find real tools at that level. I tried to build one myself for Python development that let's me run my Python ...


7

As a developer focusing mostly on prototyping, here's a bit of advice from my experience. Use an engine that allows you to make changes FAST. This includes things like "Not waiting for compilation", but also "changing things at runtime", "ease of debugging", "availability of test assets" etc. I personally love Unity3D, but it's not the best tool out there. ...


12

To prototype well, reduce the cost of testing ideas. My workflow is tuned for small games, but I've found these things helpful: Prototype-friendly tech I've found it helpful to use a dynamic programming language and framework, such as Lua (LÖVE is nice for 2D), JavaScript or Lisp/Scheme where getting the program to do something requires minimal ...


24

As you've noted, when you're working on game mechanics, speed of iteration is critical. The longer the time between thinking of a modification and being able to test with that modification, the less productive you'll be, and the more distracted you'll become. As a result, you definitely want to be managing your iteration time. For me, I find that my ...


0

I finally found out what I was doing wrong. I was retrieving the wrong start points for drawing the rectangle. When triggering the mousedown I had to get event.button.x instead of GetMouseState Here is the updated Mouse.h #ifndef MOUSE_H_ #define MOUSE_H_ class Mouse { public: bool leftButtonDown = false; bool mouseMoves = false; struct ...


0

You have to do this: In ever loop: First: SDL_RenderClear() SDL_RenderDraw <-- ALL YOUR RENDED HERE, LIKE TEXTURE AND OTHERs. And with: SDL_RenderPresent()


0

The most straight forward and simplest way is a pretty good design: have a data type that is a list of cards (could be a vector, linked list, or other things) and move cards between card groups as gameplay dictates. Unless you have a reason to go in a different direction, simple is good and will make for less bugs. Even if you need super high performance ...


0

Great work that you are doing here :D. The thing about advanced collision detection or any technical aspect of programming is getting it done right. To do so, you must separate the mechanic you want, then make it in a separate environment, then test it then port it into your game. in this case, you want to make a separate SAT collision demo first then ...


1

You need to move all the SDL functions out of the compound for loop. for { for { pixels[y*width+x] = argb; //Updating them all at once should be fine //Nothing else can happen while this is running } } //Update entire array at once, then... SDL_UpdateTexture(texture, NULL, pixels, width * 4); //Copy entire array only once ...


0

How I would do it: Step 1: define rectangles for the bounds of each room and hallway. Now imagine these rectangles as safe areas where the player can be. "Out of bounds" would be declared as any position in which the player is not fully contained in any of the rooms or hallways. Here's a picture as a demonstration: Now, before we go further, you must ...


1

Please consider this first-party library; it is from MS, so if it is not-third-party enough for you, it will make your life considerably easier. It provides an interface to DX11 that is very similar to XNA. Specifically, SpriteBatch, SpriteFont, etc.. Rastertek and Reimer's are generally helpful. For Rastertek, I linked directly to their DX11 2D tutorial, ...


5

General concept Create a server class (to handle connections and messaging) and a client class (to handle connecting to server by IP and port). Then ask the player whether they want to create or join a server. If create, start a server and join it with the client. If join, join the existing server. Minecraft singleplayer can be opened to the LAN, by ...


0

Make some playtests around what equipment/stats will have a certain player on average on certain level. Create a monster roster with monsters valid on certain levels, I mean, Minotaur is never always a player level, but instead create a Minotaur that has level 2, Orc with level 3, Dragon with level 19 etc. When you are generating encounters for player, ...


1

If you have multiple sprites at the same position, are they all supposed to prevent the player from falling? if so, you can either merge them, or disable collision for one. Else, if not all the sprites should collide, maybe you can add a flag to indicate if they are ground colliders. On a side note, you could use a complete AABB instead of using arbitrary ...


0

In your EXAMPLE 1, you're gathering all your player input first, and then doing the move as part of logic(). In your EXAMPLE 2, you're moving the player-object as part of gathering the input. EXAMPLE 2 is ok if there's nothing else that influences the player besides the user input. But usually what happens to each game object (including the player) might ...


1

I assume you mean whether you should be doing active polling or listening to events. Active Polling means that you check the state of your input devices on every update. For example, the Logic() (or Update() or Tick()) function of your character could contain: if (input.isPressed(KEY_RIGHT)) { positionX += 10; }. Events on the other hand let you react to ...


1

I think your problem is not program but staff. You need a Beta tester to give you comment on what to pike down or buff up. If your character has certain unique skill it can also contribute or harm the player. Also note on some games, it's not actually possible to kill high level monster without a bit of team play. You can also apply randomness on range ...


4

The first step in implementing a physics engine is to model the movement of each object in form of a 3d velocity vector. Each object has current velocities in x, y and z direction. Each logic tick of your game engine, the object is moved by its current velocity. Changing the velocity-vector of an object by applying an acceleration-vector is the primary ...


1

Edit: We tried many combinations of the following and got many, many, equally-disappointing results. OP has resigned to using his backup plan of physically moving the geometry slightly toward the camera before drawing it as wireframe. Link to chat. A typical use might be to set factor and units to 1.0 to offset primitives into positive Z (into the ...


0

My take on this is that if you can find a job closer to where you want to be than where you currently are, you should take it. Since you currently are not employed and this offer is for a game development position I'd say go for it. Being employed as a game programmer, even if its for the "wrong technologies" makes you a lot more hireable by the places you ...


2

user1118321's answer will provide you the correct answer, though it is more general than necessary. Since we're dealing with a right triangle, the easiest solution is to use the definition of the tangent function: tan(α) = A / B Substituting half the height of the screen, the z coordinate of the camera, and half the vertical field of view gets us: ...


0

The general approach for games is that models are created and edited in some 'source' format (like WaveFront OBJ, Autodesk FBX, etc.). The models are then "exported" to some format which is optimized for runtime usage, usually something specific to the game engine being used. DirectX Tool Kit supports loading Models from VBO, CMO, and SDKMESH as example ...


2

Check out the Law of Cosines. It allows you to calculate any side or angle in a triangle if you have the opposite 2 angles or sides. Or alternately, use the law of sines (described at the bottom of the above link). In your case, you know that vertical field of view is 45 degrees and that the base side you want is the height of the screen. You can think of ...


1

Okay, I solved the problem. As the guys commenting above pointed out, the code was weird. It wasn't really clear what was happening. This was a result of my brute forcing axis until the individual faces aligned. However, it's what resulted in the above. So I've taken the time to draw on paper how each face should be stepped through and I found the answer. ...


1

This type of state information seems perfect for a Controller type of component. In most implementations, you often have a PlayerController and an AIController that are derived from a common controller component. The AI system and Player system use these controllers to transition state of the associated entity. As state transitions (standing to moving ...


2

This particular code is loading images (maybe DDS files or maybe general bitmap files) into a CPU staging resource doing a format conversion and resize. Presumably you are going to do something else with the srcTexture array that actually creates the resource you are going to render with. This is a lot of runtime processing, so the best option is to do that ...


0

if you have used malloc() or similar memory allocation functions then you must use free() to destroy the allocated memory when your done, and similar when you use the new operator to create an instance of something then you must use delete() to destroy it when done, otherwise those resources and memory may still exists or be locked up in the background, so ...


7

Yes, a game/engine should clean up after itself when it's closed. There are good reasons for that: Show to your team that you know what's going on in your game Know when your managers are shut down Make sure your files and handles are closed and your data is saved Help prevent crashes on exit because you have a better idea to what's going on Help find ...


0

I know you asked not to use RawInput, unfortunately on Windows, it will not be possible to use raw USB/HID for mice and keyboards. Windows has an exclusive file lock on mice and keyboards and will not allow you to read from the device directly. You will have to use RawInput or some other Windows specific API for mice and keyboards. I recommend you use ...


0

You need to use separate projection matrices for the viewport and GUI. E.g: SetupViewportProjection(); DrawViewport(); SetupGUIProjection(); DrawGUI();


1

On this matter, you really have to think a couple of steps further. What differentiate an enemy Zombie from an enemy Robot? What is common to both of them? Can a Zombie be not an enemy but a friend? If so, what would be common to an enemy Zombie and a friendly Zombie? What would be different from an enemy Zombie and a friendly Zombie? Can a Robot be a ...


0

fixedTimeStep = false; //wide-open throttle vsync = false; //wide-open throttle void OnD3D9FrameMove(float elapsedSeconds) { Update(elapsedSeconds); //every frame static float oneFrameTime = (1.0f / 30); static float renderTime; renderTime += elapsedSeconds; if (renderTime >= oneFrameTime) { Render(renderTime); //All at ...


1

found the solution. quad[0].position = sf::Vector2f(x, y); quad[0].position = sf::Vector2f(xsize, ysize);* now fps is like 1100


0

Ok so I found the solution, and thanks for you replies. The linem_player->GameObject::setPosition(m_player->GameObject::getPosition() + dir); was only updating the gameobjects position variable, this variable only took effect on the gameobjects update. Which why of course it worked when there was only one wall. But with a second wall, it would ...


0

if (col.left) dir.x += (wall.getPosition().x + wall.getHalfSize().x) - (m_player->getCollider().getPosition().x - m_player->getCollider().getHalfSize().x); else if (col.right) dir.x -= (m_player->getCollider().getPosition().x + m_player->getCollider().getHalfSize().x) - (wall.getPosition().x - wall.getHalfSize().x);


0

A possible explanation for this is unrelated to the corners: to determine whether it's colliding left or right, or if it's colliding up or down, instead of checking how far inside the player's hitbox is within the wall you should check the direction of the player's movement. It would go more along these lines: CollisionData testPlayerCollision(const ...


1

Everything is green, so I can't tell what is is a player, what is a block, and what "2" means or is supposed to mean. I did make you this, however: The diagram can be mirrored and/or rotated and, with a tweak to the math, match any orientation of collider and collidee. Let me know if this isn't what you need and I'll try again. These triangles are all ...



Top 50 recent answers are included