Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Nov 2005
Online Last Active Today, 02:00 AM

#5292593 how can neural network can be used in videogames

Posted by on 20 May 2016 - 03:08 AM

It's interesting to see that the consensus regarding NN in games seems to be changing.

Consensus is a strong word. The recent developments of neural network algorithms and computing power are extending the range of things a reasonably expensive NN is good at, but whether they overlap with the useful AI tasks needed in a certain game depends on the specific case.

#5292020 Difference Between 2D Images And Textures?

Posted by on 17 May 2016 - 02:50 AM

As assets, an "image" is usually meant to be displayed very faithfully and with little processing, like the mentioned sprites and prerendered backgrounds, while a "texture" is meant to be used for texture mapping and therefore displayed with extreme deformations and transformations and drastically affected by the positions of lights, objects and cameras.

#5290824 Is using the Factory or Builder pattern nessesary?

Posted by on 09 May 2016 - 10:45 AM


Yeah, that ^^ :D


Patterns should never be a play-book for writing code. Patterns are, well, patterns in code that just so happen to have been repeatedly reinvented, at which point people recognised the pattern and assigned a name to them to make discussion easier. You should look at lists of patterns more like a traveller's dictionary, and less like a cookbook.


A software engineer should strive to be comparable to a chef who writes cookbooks -- not a machine that only knows how to follow them.


Well put! :D


So, if I don't want to, I shouldn't use the factory/builder pattern "just cause"? Correct?  As stated above there should be a legitimate reason to implement it.


Many thanks for the reassurance.


In your humble opinion, is doing this:

International international = new International(id, firstname, lastname, documents);

Okay? Given that it accomplishes what I need, and I fully understand what it does.


It's not a matter of "wanting": without the proper context of many similar classes and of client code that is content with some abstract interface but somehow doesn't care about some details of their creations, writing a meaningful factory is impossible because you don't know.what the factory can abstract and hide compared to directly calling constructors.


