Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 25 Nov 2005
Offline Last Active Yesterday, 01:29 PM

#5095120 How to Design Tile Sets

Posted by LorenzoGatti on 19 September 2013 - 02:29 AM

Design prototype maps and tiles on paper. For example, if you have caves,
  • sketch a few caves in the style you want,
  • think where you could slice them into tiles and what transitions between basic tile types (e.g. cave walls, with different facing and possibly with different slopes) you need
  • decide what parts of the drawing can consist of repeated tiles (e.g. flat cave floor, in dry and wet varieties, and vertical wall) or need unique multi-tile structures (e.g. in a multi-tile stalactite and stalagmite pair you can repeat only the empty gap),
  • sketch the tiles and try assembling them together to test what constrained caves can be built from them,
  • fit optional stuff to the tile grid (e.g.tunnel entrances: 1, 2, 3, 4, 6 tiles? Or even bigger?)
  • invent variations of very common tiles (e.g. different bumps and rocks in flat cave floor tiles),
  • and only when you know what tiles you need draw a tileset on the computer.

#5094945 Food, wood & gold, still works? (strategy resource)

Posted by LorenzoGatti on 18 September 2013 - 08:57 AM

In a Civilization-like game, you can have as many resources as you find uses for; each one contributes some realism, and/or a gateway for the subset of research trees and things to build that require them.

Every town will have only a limited number of mineral resources nearby (forcing exploration and colonization), a limited space for growing crop resources (forcing a choice), and often too few workers to get all possible resources (there are other jobs).

To avoid crossing the line between carefully optimized production planning and frustrating lack of resources, reducing and simplifying resource demands (e.g. basic catapults require 2 wood units each rather than 3 wood and 1 iron) is more effective than limiting resource types.

You can also play tricks with resources at the strategic level: for example, if you put all of one mineral in a small place (e.g. large natural diamonds in South Africa) and the mineral is necessary (e.g. large natural diamonds as a prerequisite for advanced microelectronics and indirectly for really powerful computers, AI, robots and space travel) a ferocious war, and an advantage for the player who plans ahead, is guaranteed.

#5094415 Magic in RPGs

Posted by LorenzoGatti on 16 September 2013 - 04:26 AM

Fantasy fiction has many examples of settings in which magic is rare or at least beyond the reach of ordinary characters.

Your game could include magic only as ad-hoc plot points (e.g. your mission, if you choose to accept it, is to throw this ring into that volcano, and please don't put it on) rather than as a tactical or strategical character resource. You already seem to have enough skills and combat options without adding magical ones.

#5094000 Trying to write a smoothing algorithm for meshes

Posted by LorenzoGatti on 14 September 2013 - 08:31 AM

Consider the requirements of your smoothing:

  • What do you consider smooth or not smooth enough?
  • Do you have sharp edges that should be preserved?
  • Do you need to compute sensible texture coordinates to keep the old textures without distortion? This usually means preserving angles (a conformal mapping).
  • Do you care about preserving the volume, area or length of parts of your geometry? For example, lengths determines whether an object can pass through a hole, areas determine the size of shadow and occlusion cones, and volume determines mass and buoyancy in physical simulations.
  • Would you like to preserve mesh structure exactly because it's important and/or to allow the use of simpler algorithms?
  • If not, do you need to collapse redundant or noisy geometry, add vertices to get more rounded shapes and a more regular subdivision, or both?
  • Do you want to limit the distance between the original and smoothed surfaces, or other error measures?

#5093737 Feedback - Benchmarking XML Reading

Posted by LorenzoGatti on 13 September 2013 - 02:40 AM

Writing a XML parser as a learning experience makes sense only if you want to become a XML *expert*, which I presume isn't your purpose. Your code has nothing to do with XML parsing: it tries to parse a specific file with extremely specific assumptions (e.g. tags at line start), with the effect of being dangerous to you (what if the file changes?) and counterproductive towards learning actual XML. So you should really, really use a library to load the COLLADA files you need in a robust way; if you want to do something related and useful, and acquire some modest but valid knowledge of XML, I suggest writing XML files instead (saved game configurations, tool output, etc.).

#5093234 IDE for C++ Programming

Posted by LorenzoGatti on 11 September 2013 - 02:50 AM

to be honest.. I doubt that with 1gb of ram running win7 64 you'll be able to see improvements.

Not only having 1GB of memory excludes Eclipse, Netbeans and probably Visual Studio from consideration, but you might run out of memory while compiling and linking programs irrespective of the tools you use.
Sacrificing programs (e.g. not running a web browser) to spare memory is going to be horrible.

Invest in a good laptop with a SSD and at least 8GB memory, then run anything on it.

#5093229 Strategy pattern.... am I on the right track?

Posted by LorenzoGatti on 11 September 2013 - 02:38 AM

IAdd is very oddly named, both because "add" is a verb and because moving units has nothing to do with adding.

#5093223 Other name for "Space Police"

Posted by LorenzoGatti on 11 September 2013 - 02:09 AM

There's absolute dictatorship and absolute dictatorship.


Bureaucratic names, the prevalent style in the suggestions so far, imply a stable and mature government in which a succession of people fills an established Emperor role.


To imply a recent and serious change police can be named in a variant of bureaucratic style that references "revolution", like in Iran and China, or something similar ("progress", "renewal", etc.) or the specific political entities and politically charged words of a specific revolution, like "soviets", "workers" and "people" in communist countries.


An autocratic conqueror who really founds an empire from scratch might have a "police" that evolves from his/her/its faithful followers and is named in peculiar ways (possibly unofficially). Characters could be scared of the proudly visible "purple shirts", the brutality of the "Kalonian Knights", the secret resources of the "Order of the Stick", and so on.


If police is important, consider multiple police or quasi-police forces, with different mandates, different characteristics, and different moral and political alignments.

For example, a military police that developed from navy units dedicated to crushing smugglers and pirates in space and apprehending fugitives can be a threat to appropriate characters, but far less evil than a Dissenter Assassination Department and its secret agents.

#5092496 Model–view–controller pattern

Posted by LorenzoGatti on 08 September 2013 - 10:15 AM

Game software, otoh, is modeling and simulation software.  so one would expect "patterns" from modeling and simulation to be applicable, and "patterns" from other types of software to be perhaps less so. if you want to think of the game's data as the model, render as the view, and process_input and update as the controller (or would update be part of the model? i'd have to look up MVC again), i see no major harm. as long as it doesn't lead to unnatural code organization, and therefore unnecessary complexity.


