# Postie

Member

324

1. ## My First Game (Please Don't Judge Me)

Not bad. The biggest issue I see is not providing the player feedback on certain game events. For example, when the player or enemies take damage. Because the game is about dodging, it is not immediately obvious if you were hit or managed to get away. You could briefly flash the player red or play an appropriate sound effect (or both). Another suggestion I have is to add inertia to the player's avatar. So instead of just updating the x,y positions of the player when you hold down the movement keys, you use an acceleration vector to adjust the player's velocity and apply a dampening effect when no keys are held to bring the player to a stop. This can be quite effective in making the controls seem smoother, just don't over do it :).
2. ## problems generating signed distance field

Your calculations seem correct. Definitely sub-optimal, but ok for a "reference" implementation as you mentioned. I think the problem is with the final step where it converts the distance data to the bitmap for visualisation. Your technique scales the entire distance field based on the maximum and minimum distances.  I've found that clamping the values to a certain range produces better results. For SDF's the important information is generally around 0, so I kept my distance values to the range (-64 to 64 pixels), anything higher or lower is clamped. Then you map that range of distances to your grayscale. Another thing I just thought of, is that your algorithm may not permit a minimum range of 0, since its always looking for texels that are opposite to the current one. Therefore the minimum distance may always be 1, which would explain the discontinuity as the gradient would go directly from -1 to 1.

That's pretty much what I was saying. Serialise the properties that are dynamic. Assume the properties that are static.   For a more concrete example, I had an "EdibleComponent", which was given to entities that could be eaten. I also had an "EdibleComponentTemplate", which defined the food and water values you'd get from eating it. These values are static, so I didn't serialise them. The edible item can spoil over time, so there was an Age property in the EdibleComponent which ticks at different rates depending on how it is stored (refrigerated vs not etc). Since that property is dynamic, it is serialised.    So a mocked up example of how the serialised file might look:   The entity template: Name = core.entities.redberries <Edible>     FoodValue = 15     WaterValue = 20 </Edible> Serialised Entity: Template = core.entities.redberries <Edible>     Age = 123 </Edible> Obviously these can be stored in whatever format you like, this is just in text for clarity. You can replicate the properties from the template in the component or have the component reference the template. Eg:   entity.GetComponent<EdibleComponent>().Template.FoodValue; vs entity.GetComponent<EdibleComponent>().FoodValue; I prefer the former as it makes it easier to tell which properties you should be serialising in the EdibleComponent class. Hint: everything! :) In the latter you have to remember which is which.

I've previously tackled this by having components and "component templates". Think of component templates as the properties of an component that do not change during the course of the game. For example, how much health a power up gives, or the dexterity requirement of a weapon. The component templates are bundled together into an entity template with a unique identifier.   When instantiating an entity, you pass in the entity template and create each of the components it requires, using the relevant component template.   Then, on serialisation you only serialise the dynamic properties defined in each component. Eg: transform, current health value etc. None of the properties in the component template can change, so there's no need to serialise these. But what you do need to know is which entity template was used to create the entity. So, you also store the unique identifier for the entity  template. On deserialisation you read the entity template identifier, instantiate a new entity exactly as it was orignally spawned, and then deserialise the components' properties into it.   A note on unique identifiers: I found using a string ID that resembles a namespace was much more flexible and robust than using an integer. For example: "core.entities.longsword" rather than "123".    It's easy to assign meaningful id's and also handy if you want to offer content expansions or themed content. In my example, I used "core." to represent the core (always included content), and you could use "halloween." to include content that should only exist if the game is played during halloween. Enabling/disabling this content at runtime is then trivial.   I also wanted to support modding, and having a namespace like structure makes id collisions almost impossible. Eg: "mods.mikesweaponsmod.rifle" vs "Id = 4567". How likely is it that a mod creator is going to be able to guarantee the Integer Id's they've picked can never conflict with other mods?    In addition, a saved game may reference entity templates that are defined in a mod that is no longer installed, and you have a much better chance of handling the situation gracefully if the templates are identified by a string rather than an Id. eg: missing entity : "Id = 1234" vs missing entity : "mods.extratrees.birch".
5. ## Any good A* tutorial?

+1 for Amit's tutorial. One of his strengths is visualising algorithms, and his A* tutorial is great.
6. ## Planning on using Blender

Well, I just learnt something new. Thanks! :D
7. ## Skeletal Animation Transforms are Incorrect: Totally Stumped!

This behaviour looks a lot like something I was dealing with myself about a month ago. If the joint rotation's origin isn't correct, the vertices of the mesh stretch rather than rotate around a common point. In my case it was due to how I was composing the final Translation Matrix for the bone.   The bone has a bind pose translation matrix and I needed to apply the desired local rotation. For it to work correctly I had to decompose the bind pose translation matrix into separate Rotation and Translation matrices and apply the local Rotation in between the two.   Eg: If the Bind Pose translation matrix is made up of R x T, and the desired local rotation is Y, the final transform needed to be R x Y x T, not Y x (R x T) or (R x T) x Y.    It's confusing, because none of the sources I consulted mentioned the need for anything like this, but without it, I couldn't get it to work properly.
8. ## Does our icon suck? - brutal honesty required

In my opinion the biggest issue is the eyes. He's not quite looking directly at us, but he's not really looking away either. It's a little weird.

I'd recommend the tutorial based approach at least initially, to give you something to start from. Starting from scratch without guidance can quickly lead to frustration.   Once you're comfortable with what you've learnt, by all means go "off script" and try things out on your own! :)
10. ## Problems With Game Engine Architecture

