Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Oct 2005
Offline Last Active Today, 01:41 AM

#5239441 free private SVN with biggest disk space?

Posted by haegarr on 10 July 2015 - 02:25 AM

[edit] as pointed out below this can be as expensive as renting a server/service -- A 250W PC * 0.15c/kWh * 24hrs * 30days = ~$27/month -- so check your utility rates and look into low-power PCs to use as the server

For comparison: I'm running an old Core2 Duo linux based server at 65W and a new i5 QNAP NAS at 50W (measured during idle but rotating HDDs), each one with 4 HDDs in RAID 1+0. When disks get parked during low access frequency times, the values drop accordingly.

#5239154 New take on Conversation in Video Games

Posted by haegarr on 09 July 2015 - 02:01 AM

Well, what you describe is not really new. But it is nice to see another soul that's thinking how to replace the simplistic dialog tree mechanics. So don't get me wrong because most of the following sounds like critique. smile.png


a) There are more dialog mechanics besides the both you mentioned. The group of "branching dialogs" consists of the dialog tree but also of the "hub and spoke" variant; there are even planner like mechanics. See e.g. this and this article on Gamasutra.


b) A FSM is by definition a collection of states with conditional directed transition in-between. In an FSM just 1 state is active (as long as you do not mean HFSM). Implementing an FSM with those 6 degrees of freedom would practically become impossible very fast. What you describe seems me to be something different, more like some kind of decision tree. 


c) A "state" you've forgotten is the need / goal of the speaker. This is very important, because a person is willing to ignore mood and whatnot in case that it helps to yield a goal. It must even be possible to lie. All this may be important to drive the story, too.


d) Having the possibility to change the topic is nice not only for the player but also for the NPC, because it allows an NPC to drive the dialog into a direction that matches the story. But care must be taken that an NPC does not rapidly hop from one topic to another. When the player des so then the the opponent should probably get angry (i.e. changing its mood). See e.g. Emily Short's articles about that problem. (BTW: Emily has many interesting stuff to say, although she's more related with IF instead of video games.)


e) Besides the mechanics, also the UI plays a big role. The player need to recognize whether a sentence may endear or insult the opponent. Remember that not all players may understand the language in which they are playing good enough to recognize nuances. It is also nicer for the player not to need reading 4 times 5 lines of text just to decide which answer to give. There is an article about dialog UIs on Gamasutra (unfortunately I do not find it ATM). The more influence a dialog system has, the more important is its flawless controlling.


f) Regarding the effect of stats on dialogs and the possibility to change stats due to dialog, you may want to read the PDF about SimDialog available here.

#5238941 checking if resource has changed

Posted by haegarr on 08 July 2015 - 03:40 AM

The OP asks for "dirty resources to be saved or discarded" and a belonging user decision. This is a different problem than those of hot swapping of updated resources. The former one means to update files from memory, and the latter means to update memory from files.


In my engine code I check if resources* have changed so I can ask the user if they want to save or discard the changes in various places. [...]

I'm not sure why this happens "in my engine", assuming that "engine" means a game engine in the meaning of a game runtime. Resource changes and save requests belong to the editor. Integration of the editor with the game runtime like in "editor in game" is IMO not a clean way since it burdens the runtime code and hence makes it maintenance more difficult.


[…] but before I dive in and change a bunch of stuff I though I would ask others how they handle the "dirty" problem.


Some possibilities and thoughts:


Command style editing


Resource changes and save requests belong to the editor. Making changes undone should also be possible in such an environment. Instead of using a single flag, a counter of dos / redos (increments) and undos (decrements) targeting the respective resource can be used to track dirtiness. A saving would reset the counter to 0, and any value different from 0 (notice that this includes negative values, possible due to undos after a saving) denotes dirtiness.


This way does not counteract issue #2 as mentioned in the OP, but using OOP style patterns like the Command may support to avoid that kind of bug.


It also does not totally counteract issue #1, since changes back to a previous state are only considered if performed as an undo. However you need to notice that some kinds of change-back (like translation when using floating point numbers) may yield in a visually identical resource although also the message digest of its serializations will differs.



What You Made Is What You Want (perhaps somewhat controversial)


Notice that from a users point of view (and ignore the fact that we, as users, are familiar with the concept of saving, because this is just due to history) the dual state of a software object, namely its state as file and its state in memory, is a suffering. The whole load/save stuff exists due to technological reasons only, not because it is the optimal workflow. Ideally you could stop working with a software, and when continuing it the state is as you left it before. This obviously must include the possibility to roll back to previous states. However, the consequence is that nothing like a dirty state exists anymore; at any moment the current state is assumed to be what the user wants.



Message digests


When checking the message digest of the in-memory representation with what is stored in a file, it would obviously be killing the performance if every digest is computed on the fly. Instead, if possible, the digests of files should be computed once and stored along the file. This may even be done in a kind of catalog file that's used to collect the names and digests of all files in a directory that are used in the project (similar to archives). 

#5238628 Why use texture splatting?

Posted by haegarr on 06 July 2015 - 10:09 AM

Is there something I am missing?

