Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 27 Aug 2002
Offline Last Active Today, 02:20 AM

#5272974 Best way to check collisions with multiple objects?

Posted by MaxDZ8 on 28 January 2016 - 05:46 AM

Multiple questions here, albeit related. I would suggest to keep your collision checking independent from rendering - who says entities outside screen don't need collisions? They want some collisions as well!


Try something more generic. Tiles on a grid lead themselves well to some hierarchical system (see: QuadTree). You might also want to check out some other library doing the work for you. There are a few and they'll mangle thousands of static objects with relative ease.

#5271988 C++ exceptions

Posted by MaxDZ8 on 20 January 2016 - 06:02 AM

I think I missed the parts where error handling was considering as the problem in itself. Fedor Pikus at Mentor Graphics is apparently pro-exceptions, I honestly agree. I'm not sure how having my code interleaved with if(error) gives me better control.

#5270714 Considering an RPC or message oriented server architecture, confused

Posted by MaxDZ8 on 12 January 2016 - 10:50 AM

Hello network experts! I somehow managed to get an idea for a promising application and I'm slowly executing it. This time networking is required and since I am moving to a whole different platform (Android) I decided to take a few days to figure out something which is state of the art. In theory. In practice I'm fine with something industry standard at least.
While looking for serialization solutions I couldn't avoid stumbling on google protocol buffers. I'm 100% on them.
When it comes to service definition however I'm a bit more confused.
My system is very easygoing. It models a fully sequential process so basically I have a list of peers connected to a server and the server decides who gets to act when. The active device gets its chance at modifying the shared data and then signals itself inactive (the server can also timeout the user). So it's all about manipulating this shared state, no surprises.
The server 'owns' the data in the sense it initializes gathering of the clients and keeps persistent data on it but in practice the clients are allowed to manipulate the data and they have power even on other people's data within the limits of the protocol.
In my head I modeled it as message passing / events: when you get a Active(ID) and ID == yours it's your turn to do stuff. Now you can send Shuffle or ChangeState messages. Most of those messages are not confirmed. I just expect the server to push a different, updated state.
This is where the thing starts to be odd. Of course I wanted to streamline even more by using protobuf service definitions and this is where stuff starts to go awry. Sure, there's Empty but I think the underlying problem would still hold.
Most of the examples I've seen look like this:

service EasyGoing {
    rpc JustCallMe(SomeRequest) returns (SomeReply);
I get the idea that most RPC calls are about getting stuff back and not really about manipulations 'returning' void.
Plus, the client has it easy but the server also needs to call stuff on the client. Granted, I could have a ClientService I'm considering the thing and I would rather do full message passing at that point...
Furthermore services can stream back results so for the case of my Active message/event I could do something like
service CentralArbitrator {
    rpc SendMeActiveEvents(Empty) returns (stream ActiveMessage);
I suspect I haven't fully grasped what RPC is. I always assumed it was just a layout on top of networking to have a somewhat unified interface (talking simple blocking stuff here) but I have got the vibe we're talking mostly about get-resources somehow, like most of the requests to be stateless, with a heavy client-server architecture.
By using something like the above, I would have each client register to the various events. I could still get the 'RPC' sticker (evrybody luvs biz talk) but I have the impression this isn't what an RPC-oriented system is supposed to do. Would that make sense to you?
I feel like I'm missing something fundamental about the theory.
I think I can put it short as follows:
What would you suggest to consider when evaluating an RPC-oriented architecture vs an explicit message passing one?

#5269590 Why do most RPG games uses range values for attack/defence?

Posted by MaxDZ8 on 06 January 2016 - 04:54 AM

The reason is simple: they model good strikes and 'lucky' hits. Also see: critical hits.

If you have 1d6 damage and roll 1, your character just scratched the enemy. With 6, they have hurt them considerably. At critical the whole blade has gone in.

In my experience the incidence of variable damages becomes secondary at a certain point, it's mostly relevant at low levels.

#5267292 Game loop sucking up CPU

Posted by MaxDZ8 on 21 December 2015 - 03:32 AM

Ah okay this makes sense.  When i remove the sleep and let it spin as fast as it can it seems like the resize operation feels jittery/laggy.  Is this expected?
Nope. It should be butter smooth. Some common causes include (in my personal order)
  • If you're using mouse input make sure you're using an high precision movement as provided by WM_INPUT. Standard windows mouse events are too gross grained to provide smoothness (they trigger on a per-pixel basis and have other mechanisms making them unsuitable to anything else than moving a pointer).
  • Fixed logic step != fixed step. This is a common misconception. Input should always be mangled at the lowest possible latency. Similarly, graphics must be updated (ideally) at the highest frame rate possible. Fixed-rate systems must be coupled with "fast system" in a way that allows the fast system to update without interfering with the fixed-rate state.
  • Worth stressing: mangle input right away. Do not wait for next refresh. Do not wait to 'merge' the events somehow. Only one exception is gesture recognition.
  • OFC if your hardware is working hard it'll have its own rights of responding with some delay. In my experience that's usually not the problem and when it is it's not really HW fault.

My suggestion: work by default at full speed game loop. Throttling won't likely be your primary concern for a while.

#5265994 Use an array in HLSL

Posted by MaxDZ8 on 12 December 2015 - 01:40 AM

It makes the whole thing very, very different!


Your shader is irrelevant when it comes to that error, dude, look at you debug window! PS_Buffer is 0x0, what do you think it'll happen when you try PS_Buffer->GetBufferPointer()?

#5265881 Use an array in HLSL

Posted by MaxDZ8 on 11 December 2015 - 10:00 AM

but unfortunately it doesn't work. am i made a mistake ?

Asking questions 101.

Don't write "it doesn't work". Instead write: I get this error: <error description>, I was expecting <this> to happen but I get <this other result> instead.  This way you can get better answers. I'm pretty sure you were told about this.


I am not aware of how linearRand works. Google results in a surprisingly small amount of links. That's not really important however as nothing in the writing for seems to be wrong.


I am not sure where those values are supposed to go; I haven't used HLSL in a while but I hardly believe the value of the global pxlSamples goes anywhere but oblivion at the end of the shader... assuming this is the same shader then cbuffer pixelSamples does not make any sense.


I am not supposed to read your mind, nor guess.

#5265723 ECS: Systems operating on different component types.

Posted by MaxDZ8 on 10 December 2015 - 07:39 AM

It is a good question! I guess they mangle this situation by 'matching components'.

In most (not really game-related) component-oriented architectures, there are specific semantics attached to components and therefore specific behavior can be built on top of those. For example, the standard tick of a MovableRigidBody could involve iterating on all its attached Velocity and Acceleration components.

#5261733 Generic Installer - Cross Platform

Posted by MaxDZ8 on 12 November 2015 - 04:45 AM

The more I hear about installers the more I think extracting a .zip is all I want.

Watching thread...

#5261090 char[32] as function parameter

Posted by MaxDZ8 on 09 November 2015 - 02:02 AM

Have you considered std::array<type, N>?

The main advantage is that it contains its own length and you can use it in range-for.

Unfortunately, being an owning object it causes you to shuffle memory around... the template version sort of solves the problem but I'm personally not a fan of that syntax.



Note: it is a very different thing from std::string.

#5261089 Blog post: Measuring memory allocation cost, by eliminating it

Posted by MaxDZ8 on 09 November 2015 - 01:58 AM

Interesting and to a certain degree somewhat expected.

Just as quick lookup to other readers: you didn't eliminate dynamic memory allocation but rather transitioned to a fast suballocator, a known pattern.

It is a very interesting data point! Thank you for sharing!


Also related: Andrei Alexandrescu on various types of suballocators.

#5259083 d3d12: texture barrier equivalent?

Posted by MaxDZ8 on 26 October 2015 - 02:28 AM

RWTexture2D and MemoryBarriers?

#5258502 Help with specs for laptop

Posted by MaxDZ8 on 22 October 2015 - 06:41 AM


Under 500.


Intel chips.


Are you guys on Intel Payroll? Or just talking shit?

i3 are absolutely far beyond what a starter needs.


I strongly suggest to take a look at AMD Carrizo laptops.

#5258367 OOP inheritance structure

Posted by MaxDZ8 on 21 October 2015 - 12:08 PM

I don't think you got the point. The point is you shouldn't mix notions from different levels of abstractions. If you do, you probably can take the chance to refactor and thing in layered abstracted components.


The use of the entity word is mostly historical. In my engine, entities are just called Object because if you think at it, you cannot define a single action common to all entities besides existing. Feel free to use that term if it fits your mindset, it seems you're fully into the entity mindset.




Well, the idea was that a humanoid is a lot more different then say, a animal or undead with really it's own functionality. They would have additional stats like charisma, can conversate with the player and other humanoids and are able to use tools and wield armor.
I have always used this with success but for much simpler concepts.

Most of which are not something you should deal with code. Conversations are scripted anyway, just give the objects a ConversationTree object... or not. Gameplay stats are most likely not a performance path: cut a few corners and just put them in a std::map<string, uint>.

Want to limit use of tools and armor? Just have an string race.

All of those are data-driven and provide nearly equivalent functionality. 


Note: std::map<string, uint> is an associative container. You ask a name and it gives you an hint. I don't know how it is called in Java. Sometimes they are called 'keyed arrays' or something along that.

#5258334 OOP inheritance structure

Posted by MaxDZ8 on 21 October 2015 - 09:25 AM

Another problem this thing has is the following:

entity is a 'engine' notion. You use it to somehow group related data.


"Being a mage" is a gameplay-related notion. You're probably using this difference in logic to provide (override) logic to select spells to cast etc. A better way would be to provide entities with 'magic abilities' (gameplay term) a SpellSelector object which will decide which spell to cast at a given time.


With "being humanoid" that's even more subtle: in theory I could just change the asset of the monster and draw it an humanoid. Everyone would agree it looks like an humanoid. Ok, you probably use this to determine which spells affect entity x, as "lock humanoids" doesn't work on non-humanoids. For that purpose, you just need a boolean flag to go along your entity and that would be a data-driven design.