Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 12 Mar 2005
Offline Last Active Today, 08:20 AM

#5314002 Getting more curious and curious

Posted by on 05 October 2016 - 09:06 AM

There is much to know, and much to learn. There is much material online you can learn from, but it is self-directed and you need to sift through what is most important at every phase of your learning.  If you're looking for a dead-tree book on Unity there are several including the one linked to at the bottom of my post.  Reviewed books tend to be better if you need guidance of what to learn next; if you don't know what you need to know next it can help get you to the level of basic competency.


As for what goes inside game engines, they are complex beasts. Consider that the major engines have been in development for years and tend to have large teams behind them.  They typically represent several hundred work-years of effort by professionals, each person being expert in their own domains. As such, you could not create an engine like Unity or Unreal by yourself if you spent one hundred or five hundred years on it.  They contain a huge number of systems: graphics processing, graphics file processing, graphics display, audio playback, audio formats, physics-based an non-physics based simulations, math and numerics libraries, disk libraries, animation libraries, UI libraries, networking support, and much more.

#5313992 Your Opinion of Software Dev Resume assertion

Posted by on 05 October 2016 - 06:38 AM

Not British, but I so find most of those to be useless. I want to see what you have built, not the results of what you built. This is different from places where humanities are the primary focus, where social improvements are more important. Also, "slashed payroll by 30%" is a bad thing, you fired 1/3 of the staff. :-)

Their generic advice is still correct, "Employers want to know about your previous contributions and more specifically, how you made a difference at your last position. More importantly, they want to know how you are going to make a significant difference at their company."

In software development, that means things you built. Built a pathfinder, built a raytracer, built an interchangeable weapons system, built a game's battle system, created a networked gameplay system, built an award-winning game. For students it also means subjects you studied; data structures and algorithms are commonplace, study of networking, study of graphics, study of math subjects, study of other topics that relate to game development.

I don't care so much about improving performance of random code by 70% unless that code is something major; perhaps something that is major and big like improving Unreal Engine 4 by 70% after finding something in their code.

#5313891 3D Dubins over-estimate the path cost by an extremely small fraction

Posted by on 04 October 2016 - 11:17 AM

I have decreased the PI from 3.1416 to 3.14, but it is still off by 0.001xxx

Using 3 digits of precision won't help.  If you've got it in a library use pi loaded directly into the register.  If that's not possible use a constant such as M_PI if it exists in your math libraries. 
Instead, consider what you are doing very carefully:

std::sqrtf((2 * sol->R * PI) * (2 * sol->R * PI) + (sol->p_s.y - sol->w_s.y) * (sol->p_s.y - sol->w_s.y));

I don't know your scale, but consider that floating point has roughly six decimal digits of precision.  (See FLT_DIG for your system-specific value).  Values get converted into the correct scale as yo do the math.  
So for example:
This:  123456 + 12.3456
needs to get the floating point alignment and so this:
+      12.3456
+  000012.3456

giving 123468.<?>, not 123468.3456 exactly, the last value becomes rounding error.

Similarly for multiplication...  


Your segment of this: (2 * sol->R * PI)


looks like this to me: 


* 695700099 (radius of our sun)

* 3.14159

is actually this:


* 695700???

*         3.14159


that after floating point adjustment becomes this:


* 695700???

* 000000???.????? 


or, since they are carried out sequentially, becomes this:


* 695700099



* 000000003.14159 



or maybe this:


* 695700099



* 000000003.14159 




or maybe something else entirely.


Once you've lost scale and you've done a math operation that blows away your precision, all bets are off.  Maybe you got lucky and had a bit or two that happened to cover your range, or maybe you didn't.



There are some actions you can take to ensure your numbers don't get large enough to blow away your precision, but they are dependent on the operation you are doing.  
For one example, averaging a ton of numbers instead of summing them all into a range that exceeds precision, you can maintain both the accumulated value and a count of values accumulated so far so you never break precision.  In that case it is avg += (x/n) - (avg/n); n++;  With that slight change the values you are working with are always a fraction of the original and thus always within the source precision. Unfortunately sometimes even with that, the optimizer will think it knows better than the programmer and attempt to rewrite the math, so this type of thing needs to be verified in assembly and sometimes have specific optimizations turned off around that code.
In your case, you'll need to review your math and make sure it stays inside your desired precision.