(It goes without saying that in your example you have either only one class, ("International", which should be just "Client"), or completely unrelated ones without a real common interface, and there's no apparent way to create your objects without passing all data up front)

#5290757 Is using the Factory or Builder pattern nessesary?

Posted by on 09 May 2016 - 01:27 AM

If I understand correctly, you are complaining about Client having a list of documents which is not used in the case of domestic clients. If domestic clients having documents is something that doesn't make any sense, then I see your point. I would need to know more about the exact context in which this code is being written to make a judgement, but it seems to me it's more like "we don't currently have a use for the documents in the case of a domestic client", but that sounds like something that may change tomorrow.

It sounds like a boneheaded "optimization": crippling domestic clients by removing their container of documents allows the grand architects to maintain a simple implementation in addition to the general one that's known to be needed for international clients.


What's really different is what to do with different document types and clients having different combinations of documents, which might involve several document classes (not too likely, but possible in principle if documents have nothing in common) but not different client types (what documents they have is a detail of their state, and likely a mutable one: constraining clients with a class that can have no documents is obviously wrong).

#5290384 What does the "Most Constrained" heuristic mean?

Posted by on 06 May 2016 - 02:13 AM

It should be noted that it is an heuristic, and a cheap and dangerous one. There is no guarantee it approximates the optimal course of action, because it doesn't account for action utility.


In the example, if Mr Armor is a minor threat (e.g. he needs a free hand to fiddle with his phased force-field device and therefore he's armed with a little knife) Mr Rifle should shoot (like everyone else) the most dangerous enemies instead. After successively switching to generic enemies of decreasing priority, Mr Rifle should start shooting Mr Armor when it becomes more useful than contributing to killing another enemy faster. Meanwhile, the rest of the team switches from the last enemy they could attack to protecting and supporting Mr Rifle, since it's the most useful action they can perform.

On the other hand, if Mr Armor has a very high priority (e.g. he throws phased force-field grenades) everyone should target him; of course Mr Rifle figures out he can do it, while the rest of the team, knowing that they cannot attack Mr Armor, can either protect and support Mr Rifle if it's useful enough or attack generic targets; no need for a premature heuristic decision.

#5289854 Procedural Universe: The illusion of infinity

Posted by on 03 May 2016 - 02:16 AM

Rendering a whole universe of randomly generated stars amounts to a skybox. Whatever the player does in the game, it will be at a negligibly small scale compared to the displacement that's needed to notice any parallax error in the skybox. Only a few objects are close enough to require less cheap rendering.

I would prerender various skybox layers as much as possible: assuming we are around Earth, Moon, Sun and of course Earth and close space stations might need true realtime rendering; but Solar system planets could be a skybox layer (valid for a few minutes because they are moving); then individual visible stars and other small objects, valid for a large central region of the Solar system; Milky Way background, valid for a vast region of the Milky Way that probably exceeds the scope of a reasonable game; and finally close enough other galaxies. When the player goes to Mars, redraw satellites and planets and constellations as a luxury.

Quantitatively, bright objects are likely to be more expensive to generate according to fancy distributions than to render without storing them permanently; and if you have enough memory to display one skybox set and render future skyboxes to offscreen buffers you can easily brute-force billions of randomly generated stars over the course of a few minutes instead of doing something complex and approximate to draw a boring starfield in real time.

#5288758 OOP and DOD

Posted by on 26 April 2016 - 09:30 AM

One of the reasons that DOD is still relatively unknown outside of certain areas (game programming, high-performance computing) is because it solves a very specific problem: memory access bound performance.


But for the vast majority (IMHO) of software written today, CPU/memory bound performance is an order of magnitude less important than the much lower bandwidth issues (data access, network access, etc).


Most "typical" business software spends its time waiting for database queries or REST APIs to complete. If DOD improves your algorithm even by 1000%, that's not going to help much if the total time spent waiting for process x to complete is 90% dependent on a high latency process.  


I'm not arguing against DOD; it's very good for it's intended purpose. I'm simply attempting to explain why it's not more widely known.


But IO-bound software struggling between external systems and memory requires the same optimization techniques and principles as software struggling between memory and CPU: read data sequentially or at least in large pages, read data only once (if possible, never), organize data so you don't waste bandwidth reading unneeded data because it's interspersed with data you need, don't waste time and/or space storing redundant information that can be recomputed inexpensively from a small working set of data, and so on.

Apparently different techniques, like normalizing the structure of a relational database and organizing data structures in memory as "structures of arrays" actually serve the same purpose in the same way.

#5285229 Polymorphic uninvolved parenting?

Posted by on 05 April 2016 - 04:25 AM

Typically, UI widgets have a dual access (with base and derived types), in clearly separate places, and any casting is a very serious code smell.


Parent widgets and general functions like redrawing and event processing own and process received widgets through a base or intermediate widget type, call virtual methods and never cast widgets to derived types because they should never care about the difference.

For example, hierarchical layout of child widgets is usually managed in some intermediate "widget with children" class, which can be abstract, and which queries child widgets about what size they want to be through functions in the base widget class.


On the other hand code that creates widgets knows their types exactly, allowing the use of any constructor of any widget type (a large part of code that needs a specific type), and allowing specific types in calls to some special function. No casting needed; on the contrary, you normally pass widgets from variables of the most derived types to functions that demand a less constrained type, gradually or completely forgetting the concrete types where they are irrelevant.

#5284999 Hierarchical pathfinding. What does it mean to me/us?

Posted by on 04 April 2016 - 04:43 AM

What do you mean by portals, clusters, "abstract" paths and "on rails"? Are you asking about theory, about some library with an uncertain name, or about something in your application?

A better effort to express yourself in English appears necessary.

#5282292 My design idea - contains many elements

Posted by on 21 March 2016 - 02:22 AM

For example, game design issues include zoological issues. A "realistic-looking" bat character doesn't seem suitable for "standing on two feet" (bats ordinarily hang from above, mostly head down), or "moving as fast as Mario" (it might cautiously crawl on all fours), and it certainly can't "punch, kick and butt-stomp" effectively with its light frame and delicate little claws

But above all, why would a bat accept to confront a platformer game on its own terms, walking, jumping and exchanging blows, instead of flying and attacking in flight?

#5281641 conservative advancement help

Posted by on 17 March 2016 - 05:51 AM

It seems that the purpose of your function is to "move" c1 and c2 from their state at time t0 (by altering their pos members) returning true if they have a collision, and in that case advance them only until they touch.

At first sight it's reasonable, but you discard the most important piece of information: when do c1 and c2 collide? Instead, you should return t, how long c1 and c2 were able to move without colliding.

Given the maximum advancement time step T (it can be a constant, or a relatively read-only global variable, rather than an argument of your function, but hardcoding T=1.0 like you do is quite messy) the calling code knows that If t = T the circles can advance without colliding; while if t < T they collide after moving for a time t. 


The other great misunderstanding is that there are more than two objects. Conservative advancement is advancing the simulation from an initial state to when the next collision happens or by the target time step T, whichever happens first; then resolving the collision (causing some objects to change velocity, cease to exist, etc.) and repeating until the sum of the conservative advancements reaches T and you can draw the next frame. Clearly the t values you use need to be the minimum of all pairwise collision times, and you cannot commit an advancement until you know no collisions precede its end time: if c2 hits c3 before when it would hit c1 if c3 didn't exist, the collision time between c1 and c2 is invalid.



Other logical errors, like having a while loop, not initializing vel_bound, using distances between circles rather than between capsules, moving only c1 but not c2, using relative velocity rather than the actual velocities of c1 and c2, while serious, are quite irrelevant.


Suggested changes, assuming pointLineDistance() takes three Vec2 arguments, the single point P and the endpoints A, B of the segment, and returns the distance between P and AB and p such that the closest point to P on the segment is A+p*(B-A); 0.0<=p<=1.0.

//add const and constexpr to taste
double possibleAdvancement(Circle *c1, Circle *c2, double T){ 
    Vec2 rel_vel=c2->vel-c1->vel;//c1 remains still
    std::pair<double,double> distance=pointLineDistance(c1->pos,c2->pos,c1->pos+T*rel_vel);
    if (distance.first<(c1->radius+c2->radius)){
        return distance.second*T;
        return T;

#5277852 Interstellar trade at a relativistic timescale?

Posted by on 24 February 2016 - 03:39 AM

Using relativistic speed space travel only for a single point to point 1/12 year trade route between Sol and Tau Ceti is an unnatural constraint on the use of technology.

Instead, I would expect spaceship owners and spaceship crews to find something useful to do with their vehicles.

  • Extra worthwhile stops at less terrible distances. Destinations could include other colonies on less habitable planets, completely automated operations (e.g. asteroid mining), and maybe some kinds of major artificial space stations (e.g. deep space military shipyards, with lots of people and large deliveries of various resources). Reduced travel times (e.g. 1/12 months) mitigate all problems, allowing flexibility and stability without creating an obstacle to those who can accept, or desire, the "time travel" of a long trip.
  • Exploration, including SF staples like prospecting for minerals and contact with alien races, at all scales of time, cost and organizational complexity: a casual detour of a few days to investigate a mysterious sensor reading, fanatics or amateurs who go "out there" with their own means, systematic public initiatives.
  • Living on ships permanently as a nomadic lifestyle for whole families and tribes, with little interest for the landlubbers they leave behind in fast time. It could be the lifestyle of the vast majority of mankind, stabilizing society from the bottom up because everyone is away and any change or initiative needs years to spread.

#5277571 Free painter program with transperent color

Posted by on 23 February 2016 - 03:04 AM

Depending on what you need to do:

  • Krita for painting, particularly with a tablet; very good with layers. 
  • Inkscape for vector art (including rendering images at any resolution you need for use as sprites and further editing) 
  • Gimp for low-resolution pixel art.
  • Gimp and Paint.Net for generic less creative editing tasks. The main difference lies in plugins: both have plenty (ranging from half-assed experiments, to simple and practical, to refined workhorses), but Gimp also has G'MIC, which should be enough for everyone, while Paint.Net has a significantly advantage if you want to write custom plugins (.Net, and the Codelabplugin development environment, rather than Scheme or Python or C with an irksome API).
  • Shoeboxfor various specific tasks.

#5275935 Parameters for pricing upgrades

Posted by on 16 February 2016 - 09:13 AM

If you have a time limit, it can be used to calibrate the price of an upgrade: at an higher price, the upgrade is bought later and it provides less value because it is active for a shorter time. Increasing the price shifts the upgrade from overpowered to good to unimportant to counterproductive; make it competitive with other ways to spend money. You can also make the upgrade cheaper and weaker, or stronger and more expensive, to assign it an early game vs. late game role.


For example, if the factory upgrade lets you create a widget worth $10 every 8 seconds rather than the normal 10 seconds, it's worth $10 of additional income (one more widget made) every 40 seconds of production. If it costs $200, it costs 20 widgets, i.e. all income from the first 200 seconds of the game, and it will be amortized to a net value of 0 after 800 more seconds when it yields the 20th extra widget. If, as plausible, the game lasts less than 1000s, $200 is too much. On the other hand at $100 the upgrade would be bought 100s into the game and amortized at 500s; with a longer time limit it would be slightly useful (e.g. a maximum net value of $20 with a time limit of 10 minutes).

#5275543 Polynomial Forms of SH Basis

Posted by on 13 February 2016 - 08:06 AM

Spherical harmonics are used in linear combinations: any arbitrary sign choice for the basis functions simply flips the sign of the corresponding coefficients with no practical or theoretical consequence. Different authors might prefer different sign choices.


By the way, if you ask people to discuss specific papers rather than a general topic, you should cite your references properly with the exact title and authors and/or a download URL.