The RGB textures are of fine detail, repeating many times over the terrain. The blend texture(s) are coarser, covering a large area of the terrain. I.e. you do not have blend control over each individual pixel but the splats.

#5237458 Memory management patterns in C++

Posted by haegarr on 29 June 2015 - 04:18 AM

I don't think it is possible in modern games to just have a single memory management scheme. You need multiple and use each in the right way.

Seconded. Hence ...


How have you solved this problem in your projects?

… situation dependent. Here are some examples that do not rely on reference counting:


Regarding the ownership, resources are owned by the respective resource management systems, while game object components are owned by the respective component service systems. Scratch memory is owned, of course, by the instance that works with it. Sometimes there is a clear hierarchy; e.g. network messages are owned by a transaction, which themselves are owned by a connection. And so on.


Regarding lifetime, resources are typically bound to the lifetime of higher concepts. E.g. resources for the GUI or the player avatar are bound to the lifetime of the game itself, while other resources may be bound to the lifetime of the level or a region. Game objects are created / destroyed at a defined step in the game loop. Each component service system is responsible to deal with destroying game object components of the managed types and in a way that is suitable for the service system. Network messages are recycled in the well known pool memory allocation scheme.


Addressing game object components across service systems is based on handles instead of pointers, but handles can be resolved to pointers when necessary. Such pointers are guaranteed to be valid only for a single run through the game loop. Resources are addressed similarly.

#5237246 A more simplistic way for this?

Posted by haegarr on 28 June 2015 - 06:45 AM

Im just wondering what sort of trig formula is this
dx /= c;
dy /= c;

change of x = change of x/ hypotenuse?

Together with the computation of c it is a standard operation in vector algebra called "normalization", in this case using the so-called Euclidean norm or 2-norm. The Euclidean norm of a vector denotes the length of the vector in Euclidean space. Then dividing the difference vector (which is given by the 2 differences as (dx dy) ) by its own length results in a vector that points in the same direction as the original vector but has a length of 1 (i.e. it has unit length); thus it is called "normalization". Hence the resulting endpoint lies somewhere on the unit circle, i.e. the circle with radius 1. So the normalization step is equivalent to

   dx := cos( angle ) = r * cos( a ) where r==1

   dy := sin( angle ) = r * sin( a ) where r==1

but where the angle a is anything in [0,2pi] (as opposed of what you compute as angle in the OP).

#5237229 A more simplistic way for this?

Posted by haegarr on 28 June 2015 - 04:06 AM

Im just wondering if you guys implement the same functionality with minimal ifs. and if so how did you do it?


1.) The if clauses are not complete, because none of the conditions checks for dx==0 or dy==0. However probable such a case is, it does cost nothing to check it but will fail if not doing so.


2.) All the if clauses would not be needed if the atan2 function would be used. As you already have noticed, there is a meaning with the atan2 function that makes it superior (in many cases) compared to the atan function.


3.) The entire approach can be replaced by using vector math. If I understand the code snippet correctly then something along

                // elements of difference vector
                dx = mousex - sprite.originalPosition.X;
                dy = mousey - sprite.originalPosition.Y;

                // length of difference vector
                c = (float)Math.Sqrt(dx*dx + dy*dy);
                if (c > radius)
                        // direction vector (normalized difference vector)
                        dx /= c;
                        dy /= c;

                        // adding scaled direction vector to position
                        mousex = (float)sprite.originalPosition.X + (radius * dx);
                        mousey = (float)sprite.originalPosition.Y + (radius * dy);

should do the same thing. (Notice that the above solution assumes that dx, dy, and c are floating point variables.)



BTW: I'm missing what exactly this has to do with a joystick...

#5236926 -std=c++11 with Xcode 4.6

Posted by haegarr on 26 June 2015 - 08:51 AM

Not sure whether Xcode 4.6 already supports C++11; you should consider to switch to a 5.x version.


However, when you open the "Build Settings" for a target, then search for the fields "C++ Language Dialect" and then "C++ Standard Library" and pick the C++11 option that suit your needs. If the options do not provide some "C++11" and/or "GNU++11" stuff, then you need to upgrade Xcode, of course.

#5236885 Dealing with different collision responses in an entity-component system

Posted by haegarr on 26 June 2015 - 01:45 AM

When I once thought about collision in ECS I saw several problems when selecting a collision response: (1) An entity may have more than a single collision volume, (2) the response depends on the types of both participants, and (3) simultaneous collisions involving the same entity have to be handled / resolved in a meaningful manner.


For example, in an RPG with a sense system, we want to support damage of course, but perhaps distinguishing different body parts so that the collision volumes for this are more detailed than the "physical" one used to avoid running into a wall. The sense system may introduce different collision volumes for the visual, aural, and olfactory senses, and that for both roles as detector and as stimulus.


Well, the conclusion to me was that I moved away from a unified collision system and towards dedicated systems. To serve this, there is also no longer a single unified collision component but components that match the systems, of course. The collision volumes are then parameters to that components, and the components declare the owning entity to participate of the respective systems and also in which role this happens. While all such systems use the same volume intersection services, each one manages the own set of colliders and each one has its own set of rules of how to respond to a detected collision.