#5313662 Do I need a patent

Posted by on 02 October 2016 - 10:25 PM

Mailing something to yourself doesn't work and isn't accepted if there was ever a court case about it.

In the US if you want to register, pay the $35 registration cost to the copyright office.  It isn't difficult (the paperwork takes about 30 minutes) and not particularly expensive.  It is nothing compared to the other costs of doing business.

#5313652 Do I need a patent

Posted by on 02 October 2016 - 07:15 PM

Patents protect unique processes. If you have created some fancy new unique process and think it needs specific legal protection because someone else will implement the process and take it to market first, then yes, get one.

In practice, generally no, you do not need a patent. But if you do, talk to an IP lawyer who can help you through the process.

Patents are incredibly difficult for lay-people to get right. There are many subtle issues that can cause a patent to be invalid upon review, but the patent office will still gladly take your money for the filing. It is an area that requires a skilled legal team.

#5313402 How effective is paid advertising for an arcade PC (Win / Mac) game?

Posted by on 30 September 2016 - 12:02 PM

There are all kinds of differences in advertising.  

There are product releases like the annual sports franchises that spend many millions every year, and it is quite worth it to them.


There are products where people invest thousands of dollars. There are some where people invest hundreds, or tens, or single digit dollars on advertising.



Every product needs to know its customers, the target market.  Then they need to figure out how to reach the target market.  Every game is different, and every target market is different.  My game for young children will have a radically different marketing target than another person's game targeting young men, which will be different from a game targeting young women, and so on.


Even games with similar target demographics will have different needs.  Even though all of them target similar ages and lifestyles, Tiger Woods Golf marketing includes golfing magazines and web sites, FIFA hits different sports venues, Madden hits still others.





There's one thing I'm quite curious about though, and I'd love to hear from more experienced colleagues here who got their games published on Steam / GOG. That is, did you use any paid advertising to boost sales of your game? Did it work and where did you advertise? Adwords / Bing Ads? Reddit ads? BuyAds? Other?


If your only advertising is word-of-mouth and you never engage in paid advertising, the game is going to do worse than if you just bought powerball tickets twice a week rather than paying for your computer.

#5313400 Local scope benefits

Posted by on 30 September 2016 - 11:53 AM

In the example you give, in most languages and most scenarios the work will be identical.  This is not always the case.


In your specific example there are some extremely basic optimizations that will be made by almost every compiler. The first is to eliminate the temporary, the second is to unroll the loop.  In both cases it will be trivially optimized to this:









In other cases where the compiler couldn't be certain about the optimizations, so it couldn't take them.


Removing temporary objects is a common task for compilers. Various things can prevent that. Perhaps the assignment needed to go through a custom assignment operator, then the change could make a difference.  


Hoisting constant values out of loops, hoisting object creation out of loops, hoisting allocation and other expensive allocations out of loops, these are very common changes to make in a code base: do something once rather than doing it many times.  In this simple case the compiler can do it for you, in more complex cases it may not.


Another item is that you looped a fixed number of times.  Loops have a very tiny performance impact, It is on the order of a fraction of a nanosecond each time, but doing it thousands of times every frame for millions of frames and the time accumulates. If you looped a variable number of times the compiler may not be able to unroll the loop.




Mainstream compilers are generally quite aggressive with optimizations, and they contain databases of an enormous number of software patterns they can quietly improve. If you see in your code that it is something you should improve, doing the work once rather than doing it in a loop, then do so.  Otherwise you can generally trust the optimizer to do its job behind your back.

#5313353 Should I pursue game Development?

Posted by on 30 September 2016 - 02:24 AM