me personally, i'd stick with "patterns" that come from game development- such as the "main game loop" pattern! <g>.


or the "render all" pattern, or the "update all" pattern.  or the "process_input" pattern.   or the "entities list" pattern, or the "world/level map" pattern.

But MVC and its variants are perfectly suitable patterns for modeling and simulation software, including games. Compared to typical business software there's only a slight shift from independent views of separate UI elements to consolidated (but often hierarchical) views of the whole game and from controllers related to user interaction with UI elements to various types of controllers (remote network players, AI agents, etc.) related to important model objects.


The mentioned game-related patterns are easily combined with a good model-view-controller separation: the main game loop ties together all steps of model, view and controller processing in the correct order and with the correct timing; rendering updates the view from the model; simulation updates involve only the model, which is very important; processing input is the job of some of the controllers ; lists of entities and maps are possible internal structures of the model.

#5092472 Autotiling

Posted by LorenzoGatti on 08 September 2013 - 07:55 AM

The corner tile system in the article can be summarized as assigning terrain types to tile corners and setting all 4 corners of a square to a given type as a basic editing operation. With n terrain (corner) types there must be n^4 tiles to cover all corner type assignments: 2^4 =16 tiles for 2 types (like in the article), 3^4=81 tiles for 3 types, 4^4=256 tiles for 4 types, which is still affordable. Effort can be reduced by marking some tiles as forbidden and checking they aren't required instead of drawing the corresponding graphics. For example, if terrain types are woods, grass, dirt and water, you could allow only tiles with woods and grass, grass and dirt, dirt and water: only 46 out of 256.

#5092020 redesign some piece of code

Posted by LorenzoGatti on 06 September 2013 - 02:03 AM

The amount of sleeping belongs with the sleeper, in your case the main loop that processes or ignores events.


Changing it with keyboard commands shouldn't be different from other commands: the keyboard handler can respect encapsulation and pass "sleep more" or "sleep less" messages to the engine (presumably calling the appropriate functions) without knowing the current amount of sleeping.

#5092017 How to cache?

Posted by LorenzoGatti on 06 September 2013 - 01:50 AM

Apart from sequential memory accesses, there's a complementary way to take advantage of cache: doing as much computation as possible with the same data before loading other data.


For example, instead of looping (in the best possible sequential fashion) through an array of guided missiles to update their position, then again to compute collisions, then again to compact it after some missiles have exploded, then again to compute their acceleration from the guide system, then again to compute their new speed,  looping through them only twice is going to reduce loads and stores, and the ensuing cache misses, by 60%.

#5091504 Getting GPU vendor ID

Posted by LorenzoGatti on 04 September 2013 - 02:19 AM

According to MSDN there's IDXGIFactory::EnumAdapters to get a IDXGIAdapter for every graphics card you have.
I wouldn't waste time with tricks and experiments to initialize your device variable in a way that associates it with the graphic card you are interested in; it might turn out to be impossible or too inconvenient.

#5091061 Why Behavior Architectures?

Posted by LorenzoGatti on 02 September 2013 - 10:30 AM

I don't know what horrible languages and frameworks you have endured, and how much you have suffered, to consider somewhat uncluttered syntax a success rather than a basic expectation and to associate a rigid (but appropriate) architecture with "thousands of lines of bloated window dressing just to get started", but you are mistaken on both counts.


Your pseudocode example is only the bare minimum expectation for a decent programming language; learn nice languages like Python or Lisp variants to see how far good language design can help you.

Regarding architecture, you can implement AI techniques in your own style without bloat (it's entirely possible) but also without allowing them to degenerate into unreliable algorithmic anarchy. The design effort will be repaid the first time you don't throw away an entire incomprehensible, inextricable module because you suddenly find yourself unable to make a change or locate a bug.

#5090981 Speed formula in RPG game

Posted by LorenzoGatti on 02 September 2013 - 02:34 AM

I suggest a simpler priority queue, containing characters, sorted by the time of their next action, and initially sorted by some kind of "initiative rolls".

The first character in the queue acts, a delay dependent on stats, action type, equipment etc. is added, and the character is put back into the priority queue.

This allows multiple attacks to occur only occasionally: two fighters swinging at each other with delay 5 and 6 will attack at times 0,5,10,15, 20, 25, 30, 35... and 0, 6, 12, 18, 24, 30, 36... with the faster one attacking two times in a row (maybe, depending on initiative at time 0) at times 0 and 5, 25 and 30 or 30 and 35 depending on initiative, and every 30 ticks thereafter.