#5236402 manging lifetime of textures/buffers etc

Posted by haegarr on 23 June 2015 - 12:48 PM

I would have to somehow know that nothing is using a particual Texture any more and manually call mDevice->DeleteTexture(textureHandle).
So do people implement some form of reference counting inside the Device to count CreateTexure and DeleteTexture on each texture handle? It seems if I'm going to do that I might as well just use a shared_ptr anyway to count it?

Many engines manage memory not in a totally dynamic way. Instead they define memory budgets for particular purposes and they define lifetimes a priory. For example, some assets are loaded at game start and unloaded when the game ends, i.e. they have game lifetime. Level based or region based lifetime are other popular methods. Streaming may also be used in which case buckets of memory are allocated once and then cleared and re-used in dependence on vicinity or whatever. However, the clue is that the lifetime is not measured but prescribed.


I do not know what exactly the Molecule Engine does, but the articles and comments in that blog mention such things, too.

#5236273 Landmarks

Posted by haegarr on 23 June 2015 - 01:10 AM

Castle Settings


* awesome tapestry

* torture chamber


Cavern Settings


* abyss

* subsurface flow (short piece of)

* opening in the ceiling where sun / moon light comes in

* lair (e.g. of bats)

* occurrences of natural resources in the walls


Sewer Settings


* entrances / exits

* catchment basin 

* some kind of machinery (pumping, forwarding)

* any bigger room as opposed to the narrowness of the regular sewers

* (e.g.) rat nest


#5235824 Finding near and far plane from projection matrix

Posted by haegarr on 20 June 2015 - 03:58 AM

f - 5 = f / 1.02564

-5 = f / 1.02564 - f

    = f ( 1 / 1.02564 - 1 )


f = -5 / ( 1 / 1.02564 - 1 )

#5233555 Moving objects in 3D

Posted by haegarr on 08 June 2015 - 10:57 AM

I've looked into it a bit more, and I might be onto something, but I'm not sure, and I'd like some advice please.  I found a function called Transformation, which takes as inputs:
- a translation vector
- a vector for the rotation point, and a quaternion to rotate
- a vector for the point to scale around, a vector for the amount of scaling, and a quaternion for rotating the axes along which to scale (so it doesn't necessarily scale on the default axes)

This sounds like the transform function somewhat known from X3D. There are also the functions named AffineTransform with less parameters. Both can be used. It is probably so that for your use case

* the scalingCenter is (0,0,0)

* the scalingRotation is (1,0,0,0)

* the scaling is (1,1,1)

* the rotationCenter is (0,0,0)

* the rotation is (your-rotation)

* the translation is (your-translation)


However: It would be easier to just set the elements of the transform matrix from the parameters you already have. Assuming that SlimDX uses row vectors, the 1st row stores the sideways vector, the 2nd row stores the upward vector, the 3rd row stores the forward vector, and the 4th row stores the position vector. (Notice please that the rows stores homogeneous coordinate vectors, so that each of the direction vectors has a 0 as its last element, while the position vector has a 1.)


So, if you have pairwise orthogonal vectors right, up, and forward then you can use the setters Matrix.Mxx for that purpose. If they are not pairwise orthogonal then you need to apply the cross product before using the vectors.

#5232353 OpenGL nearPlane, farPlane and virtualScreen

Posted by haegarr on 02 June 2015 - 05:18 AM

Well, I'm not totally sure, but when the illustration from the OP is the basis, then the left and right parameters of frustum(….) must not be symmetrical. They probably would be symmetrical if the look-at point is chosen so 

glm::lookAt(Position - eyeOffset, Position + Forward, Up); // left eye
glm::lookAt(Position + eyeOffset, Position + Forward, Up); // right eye

(assuming that eyeOffset is a vector given in the correct co-ordinate space, of course). BUT then the view planes for the left eye and for the right eye would not be coincident but would be crossed a bit. Hence they would not form the shown virtual screen. So ...


Exerting trigonometry, the virtual screen has a width of

     s := 2 * convergence * aspect * tan( 0.5 * fovy )


Let e be the absolute value of the eye offset. Then the irregular parallelogram build of Position, left eye, top intersection of left and right frustum, and the center of the virtual screen allows us to say that for the left eye

   left := -1 * near * ( s/2 - e ) / convergence

   right := +1 * near * ( s/2 + e ) / convergence

and analogously for the right eye

   left := -1 * near * ( s/2 + e ) / convergence

   right := +1 * near * ( s/2 - e ) / convergence

Well, I think at least it could be the solution. What do you mean?

#5230799 What design pattern should I go for if I want to "sort of" convert th...

Posted by haegarr on 25 May 2015 - 03:38 AM

The OP doesn't contain exhaustive informations, so to say. In principle I would / do arguing as follows:


The navigation system is a service provider for AI (can I go there?) and the movement system (how to go there?), i.e. it is at lower level than those, and those are at a lower level than game objects (as a whole). When different navigation solutions are available and probably even need different data structures, then integrating all that into game objects would be messy. A possible solution is to use an agent attached to the game object, so that the agent utilizes the services, holds the appropriate data structures, and mediates between them and the game object.