You mention programming and design disciplines. You also mention playing games.
Playing games and making games are quite different.  Much like there is a difference between eating delicious food and working every day as a master chef, a difference between enjoying a concert one evening and working every day as a concert violinist, a difference between driving high performance cars and working every day as an automobile engineer or as an auto mechanic.
For programming, you dropped out after one programming class.  That doesn't bode particularly well.  Games are software, they're a specific kind of high performance software. Consequently, game programmers should generally love making software. Do you spend your time reading about programming languages and algorithms? Do you enjoy studying the differences between different data structure performance, or learning about various sort algorithms and their fundamental differences? Or do you enjoy working with data formats as they move between systems, or compilers, or tools? Do you enjoy working with the math of 3D worlds, comfortable with matrix and vector manipulation, using linear algebra to find how things move in 3D space, and using calculus to turn motion and continuous change into formulas and algorithms? Do you spend time talking with other people about source code, about programming issues, and about the craft? If so then you might be a great game programmer.
For design, you mention a little more. It is far more than just appreciating and lamenting as you describe; any concertgoer can appreciate and lament a concert, any driver can appreciate or lament a vehicle, any diner can appreciate or lament a meal.

Do you study how game mechanics work? Do you look critically at games that are fun and figure out exactly why they are fun? Do you break down the fun components and figure out why they are fun, and explore what happens when they are changed, or used in isolation, or used in combination with other mechanics?  On the flip side, do you look at mechanics that are not fun, and figure out why they are not fun? Do you figure out what happens to those non-fun mechanics when they are changed, used in isolation, or used in combination with other mechanics?  You mention you played Magic the Gathering, but is that all you did? Do you modify existing rule sets? Did you build your own cards, printing cards that fit within the game universe but modify it in material ways? Do you then experiment with those rules? What about other games, such as building your own D&D campaign with your own custom unique objects and unique monsters that fit in to the existing game?  Or modifying rules to tabletop games like Settlers of Catan, modifying the board markers, or introducing your own resource types and rules for them? For game levels, do you analyze why decisions are made, why powerups are placed where they are instead of somewhere else, why Mario has all the platforms in the locations they are placed, what specific item each Portal level introduces and why it is placed at that location and not earlier or later?  Do you have a broad base of knowledge and real life world experiences? Outside of games, do you have a wide range of stories and ideas you want to share with others? Are you skilled at communicating these ideas to other people, even when those ideas are different from your own? If so then you might be a great designer.

Am I being selfish entertaining this idea? In your opinion how good are my chances of making any money with my current plan? If it does not seem like a good way to break into the industry, is there a better way?

If those are your passions then by all means follow them. Many people enjoy these things, and it works well for a career.   Just like some people enjoy the study of aircraft and have great careers working for Boeing or Airbus; some people enjoy working with food and have great careers in culinary arts; some people enjoy getting their hands greasy and working with engine parts and have great careers in automobile repair and maintenance. 
Unfortunately there are sometimes people who don't realize that making things is different from enjoying things.  There are people who enjoy movies and dream about living a movie star life, but they have no inclination to study the craft of acting. There are people who enjoy music and dream about living as a rock star but have no inclination to study the craft of making music on stage.  And there are people who enjoy playing games and dream about having built amazing new games, but have no inclination to study the craft of building games.  They may even push hard to get the job they think they want, only to discover after years of effort that it really isn't their passion, and they want to do something different.
If you love it and it is your passion, then great.  In that case do what it takes to make your passion your career. You mention you already have a philosophy degree. That may work for a game designer, but for a programmer it probably means getting a degree related to the field you want. If you are serious about the career it means moving to a location with game studios.  


If you love it but don't make it your day job, that is also an option. As a hobby you are unlikely to ever make any serious money from it even if you devote thousands of hours to the process. Your hobby game is unlikely to be seen by millions of people, unlikely even to be seen by hundreds of people. Even so, people do that, and everybody needs hobbies. 


