Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 28 Apr 2007
Offline Last Active Today, 10:58 AM

#5314871 Unroll

Posted by on 12 October 2016 - 10:45 AM

I would try to isolate what is crashing the program. What happens if you put a constant 8 in place of MAX_TEXTURES and leave out the define. What happens if you unroll the loop manually? This could help you isolate the source of the crash.

#5313558 Raycasts on a 2d map for determining vision.

Posted by on 01 October 2016 - 11:14 PM

Loop over each fog of war tile in the unit's range and only perform the raycast for each tile. You can skip the raycast if the tile is already visible based in a previous unit's calculation significantly speeding up checking for large groups of units. You could then also decrease the fog of war resolution to improve performance.

#5311442 Two classes relying on each other

Posted by on 19 September 2016 - 10:30 AM

You can add a forward declaration instead of including the header.

In bullet.h replace
#include "agressive.h"
class aggressiveEntity;
That simply tells the compiler a class with the name aggressiveEntity exists. You still have to ensure that agressive.h is included. wherever bullet.h is included.

EDIT: Looking at it further, you would be better off just removing that circular dependency altogether. When you create the bullet, just copy over any needed information from aggressiveEntity onto the new bullet instance when you create it.

#5310965 How much money do you make with your games?

Posted by on 15 September 2016 - 01:12 PM

I made this game in high school for the pocket pc about 14 years ago and made about 200 dollars off of it
That is the most success game I have made money wise. All of my games I release these days are free. I would rather try to get as many people to enjoy my game as I can rather than turn a profit.

#5308679 How to compute % of target visibility/cover?

Posted by on 30 August 2016 - 09:42 AM

You listed my suggestion. Shoot many different rays at your target and see how many hit. One thing I would add would be to add some randomization to it. Don't shoot the same rays every frame but randomly pick new ones. You can then smooth out the jitter in the %hit signal using a low pass filter.

#5307458 I have an Idea..........

Posted by on 23 August 2016 - 01:11 PM

My question is are there any easier engines that i can use to make this game. Also I dont really understand the tutorials online .

Making in through those online tutorials will be one of the easiest parts of making your idea. There are easier game engines, but easier to use generally means less capable. No game engine will make your idea simple enough that an inexperienced person can make it. You need to start much smaller to build your skills. Think pong or space invaders small.

#5307443 Scene graphs in an Entity-Component Framework

Posted by on 23 August 2016 - 12:18 PM

I would go with option 3. It allows each system to handle the scene in the way best for itself. Keeping the systems decoupled will simplify your code making adding new features or fixing issues easier. I like to treat code complexity like a resource just like CPU usage and memory. Complex code will use up more developer time and be more bug prone. With that in mind, I like to write my code in a way that uses little complexity budget.

#5307423 if party strength changes, quest encounters can become imbalanced.

Posted by on 23 August 2016 - 10:14 AM

If your party can drop power at any point in the game then you can allow the player grind or do other things to boost your party strength. Maybe even a temporary consumable boost. As long as the deficit can be overcome then I don't think such a scenario would be a problem. I think there is a sense of accomplishment to planning out on how to defeat said monster, executing the plan and succeeding.

#5307411 OpenGl or Vulkan?

Posted by on 23 August 2016 - 09:16 AM

OpenGL is more stable and there is more tutorials available. If you just want something up and running quickly I would go with OpenGL. If you are more interested in the learning Vulkan, I would use Vulkan.

However, if it were me, I would just use Blender to build my scenes, export to the collada format add support for importing collada files in my ray tracer. Unless you really just want the learning experience of trying to make your own, I wouldn't make my own 3d modeler.

#5303997 Theory Behind These Uncharted 4 Bullet Trails

Posted by on 04 August 2016 - 09:38 AM

Try manually creating the smoke trail you want in a 3d modeling program such as blender first. Once you have figured out how to get the look you want manually, then try to write code to automate it.

If I had to guess how they made that effect, I would suspect they generate and manipulate a triangle strip with a texture/shader applied to it. Similar to a trail renderer but more customized.

#5303656 Use Of Static Variables

Posted by on 02 August 2016 - 09:09 AM

When something is global, it is easy to be accessing it in parts of the program that really shouldn't. For example, you may add some bit of code in a pathfinding algorithm that handle globals dealing with how sound works. You then try to reuse your sound code without the pathfinding and it doesn't work the same, or you reuse the pathfinding and it starts randomly playing sounds.

When using globals, the behavior of your classes no only depend on their internal values, but possibly the entire global state of the program. Often when programs are simple, globals aren't that bad but as your program grows they become a big pain.

I have found in my own projects when I have used globals, singletons included, it becomes difficult to maintain and add new features. When I remove global state, I come up with better program structure and code quality as a whole goes up.

#5299342 ddx, ddy reuse for better performance?

Posted by on 06 July 2016 - 10:46 AM

calculating ddx ddy is as cheap as a subtraction. I would recalculate it. tex2Dgrad is mostly useful for when you have branching paths in your shader. If you ever branch you cannot cacluate ddx and ddy. If you need to sample a texture inside an if statement, you need to calculate ddx and ddy before the branch and pass them into tex2Dgrad.

#5297276 [Solved] Rotate towards a target angle

Posted by on 19 June 2016 - 11:01 PM

Use complex numbers with modulus 1 instead of angles. That would be z = cos(alpha) + i * sin(alpha).

if (imag(desired / current) > 0.0)
  current *= Complex(cos(0.1), sin(0.1));
  current *= Complex(cos(0.1), -sin(0.1));
It's not just this piece of code: Pretty much anything you want to do with angles is easier with complex numbers.

I would upvote this twice if I could.

i have no idea what complex numbers are

You should learn them. They will benefit you greatly in game development and aren't that difficult to pick up.
It make take a bit of effort to learn them, but I will pay off big time.

#5296025 gameplay programming: when to use lua and when to use c++

Posted by on 10 June 2016 - 05:12 PM

Lua scripts are easier to treat a resource. You can have a file represent an enemy type or another dynamic object in your game. This file can include the name of a script to use as the object's behavior.
This makes extending the game easy to do, and you really begin to see the benefit when your game has many different types of dynamic objects. You do pay the cost of having to create a binding layer between lua and c++. So the benefit may not be worth it if you aren't going to have many types of objects in your game.

#5295878 Help With 2D Collision (Sticky Wall Sliding)

Posted by on 09 June 2016 - 04:39 PM

When you loop through your list of tiles, you use localBoundsRect against each tile. You move the location of the player but don't update the value of localBoundsRect. If your player intersects with two blocks then the overlap is corrected for each block moving the player twice as far as needed. I would recommend setting the position of the player relative to localBoundsRect using the depth as an offset. You can repeat that multiple times without any negative side effects.