Heheh. I remember when I made that exact statement about my game project almost 5 years ago. I also remember 6 months ago when I suddenly realised why it was a bad idea and spent a few months refactoring everything to remove all globals.   Globals are seductive because they are easy to use and let you share information between different objects very easily. But you eventually end up in dependency hell, where to test a small system you need to recreate the entire game state, since object A references systems B and C, and they rely on D and E and F.. etc   The best thing about the mindset of passing dependencies instead of referencing them through globals, is that poor design stands out like a sore thumb.
11. ## Code quality at work

We've adopted new methodologies at work which I've carried over to my hobby projects, and similarly I've used hobby projects to learn new ideas that I've then suggested we adopt at work. There's more formality in place at my work, eg: Continuous Integration, Gated Checkins, the occasional code review, but there's not a "Work" and "Home" version of me as a developer, there's just me. :)
12. ## DirectX (SlimDX) multiplayer library

I struggled with Raknet for a few hours just trying to get it building. At the suggestion of a friend I ditched it in favour of Lidgren. It was easy to use and I was up and running with simple client/server comms in no time, so I'd definitely recommend Lidgren over Raknet. I recently discovered that Lidgren has a nuget package which makes getting access to it even easier than the github way if you don't need the source code.
13. ## What programming language should someone pair with LUA?

If you're not doing console game quality, it opens up the floor a bit more, so alternatives to c++ become viable. I'm working on a game project at the moment which is a mixture of C# and Lua.   To answer your question, the "best language to use" is probably going to be whatever language *you* are most proficient in that has a Lua implementation.
14. ## towards a faster A*

I second Alvaro's suggestion re: the Heap. I remember reading about A* and not know how a heap worked it seemed pretty scary, but once I had a crack at implementing it and it started to made sense, my A* implementation became several orders of magnitude faster.
15. ## A*, A Star: impassable nodes can just go on the closed list?

Unless you have an infinite map, you have to do some kind of test to make sure you don't go outside the map bounds when looking for neighbours at the edges of the map. If you treat impassable terrain the same way, it will never be processed.    Also, remember, high cost is not the same as impassable. If the numbers align, that node may be considered a viable route.
16. ## Suggestions for software for 2D animation

Hi guys,   This a pretty broad question as I'm doing some high-level research on adding 2d animation for an intro cutscene for my game.   The style of animation I had in mind is similar to the cutscenes in the game "Valiant Hearts: The Great War". ie: vector images that move, scale or rotate via simple paths.    What applications could I use to create 2d animations like this?
17. ## Suggestions for software for 2D animation

Looks interesting. Thanks for the suggestion.
18. ## Unique ID per type

SeanMiddleditch is 100% correct. If you want to be able to load saved game states (eg: save games), you need to define the Id's in such a way that they can never change. The only way to do this is to assign them yourself.   Generating a hash from the name of the type seems like a good idea, but what if you ever decide to change the name of your class? For example if you decide that "LightComponent" should be "LightingComponent"?   Another thing you will need to consider is hash collisions. They are rare, but they can happen. Check out the hash collision tests done in the following stackexchange post: http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed   They found 7 collisions in the english dictionary using the DJB2 algorithm you're considering:
19. ## Drawing on Timer tick

Have a look at Dispatcher.Invoke(). It's designed precisely for this purpose.   http://stackoverflow.com/questions/1644079/how-can-i-use-the-dispatcher-invoke-in-wpf-change-controls-from-non-main-thread
20. ## Replacing ECS with component based architecture, or traditional OOP, or something else?

There are two different object-oriented programming (OOP) techniques in your toolbox ; Inheritance and Composition. For whatever reason, OOP education tends to ignore composition, and as a result OOP is synonymous with inheritance. ECS's happen to use composition, so they seem revolutionary and new at first glance.   However, like all toolboxes, sometimes you need a screwdriver, sometimes you need a hammer...
21. ## Understanding procedure to create normals from a cloud point.

I think you're confusing the idea of "normalising" a vector (which is an operation you can perform on a vector) and the "normal vector", which is a property of surfaces.   The first involves multiplying a vector by a calculated constant (1/vector length) to change its length to be 1, but not change its direction. This is also known as a unit vector.   Normal vectors point out of a surface such that the angle it makes with the surface is 90 degrees. There are actually two per surface and which one you get depends on the order in which you consider the vertices that define the plane when performing the normal calculation.
22. ## Saving previous gamestates

Do you need it to be a special case of serialisation? If your objects were able to serialise and deserialise their state through a byte array or a memory stream, then that data can be saved to disk, sent via the network, or kept in memory.
23. ## Lineup for turn based games.

If your speeds are always integers, you could create buckets that represent each speed unit and then add each hero to all buckets that are multiples of their speed. Then you simply iterate over your buckets adding heroes to your lineup until you have enough.   eg: 3 heroes called H1 (has speed 2), H2 (has speed 3) and H3 (has speed 10)   Buckets: 1: (empty) 2: H1 3: H2 4: H1 5: (empty) 6: H1 and H2 7: (empty) 8: H1 9: H2 10: H1 and H3 ..etc   Then, your line up is: H1, H2, H1, H1, H2, H1, H2, H1, H3   ...It reminds me of the old "fizz buzz" programming question.
24. ## [SlimDX] Information on the history of SlimDX

As a user of SlimDX, I'd like to thank you all for your hard work.
25. ## Using RakNet with C#

I saw lidgren mentioned in a few of the articles I found, but was swayed towards RakNet. Time for me to check it out..