If you love playing games but aren't really passionate about making games, that is fine too. People who love making games will make them for you to play, just like people who love designing aircraft will make your jets, and people who love designing automobiles will make your next vehicle. Those who create them will get their satisfaction knowing you enjoy using them.

#5313351 Unit Testing multimedia classes

Posted by on 30 September 2016 - 01:54 AM

I am developing a library, which provides facilities for cross-platform game development. My way of testing 'till now is/was like that: Does it display (or play the sound) as I expected, then it works. How would one test for these kind of results? I.e. how do I know, if I have a window actually being displayed on the screen?

There is a great book called XUnit Test Patterns, also available as a web site although I'm on mobile right now so no hyperlink. Edit: Now enhanced with hyperlink, go read, the reference has about 1000 printed pages covering everything you ever wanted to know about unit tests plus some other kinds of tests.

Unit tests for multimedia depend on the unit being tested.

If you would call a system to give it data, pass in a mock object and known data and verify that it makes the right call with the right data. If you expect to give the object a StreamingVideoPin object called svp, then you expect svp->drawframe(data) with specific data, provide a mock object and validate the results.

You may provide a mock object that ensures a windowing system has a window object as part of a unit test, but creating an actual window is part of an integration test if it is automated by screen scraping or similar, or a manual test to see if there is a window on the display.

You may have an audio stream and provide a mock object that represents the audio player as part of a unit test, but ensuring the sound is hitting the audio hardware is an integration test or a manual test to see if the human hears the sound.

Generally for automated tests everything except the final presentation can be covered by unit tests. That last layer of actual hardware doing the hardware jobs doesn't get unit tests, but may have integration tests if you really want it, or you can wait until QA or people complain. That last layer is usually a really tiny shim, and if you've done everything well then everything up until that layer has full automated tests behind it.

Finally, remember the actual results of unit tests isn't to ensure the results are correct, but to ensure the results do not change. Consequently tests usually are best for data being transformed into other data, where the tests validate the transformation. Next best tests are data in motion, where you can write tests that verify data moves through the pipe as expected.

#5313339 Cleanup and return from main in case of a crash or just display error message...

Posted by on 29 September 2016 - 09:21 PM

Going along with some of the above, there are many options, not just those two.




My question is how should I handle crashes in my engine code?


You fix the issue. If the code is crashing it is a critically serious A-level red-flag bug.  


How you get around to fixing the issue is up to you.


Game engines should never crash when used as designed.  If the person violates the design, perhaps passing invalid pointers or garbage values, the code's response should vary.



Leverage the fact that debug builds, testing builds, and final builds are different and can contain different error handlers.




If this engine crash is during development you want it to fail noisily and provide all the information needed to the development team.  This typically means a crash dump and a big ugly message. Write crash handlers for all the ways the program can die and make them create minidumps, and make it very easy for the person to get that minidump to the developer.  


In most of the professional world, a crash bug is a critical bug that prevents shipping.  If your game is being released on a game console then any crash will automatically fail the game certification process. When discovered this way the cost to a studio for a single crash is thousands of dollars. It costs time and salary to fix the bug, time and money to go back through certification, and possibly money if shipping dates are missed or in jeopardy.  Of course, a console game crashing in the wild can end up destroying the entire product, so don't do that.


Note that an engine non-crash condition doesn't deserve that same response.  During development you can provide big feedback to the developer that they are doing it wrong, abort the action, then attempt to continue.  It may be a big warning "Error parsing data file <whatever.json> line 123", or "Code is using graphics functions after D3D11 surface was already reported as broken. FIX IT! Ignoring graphics call."  During development you want these conditions to be called out visibly.





If the engine crash is during a product's maintenance cycle then you want it reported with all information needed to fix the bug. For game clients this typically means a crash dump and auto-uploading so you can correct and fix it.  For servers this often means a bunch of emails auto-generated to the dev team with the dump attached or referenced.


For non-crash conditions during maintenance your engine should attempt to fail gracefully.  This means you start logging the issues and provide a way to upload them.  This is commonly done by games that have a checkbox like: "Report anonymous usage statistics to make the game better"  If you don't run a server or can't run such a server in practice, this can be done with an exit handler that politely says "Problems were detected during gameplay, please email this log file to the developers" or something similar.



