Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


LorenzoGatti

Member Since 25 Nov 2005
Offline Last Active Today, 09:10 AM

#5223904 Is C++ RTTI good or bad?

Posted by LorenzoGatti on 17 April 2015 - 03:37 AM


The sort of situation where I would use dynamic_cast is where I'm using abstract classes for portability. For example I might have an abstract class called Image and a GlContext class with a pure virtual method uploadImage(Image *), and subclasses with implementations for SDL2 and Android (not using SDL2 for Android is another story). In the Android build all Image objects would be DroidImage and GlContext would always be AndroidGlContext. The implementation of uploadImage needs access to members of AndroidImage which aren't available in the abstract base, so it has to cast.
You don't need casting, because you don't actually need access to AndroidImage internals: you need a more complete separation between the generic and Android-specific parts of your code. Only Android-specific classes should be allowed to have variables with Android-specific types, while generic code like an uploadImage() function should be restricted to using Image, GIContext, etc. You probably need to add something to the abstract interfaces like Image.


I've implemented it in a base class Connectable, with derived classes Room and Region. The vectors of neighbours are of type std::vector. However, both Room and Region also need to do other Room-specific and Region-specific things with their neighbours, and it's better to reuse the vectors available in the base class and cast the members from Connectable to Rom or Region as appropriate than to maintain separate vectors of the subclass.

This is just a bad design; a Connectable interface doesn't make sense, because you are always connecting regions, which are aggregates of rooms, and some regions are allowed more than one outgoing door.




#5223641 Can i do this using the fourier transform?

Posted by LorenzoGatti on 16 April 2015 - 05:18 AM

What periodic signal or function are you trying to interpolate or resample in a mesh processing tool? Vertices, edges and faces are discrete; even if you want to subdivide the mesh the appropriate techniques involve interpolation schemes from a local neighbourhood of vertices, with no concern for symmetry.




#5223638 RPG Mechanics

Posted by LorenzoGatti on 16 April 2015 - 04:55 AM


However, I'm making a game that is about using strategic gambits to win a worldwide competition. That would require role-playing.

We're coming to a point. If this is the main feature of your design, focus on it.

  • What about the worldwide competition itself? is it a form of ritualized war, a very important sport (like ancient Olympics), something that important characters do but isn't really important itself (like the martial arts tournaments in Dragonball), a "gamification" of a real quest to fetch actually important objects, or something else? One way or the other, it has to matter, or it won't be the equal of more commonplace character-growth or save-the-world heroic plots.
  • What are "strategic gambits"? Start from elementary player moves, and find ways to build clever plans out of them.
  • Choosing the right answers in a dialogue tree is a puzzle, not role-playing. Indeed, Building a fairly arbitrary party of contestants, as opposed to being given some specific plot-ingrained characters, makes the characters generic and faceless.
  • Look at game mechanics from the point of view of the competition. For example, do you have combat (presumably not at all lethal) against the other contestants, which are the PC party's equals, or combat (presumably unequal and lethal) against a variety of enemies and guardians? Very different combat rules are needed in each case.



#5221842 Procedural maps, building interiors

Posted by LorenzoGatti on 07 April 2015 - 08:16 AM

An article from Siggraph 2014 discusses adaptable building templates (fitted to slightly irregular and non-rectilinear quad meshes). Doing the same on a tile-based map wouldn't be trivial, but it's a starting point.




#5221662 Procedural maps, building interiors

Posted by LorenzoGatti on 06 April 2015 - 12:14 PM

I suggest aiming the procedural generation significantly above the level of single rooms, defining building types with a standard layout. Assuming that you have good rules to decide what building type should go into each vacant lot, you need to adapt buildings to the available surroundings:

  • stretch standard rooms which have a flexible size
  • add extra rooms to fill large spaces (usually making other rooms smaller)
  • merge walls with adjacent buildings
  • surround the exterior with alleys, courtyards, gardens etc. when this building or adjacent ones need some space
  • choose basic floorplans of room clusters according to multiple choices to add variety

Respecting very strict building structure rules ensures that the building makes sense: no room is too large or too small for its purpose, you know what rooms are (allowing for easy procedural furniture generation), every building has the rooms it needs in a reasonable arrangement.

 

