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!


Member Since 25 Nov 2005
Offline Last Active Yesterday, 09:03 AM

#5146184 Need some pointers on a diplomatic AI

Posted by LorenzoGatti on 11 April 2014 - 02:20 AM

The different factions have the following tools to interact:

Declaring war for a specific neighboring sector
Giving gifts / send diplomatic ship to improve relations
Insult to lower relations
Trade agreements (allowing ships to buy/sell from other factions assets)
Passage agreements (using jumpgates from other factions to get to their sectors)
Military/Alliance agreements (both factions using military ships as one)
Give/sell/ask for a sector to improve relation or get money or remove a threat

Each faction has values that can be used: diplomatic power (how persuasive is a faction), xenophobia (how resistant is a faction to offers from another (to balance diplomatic power), how warlike or "tradelike" is the faction and so on. Most of it heavily influenced by 4X games.

Going to war is easy, but for the rest, like making alliances, allowing ship passage / trading and so on in a believable way, I am kinda lost. I don't really see a sort of generic algorithm that would make AI controlled factions using diplomacy without relying on a nightmarish mess of nested If/else/if/else. While I am fairly used to FSM logics which i used (to an extend) for individual units I don't really see that working on a faction level.

The major problem I see in this description of diplomacy is that most of it consists of arbitrary abstractions and ritual behaviour and it doesn't lend itself to translation into rules and game theory (which you need to have an AI that reasons in meaningful ways). 

If factions are interested in their own prosperity (as opposed to hurting themselves to hurt others more, e.g. going to war) they can simply be friendly with everybody: reciprocal trade and passage agreements, occasional fair exchanges of territories for good reasons, massive military alliances (marking the few rogue factions outside the alliance as a potential threat), no wars, no gifts, no insults, no bad relationships, no persuasion, no xenophobia. Strategy would consist of being ready to go to war with neighbours that aren't in the alliance in case they do something funny.

This style of AI would have to evaluate the economical benefit from trade and passage agreements (maybe a Monte Carlo simulation of commerce and travel with and without the agreement) and the best selection and deployment of military forces (maybe more suitable for thorough searching over move trees containing fleet movements, battles etc.).

#5145604 Pirate RPG class design

Posted by LorenzoGatti on 09 April 2014 - 02:23 AM

Almost any kind of spell would be highly useful for piracy as a job: illusions to mislead ships, fireballs etc. to threaten a whole crew, mind-affecting spells to make defenders ineffective, portals into the storage areas to loot without the hassle of a proper battle, offensive and defensive buffing to prevail in combat, etc. Magical countermeasures against piracy would be equally varied.

Your pirate class, on the other hand, isn't focused around piracy, it is focused on the sort of ship-to-ship personal combat required by a specific mundane style of piracy that would simply not exist in a world where magic is common and is a better way to fight at sea. 

You need a compromise between swashbuckling and magic: magic should be carefully limited so that it doesn't affect piracy enough to make combat useless.


For example, if almost any seaman could shoot decent antipersonnel magical attacks beyond cannon range, artillery would be obsolete (not a great loss) and engagements would begin with a possibly brutal shootout (not unlike the airship battles in the Last Exile anime); assuming magical energy runs out and there are no other common spells the engagement would proceed normally to boarding and evasion, with less ship damage and likely more wounded people than in real-life piracy (not affecting combat style too much).

If the same kind of magical shooting were a rare ability, high level pirate crews would hire a sniper and the sniper would pick off officers unopposed (or, rather, threaten to do so: what captain wants to order an attack knowing that he's going to be incinerated before seeing the outcome?).

Many targets would try to run faster than pirates or surrender because they can't, while rare and privileged targets would bring their own wizard sniper to put up a fight (usually causing pirates to retreat).

#5144042 Looping a sound with reverb causes a "pop" at loop

Posted by LorenzoGatti on 03 April 2014 - 02:25 AM

If you have the melody w/o the reverb, make a loop of it 3 times, run it through the reverb, cut the middle one and use that. It will have the end of the reverb of the first melody, which should be enough.

Even better, play the original clip once before repeating the variant with added reverb: the beginning of the music shouldn't have a reverb tail out of nowhere.


Also, verify that reverb tails are shorter than your music clip; you might need more than one repeat to reach a steady state that allows looping.

In the editing technique suggested by TheChubu, the second and third repeat in the output should be identical; alternatively, if you process with reverb one copy of the music followed by silence you can directly measure how long does the reverberated output take to decay to silence.

#5143407 Thesis Advice: Narrative Game with Imported OTHER Player Character

Posted by LorenzoGatti on 31 March 2014 - 01:34 AM

You need a suitable premise and character relationship structure in which:

  • An arbitrary number of characters can be added without great consequences (up to the expected number of "new game plus" iterations, but degrading gracefully beyond that).
  • The additional characters are substantially similar to the player character. More precisely, the player character of the previous iteration: if players can choose between different playable characters there could be different classes of "reincarnated" characters.
  • The additional characters have a "personality" that the player can perceive and understand. This probably requires the cast of fixed characters to be based on similarly complex emotional/cognitive models. What important and meaningful actions can such characters use to express their personality?
  • Character personalities can be inferred from player actions. You need to guarantee that the player performs enough measurable actions to gather the necessary data over the course of a game (including short and/or unsuccessful playthroughs).

I suggest a setting with a socially uniform large mass of somewhat varied characters, from which the player character and the "ghosts" are selected: the fraction of important characters with a role in the story can increase (but remains small) in successive playthroughs without actually adding people.

For example, recruits in military training, pupils at a boarding school, construction workers on a half-finished space station, convicts in a prison, etc.

#5142536 90´s Platformer Collisions

Posted by LorenzoGatti on 27 March 2014 - 05:41 AM

Regarding the specific questions:

Should SAT be overkill for this?

It might or might not be a good choice of clever algorithm for "phase 2".

Should I represent the characters as circles, and check if they hit a line segment?

A convex polygon or (if the character isn't convex) a simple polygon is going to be much more suitable for a character than an ellipse; rounded corners can cause the character to stand in a wrong position, something quite unacceptable in a platformer. Ellipses are popular collision shapes for bullets, which are actually round and tolerate some approximation because they explode on contact.

#5142512 90´s Platformer Collisions

Posted by LorenzoGatti on 27 March 2014 - 02:40 AM

I suggest starting from the rules, and optimizing geometric acceleration structures later.

You can implement a generic query (e.g. what platform segments, at what time, and from which side intersect this object if it moves between these two positions) in a simple, inefficient and obviously correct way, use it as the foundation of a complete collision detection system that does what you want (e.g. one-sided barriers, sliding on slippery surfaces, etc.), and when you have refined your requirements try optimized, more complex and less general algorithms.

#5141643 There got to be a better way to manage animations.

Posted by LorenzoGatti on 24 March 2014 - 02:20 AM

Your animation management appears to be a finite state machine, which doesn't need to be hardcoded with constants and ifs and enums.

Instead, you should define a data structure to represent animation definitions, loaded from external files and processed by a generic animation manager. Your current ManageAnimation method is in class IActor, but it isn't generic: it assumes a number of states and events exist.

#5140040 Assets for tech demos

Posted by LorenzoGatti on 18 March 2014 - 09:59 AM

On https://graphics.stanford.edu/data/3Dscanrep/ there are several very large and mostly untextured models that are used in many scientific papers. The "Stanford Bunny" and the "Armadillo" should be particularly suitable for a demo.

#5138909 Controlling difficulty in a randomly generated game.

Posted by LorenzoGatti on 14 March 2014 - 05:18 AM

In demo 17, the player's speed is ridiculously slow.

Inertia adds severe difficulty to any shoot'em up: get rid of it, nobody wants to drift into a bullet because he dodged another.

Variable player speed is just asking for trouble; most players will try to play without adequate speed boosts and will be disgusted.


Firepower should be proportional to enemy amount, typically requiring powerups or a constant number and toughness of enemies. Otherwise even the best player cannot shoot down enough enemies to stay afloat.


There's no reason to restrict movement to 1 dimension, unless you are doing something similar to Space Invaders (i.e. keeping the player in the appropriate place behind shields) or the ship moves on explicit rails.

Dodging bullets and hitting targets is much more difficult in one dimension; Space Invaders compensates the problem with extremely predictable enemy and bullet movement..


#5138872 (mingw/winapi) growing exe size when linking to psapi

Posted by LorenzoGatti on 14 March 2014 - 02:04 AM

Increasing the total linked size by over twice the size of the added library is completely abnormal. I guess there must be some other source of code, such as

  • C++ template instantiations that you use to call the new functions
  • potentially large pieces of whatever libraries this "psapi" depends on


There are plenty of tools to list the content of an executable file: they should allow you to see which sections grow and which sections remain the same between the two versions of the program.

#5138405 Pokeclone mechanic opinions...

Posted by LorenzoGatti on 12 March 2014 - 08:16 AM

There's a serious balance problem: bias towards getting stronger monster than their parents causes grinding, bias towards weaker monsters makes breeding useless.

I would separate power level (starting low and fixed because it's a junior monster, and increased by training, special treatments etc.) and statistics/features (scaling up as monster power increases).
The "genes" could contain weights for stats, proportional to "baseline" stat values (excluding the increases that contribute to a trained monster's actual values); inheritance could give the offspring the average between the weights of each parent, plus some random noise, with initial stat values obtained by normalizing weights and multiplying for some constant. This way one could breed, for example, two monsters with high strength to get offspring with high strength, possibly even higher than either parent, but at the expense of other stats, making all offspring equally good (and as good as the parents).
Players would breed (and train appropriately) monsters with particularly unusual stats for their race in order to adapt to specific opponents or to support specific strategies (e.g. enough stamina to do a certain powerful attack one more time per fight), not to get more powerful monsters (which should involve training, experience and new monster acquisition).

#5137753 Best projects to learn OpenGL from scratch?

Posted by LorenzoGatti on 10 March 2014 - 03:34 AM

An even more basic exercise: setting up windows and contexts, with proper error handling and without stupid assumptions. Extra credits for multiple windows.


If you learn to tread carefully and check for errors, you will be ready when you have something serious to debug.

#5137749 Pricing a side-scroller game!

Posted by LorenzoGatti on 10 March 2014 - 03:28 AM

It depends on the market. A honest comparison with other games of similar type and quality will provide reference prices. 

#5136519 How to design spaceship missile combat?

Posted by LorenzoGatti on 05 March 2014 - 08:32 AM

Another angle on using cards: use them to represent resource or move allocation.

Assuming a reasonably small number of active nuclear missiles, fighters, bombers etc. for each immobile capital ship (like the engagements in Battlestar Galactica), each can be a token in a "battlefield" area and players can put face down cards next to them to represent their actions and interactions.

For example, there can be two decks per player, with different backs to sort them apart, one deck containing appropriate proportions of fighter or drone maneuvers like "quick dodge" (good against lasers), "evasive maneuver" (good against guided AA missiles and ramming), "ram enemy" (suicidal) and one deck containing attacks like "nothing", "shoot guided AA missiles", "shoot laser", "launch missile", "launch fighter", "recover fighter".

The players would draw cards depending on their assets, e.g. 1 maneuver per missile, 1 attack per AA battery of the main ship, 1 of each per fighter, and place maneuvers next to the unit that performs them and attacks next to the target.

Combat resolution can count cards to find the number of successful attacks: for example, after a missile receives 2x "quick dodge" from its owner and 1x "AA missiles"  and 3 "laser" from the enemy, the missiles and 1 laser shot hit.


This sort of system can be enhanced with a slightly structured battlefield: for example successive zones that fighters and missiles can occupy between the capital ships (allowing enough time to deal with missiles and making maneuvers like "go forward" and "go back" meaningful) and/or aiming missiles at different parts of the capital ship (allowing some prioritization for the defender and "switch missile target" maneuvers for the attacker).

#5133896 data compression

Posted by LorenzoGatti on 23 February 2014 - 11:58 AM

Data compression means finding an alternate, smaller representation of data.

"abcabcabc" --> "3|abc"

This is all there is to explain about the principle of data compression: if you have strings of lowercase letters you can write out repeated substrings longhand (not compressed) or write them once with a repeat count (compressed). Of course you need to know whether Aphton encoding is being used and have an implementation available; the cost is usually amortized over the savings of compressing a lot of data.