After you're done with product maintenance it doesn't really matter what you do.




Lets say D3D11 fails to initialize how should I handle that?


That is a known failure path, and it can happen for an enormous number of reasons. That should never be a crash by itself.


If your program is crashing due to this known and expected condition, that crash is a serious critical A-level red-flag bug.  Identify your bug and fix it.


If someone else's code is crashing due to this known and expected condition, if your engine has the ability to detect and stop the behavior it should do so as described above. During development that means hard-to-ignore messages that get the defect fixed, and after development it means providing methods for the program to be patched.


For known failure paths generally a return value is sufficient. That is how DirectX itself handles it, and how most other major libraries handle similar events.

#5312692 Bandwidth issues in Javascript?

Posted by on 26 September 2016 - 11:59 AM

Storing all the data in a map is going to be a speed problem, it is faster to use a simple array and index the values directly.


Storing your data as individual RGBA components then combining them to post at once is also a waste, as this is javascript there are no major processors out there that use anything else. You only need to consider endian values if you are saving or reading from a data stream that encodes it differently; endian-ness is only a concern of stream parsers and formatters.


I haven't looked to closely at what the transformation values are doing, but you may be able to take advantage of image filters in javascript or using one of the many transition operations rather than doing it yourself.

#5312609 Bandwidth issues in Javascript?

Posted by on 26 September 2016 - 12:06 AM

A zip file is lossless compression, that is, the thing you decompress is exactly identical to the input. This limits compression size. Also the zip protocol is quite old as far as compression goes, and there are many others that result in far better compression.

Web movies use lossy compression, that means when it is displayed on your screen it won't look identical to the input. There will be compression artifacts ranging from slight differences that require pixel-peeping to major differences like bands or blocks. Also newer protocols are being transitioned in and out, with Youtube gradually replacing its compression algorithms over time every few years.

Thanks to lossy encoding with aggressive compression, your high definition video can be compressed into a tiny bit stream. It will have tons of compression artifacts on your screen but as long as it keeps moving fast enough you generally won't notice or care about them. The video streams can be sent at single-digit megabit rates and visually still look good as they play.

But that doesn't really explain what you are trying to solve as your underlying issue. WebGL can handle drawing the screen, and assuming you're transferring only the data you need in a steady stream you shouldn't have problems with that part.

Repeating the question you've been asked several times but I don't see answered, what is the big thing you are trying to do? Your questions are about a solution you picked that isn't working out for you, so let's look at the real problem and find a better solution.

#5312353 target selection strategies

Posted by on 24 September 2016 - 06:27 PM

Quite a few games expose their AI techniques as far as the players go.  Often it is a long chain of tactical abilities.


Generally you have something in the form of {target}:{condition}:{action}.


So you might have a target of Enemy, Ally, or Self.  Enemy will scan all the enemies within a certain range of your base location. A monster may have their starting point and when nobody is in range they'll wander back to the starting point; friendly units should stay moderately close to the active player.  Ally targets should test against all your people in your party probably regardless of distance. And self should always be available.


Condition is generally any one of an enormous list. If it can happen in the game it belongs as a condition.  Values of health > x, health < x are common for healing abilities or for knowing when health is high. Abilities can be important, like Flying if you want spellcasters and archers to take out units others cannot, and you may want to target based on weapons of melee or ranged. Conditions like poisoned, injured, cursed, or whatever fits for your game are good. If your system has ranged effects then options of standing alone, cluster of 2, 3, 4, 5+ are good. Lowest health and highest health are good for choosing attacking. You might look at stamina or magic levels, you might look at class like boss or epic boss or minion or weak relative to the characters.  You also mentioned ratios of strength or magic or armor or whatever else you can think of.


Some games allow for compound conditions, either conditions from a small set or from the same set. This lets you add things like "...and not fire resistant" so you don't throw fireballs at a creature that either is weak against fire, or immune to fire, or worse absorbs fire.  Repeat for various other effects.  