For example, a traditional Roman domus would have a flexible but almost square aspect ratio (let's say below 3:1), a rectangular shape (possibly, but rarely, with small indentations), a street-facing short side with an entrance in the middle, a passage into a rectangular half-covered atrium with an impluvium in the middle, pretty arbitrary arrangements of wall-to-wall rooms around the courtyard, normally a cloister and small garden in the back surrounded by other rooms, few or no corridors, few outward-facing windows and even fewer back and side doors, some traditional room types, etc.




#5220123 tcg card design method validation question

Posted by LorenzoGatti on 30 March 2015 - 01:54 AM

The idea of giving each card "100 stat points" implies that all cards have the same type: for example, all cards are creatures that can be sent into battle with other creatures.

This should not be the case: a more complex game should have vastly different and incommensurable card types. For example, along with minor types, Yu-Gi-Oh has monsters and "traps", Magic: the Gathering has permanents (including creatures and other types of useful things) and two (formerly three) types of one-shot spells, and many games have "resource" cards that are necessary but usually don't do much, like lands in M:tG, energy in Pokémon, stones in Force of Will, etc.

Varied cards allow for more complex strategies, which would be compared against each other on more abstract grounds: how many turns and how many cards to win, how easily can the plan be disrupted, what popular/likely deck types are strong or weak against this deck, and so on.

Even within a single card type there's ample room for strong and weak cards.

A typical pattern, common in M:tG, is that powerful cards cost more to play and there's a tradeoff between playing big spells to amortize the cost of spending a card by having that card do more, and playing cheap spells to make an impact in the early turns; M:tG deck design usually consists of fitting the most suitable cards to a list of how many cards there should be at a given cost.

Another pattern is using weak cards as a stepping stone towards playing strong cards; for example, many great monsters in Yu-Gi-Oh are played faster or exclusively by assembling, replacing, sacrificing etc.the appropriate entry-level  monsters.




#5219618 AI conquest deadlock

Posted by LorenzoGatti on 27 March 2015 - 09:02 AM

I think, going into direction of "even more smart" is pointless... Even if I manage to fix it and make it work, is it really fun? This Spock like strategy smile.png

Maybe go somewhere into realm of emotions? AI being afraid, hating someone, wanting to take revenge...

 

As a quick fix I guess I will make some sort of "tired" counter, it increases each turn you fight over that planet (and decreases slowly over time). If you are too tired fighting over a certain planet (reach certain thereshold) it gets desirablity halved/nullified. With exceptions, like you never will get tired defending your homeworld biggrin.png

Smart & cowardly races would have that thereshold lower (quicker to back off), which adds personality to aliens I guess.

An alternative approach, which depends strongly on game rules (fleet movement has to take enough turns): send a reasonably sized fleet to the very good planet, but reroute it to another nearby objective (or to retreat in extreme cases) if the good planet is too well defended, or expected to be when the fleet arrives. This way every fleet fights against appropriately small defenses, or retreats with little harm, instead of suffering unusual losses.

In case two large invasion forces meet, instead of mutually annihilating for the benefit of all other factions they would stop, conquer what they can from neutral parties and other sides, and gradually send away excess ships from places they don't want to fight at.




#5219256 AI conquest deadlock

Posted by LorenzoGatti on 26 March 2015 - 02:58 AM

The AI should consider the expected cost of conquering planets and the expected loss of leaving planets undefended and use, for example, a randomized strategy. If planet A is worth 50 and, being under attack by someone else, costs 40 to conquer right now, undefended planet B that is worth 20 and costs 10 to conquer is equally good and it should be chosen as an invasion attempt target with the same probability as planet A, or more often (possibly always) because planet A is an excessive commitment of limited armed forces.




#5219053 If you're familiar with both Harry Potter and Naruto...

Posted by LorenzoGatti on 25 March 2015 - 07:44 AM

With the premise of a teenager who's particularly gifted with some special power and leaves family to be trained and/or to use it, the most important element is the teenager's attitude, for which there are many traditional patterns:

  • Harry Potter has inherited a war, and he prepares for ending it with an heroic, self-destructive showdown; given his low power level he needs many allies and intermediate steps, and he doesn't make any significant plans about growing up and fitting into society.
  • The male protagonist in Infinite Stratos is just an idiot; although much more exceptional than Harry Potter, his only discernible purpose is being a decent student, which only incidentally involves fighting in earnest during a few emergencies. (Compare and contrast with Harry Potter's many genuine enemies, duels, murder attempts, etc.)
    What's "special" is the school itself: an academy for gifted pilots of T&A combat mecha is certainly more spectacular than, say, an academy for gifted fashion designers.
  • Naruto appears focused on developing into a powerful and mature ninja, and caring for his companions and his quests and missions is a large part of this lifestyle.
    How much he's gifted and exceptional has only a relative importance, since most of his challenges are about insight and force of will, not about power.
  • In Kill la Kill the main characters are very powerful from the outset, the protagonist begins as a lonely transhuman orphan with a mission and becomes progressively more normal, and plot advances mostly by revealing secrets, increasing power and raising the stakes.
    There's so little training and so little character formation compared to the development of strong ties between characters that it should be considered a borderline example of the genre.
  • In Gunbuster, Mobile Suit Gundam and many other similar series, protagonists aren't particularly special, but merely skilled; they are placed in tough responsibility positions by necessity or by coincidence, which naturally leads to themes like disgust for war and violence, accepting risks and sacrifices, occasionally drifting into madness, etc. 



#5218411 Projected Decals Stretching

Posted by LorenzoGatti on 23 March 2015 - 02:22 AM

Your projected decals look exactly like projections should, with the same extreme stretching you'd get from aiming a projector wrong into a room's ceiling and side walls: your problem is that you need something different.

To apply "stickers" onto surfaces you should use far smaller decals (more geometry but less fragments) and, for each small decal, use a projection vector that is approximately perpendicular to the target surface. In extreme cases, like "-X" in the last figure, no single direction allows good projection of a large decal and you might need to split it according to the target surface or to balance stretching of different portions.




#5218259 Armour & penetration

Posted by LorenzoGatti on 22 March 2015 - 09:45 AM


The WWII example is interesting, it sort of has a nice dynamic, as you end up with straight armor piercing rounds, armor piercing high explosive, high explosive and high explosive anti-tank. The first three tend to have a sort of rock-paper-scissor effect. The first round is great at penetrating, but doesn't hurt internals all that much, just pokes nice holes. APHE has less penetration, but if it does penetrate, does a good deal of system/crew damage. And then HE has terrible pen, but is good for unarmored targets, and is area of effect, and it also doesn't lose penetration over range and can be used for damaging external systems. HEAT is an odd duck of the bunch, and tends to mostly fall in the realm of being a better APHE, except not as good against certain armor types, in WarThunder it also tends to have terrible velocity.

No, there is no rock-paper-scissor relationship between different shell types because they have the exact same role: hurting what they hit, despite armour. With a single armour type (thick and tough steel) and no significant difference between the vulnerability of people and internal tank subsystems, the relationship between shell types and armour types cannot be more complex than the one-dimensional tradeoff that against better armour, shell designs that penetrate more at the expense of damage are more effective.

Such a choice of shell types isn't even necessarily relevant in the game, because:

  • Some shell types could be better in all respects than obsolete ones.
  • Some shell types could be preferable because they are cheap and plentiful. For example, if on average an enemy tanks is disabled after taking 4 AP rounds or 5 HE rounds and you can choose between going into battle with 15 AP rounds or 35 HE rounds, HE is likely better if getting shot at a bit more is acceptable.
  • Tanks don't necessarily carry different shell types.
  • Any available shell type could be too ineffective at a given size, requiring the adoption of bigger guns (as discussed in the OP), or conversely they could all be overkill.
  • Instead of switching to optimal shell types, tanks can switch to optimal targets. For example, if enemy tanks are very tough the tanks could usefully employ their mediocre guns against buildings and fixed defenses, leaving enemy tanks to infantry or artillery specialists with rocket launchers.

There can be rock-paper-scissor relationships beyond the narrow scope of armour penetration, in particular:

  • Focusing on a fixed budget, armour quality vs weapon quality vs number of vehicles. With the right realistic cost structure, swarming tends to beat weapon quality (the larger army shoots more against less targets), armour quality tends to beat numbers (as it virtually reduces enemy firepower and works better if one gets shot more), weapon quality can easily beat armour if good enough (taking advantage of armour effectiveness nonlinearities).
  • Focusing on the tactical level, armour weight vs gun weight vs being light and fast. The tank can expect to get hit and survive if slow and tough, to get hit less than normal because the enemy dies first if slow and well equipped, or to be missed if very fast.



#5217177 Dynamic Difficulty Adjustment

Posted by LorenzoGatti on 17 March 2015 - 04:15 PM

 

A situation in which specific levels can unpredictably become roadblocks, for example because many general skills (e.g. timing shots and judging distances for jumping) and game-specific skills (e.g. exploiting koopa shells and finding secret passages in Super Mario Bros.) might or might not be aligned between player and level, can be approached with suggestions ("Don't forget to use your flamethrower. It can be activated with button 2"), offers to run special tutorial levels ("Improve your aim at the firing range tutorial"), and difficulty settings, possibly allowing them to be set for each level.

 

 

Or there can be a “secret” passage that let's the player bypass the roadblock. Players will feel smart or happy for discovering this easier route, while hardcore players will love to take on the challenge. It can basically be a Skippable Boss, or an Easy Level Trick.

More simply, hard levels can be not roadblocks by not being on the critical path.

 

For example, Gemcraft: Chasing Shadows, a tower defense game, unlocks levels after beating other levels, lets one play any unlocked level at any difficulty setting, limits possible grinding, and "ends" after beating a certain level. Whenever the player is stuck there is a vast choice of other, quite different new levels and old levels that allow gaining experience point up by replaying on higher difficulty; eventually the player learns some tricks and/or levels up to be strong enough, and a level that was set aside is beaten.

 

Many games, mostly puzzle or action ones, adopt the even simpler scheme of freely choosing any level, or any small sequence of levels.




#5217034 Dynamic Difficulty Adjustment

Posted by LorenzoGatti on 17 March 2015 - 03:37 AM

The level that "got easier after the first couple times you died on it" is a very specific kind of dynamic difficulty adjustment, and in most situations not a good one:

  • It isn't very adaptive: what if the player was enjoying the retries and about to learn how to beat the level? Simple rules can guess wrong.
  • It is likely to be considered an insult: the game officially decides and announces that the player isn't good enough.
  • It can be easily perceived, even subconsciously, as a limitation of player freedom: the game closes access to the "true" version of the level.

A situation in which specific levels can unpredictably become roadblocks, for example because many general skills (e.g. timing shots and judging distances for jumping) and game-specific skills (e.g. exploiting koopa shells and finding secret passages in Super Mario Bros.) might or might not be aligned between player and level, can be approached with suggestions ("Don't forget to use your flamethrower. It can be activated with button 2"), offers to run special tutorial levels ("Improve your aim at the firing range tutorial"), and difficulty settings, possibly allowing them to be set for each level.

If the difficulty settings affect something simple and obvious, like increasing a time limit or making the character less vulnerable, instead of "corrupting" level features like enemy placement or obstacles, the player will be more confident at switching to harder difficulty when ready..




#5216249 Multiside space battles

Posted by LorenzoGatti on 13 March 2015 - 05:39 AM

If the battle is turn based and the display is abstract (stacks hurting other stacks) rather than spatial (ships aiming, shooting, moving into and out of range) you can display the stacks of the active faction in the middle and all enemy stacks around the borders of the view, with arrows or the like connecting attacking and attacked stacks. The enemies can be sorted conventionally (e.g. factions in alphabetical order by name clockwise from the upper left corner, stacks of each faction by size and age), the active stacks could be sorted according to graph layout heuristics (e.g. in a circle, about in front of the enemy they are attacking). You could then display nice animations of moving stacks between turns.

 

You might also go further with graph layout approaches, for example starting with all stacks around the border as above and pulling together two stacks when one attacks the other, resulting in stacks drifting close to their specific enemies over the course of multiple turns without large movements.




#5215626 x86 / x64 and the crazy conditional moves based on flags

Posted by LorenzoGatti on 10 March 2015 - 04:41 AM


I understand that a conditional move based on equality "maps" to c or c++ code like

,,,

but what about operations based on register flags like the carry flag? I understand the use of the zero flag for loops etc but instructions like cmovc and cmovp have me puzzled how they can be used practically

 

You try to reason about assembler at the wrong abstraction level; machine instructions have a direct and simple correspondence with high level variables, arithmetic, loops etc. only in easy cases, and optimizations (like using conditional move instructions rather than jumps and plain moves) tend to depart from the easy cases.






PARTNERS