Finally you've got the actions, which may be whatever actions the character has available.





do any particular strategies for target selection seem to be superior?   IE target: weakest first strongest first closest first greatest threat first (threat being perhaps a combo of atk, def, and short range) unit with highest atk to def ratio first



None is universally best.  There really is no most-winning strategy.  Sometimes you'll want one, sometimes you'll want another.




For minion monsters that are stupid and only have basic attacks it may be as simple as:

Enemy:Nearest Visible:Attack


For creatures, players, or NPCs who have multiple abilities each one should have triggering factors. Maybe something like:

Self:Health < 50%:Heal



... Self:{all bad conditions character can fix}:{solution for condition} ...

Ally:Health < 50%:Heal



... Ally:{all bad conditions character can fix}:{solution for condition} ...

Enemy:health < 10%:{big attack}

Enemy:clustered 3+:{range attack}


... Enemy:{something that makes sense}:{all abilities available} ...

Enemy:nearest visible:attack


You will need ways to activate everything in the character's arsenal otherwise it doesn't make sense for the to have it.  If the NPC is capable of throwing fireballs but no AI lines include throwing fireballs, they may as well not exist. Even better if there are multiple ways it may trigger.


Assuming every action has a cooldown time or takes magic or whatever to activate, the AI can simply start a the top and run down the list until it finds one to activate.  If nothing is appropriate, return back to the key location (near the player, or back to a waypoint, or whatever). 




For your list specifically, they can all work well.  Sometimes it will make sense to target the weakest first, particularly if you've got a ranged effect that is likely to kill off a bunch of the weak things and you want them out of the way, or also good for finishing off a group. Sometimes it makes sense to go for the healthiest first, although eventually they'll be damaged enough that they're no longer the healthiest and someone else will be targeted; that's useful if you've got a heavy hitter and you're trying to grind everyone down.  Closest first is generally a really good strategy and is generally my preferred default action; when you aren't sure what to do, hit the nearest enemy. 


In games with a party of people, generally you'll want different characters with different abilities doing different things.  The tank character should likely pick the highest level creature and hit them for everything, occasionally switching if they can combo with another like breaking a frozen enemy.  A healer should generally be busy adding buffs and healing team members, then throwing out debuffs and harm to enemies. A mage should generally be harming ranges of enemies and clearing out weaker characters. A thief character should be seeking out opportunistic attacks and backstabs against vulnerable targets, or using whatever abilities they've been granted in your game. Repeat for all types of characters.

#5312028 How to use Unit-Tests

Posted by on 22 September 2016 - 09:38 PM

Unit tests first and foremost are a way to ensure permanence.  They are there to ensure that when you provide an input, you get the expected output.  Normally it also checks correctness, but sometimes the tests don't test the correct thing.  Whatever they test for becomes permanent.


Therefore, testing mathematical calculations is probably not a thing that should be tested for every possible outcome.


Correct.  You want to test enough to ensure the function is doing the right thing, but you don't need to test every value.  Often that means testing both sides of boundary conditions, and perhaps an easy to verify value in the middle.


Generally in test writing you have a test that hits the happy path -- doing everything right -- then a bunch of tests that excercse all the error conditions.  


Also another key about unit tests is that they need to be fast.  If they hit a database, hit a file system, hit a network, they are not a unit test they are an integration test.  


I think, it would help a lot if you could show me a simple example on how to invoke unit testing into a tiny code example using a class and whatnot.


It is Java rather than C++, but I've seen this tutorial used several times for starting to build Tetris using test driven development.


You will need to adjust it to your preferred testing framework, but that is generally easy to do.


There's also this amazing book that is freely available as a web site, less of a tutorial and more of a reference, it works through common patterns and struggles in automated tests.

#5311921 Making a bot for a website in C++?

Posted by on 22 September 2016 - 09:13 AM

There are also tools like CURL and WGET that may satisfy your requirements.