Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411283 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 12:04:47 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 46 47 [48] 49 50 ... 69
Print
Author Topic: General thread for quick questions  (Read 132697 times)
oahda
Level 10
*****



View Profile
« Reply #940 on: January 18, 2017, 04:08:46 AM »

For some reason I can't find any info on this...

When sending messages with RPC, are they guaranteed to get through (so long as the connection isn't broken somewhere along the line, of course)?

Like, will the system itself ensure that messages don't get lost, by whatever mechanism, or should I always build systems so that for example when I want to synchronise clients and notify the server that they're all done with some state, so that the clients keep sending notifications to the server, just in case, until the server has received a message from each client, in case some message gets lost along the way, or is this completely redundant?
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #941 on: January 18, 2017, 05:25:57 AM »

That depends on what type of RPC you are using.
Logged

oahda
Level 10
*****



View Profile
« Reply #942 on: January 18, 2017, 06:02:30 AM »

Not sure, since I didn't write the library. I'll try and figure it out.
This seems to be the one: https://github.com/jbruening/PNet
Can't seem to find any info on the matter on the GitHub front page at least.
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #943 on: January 18, 2017, 07:47:39 PM »

I had been thinking about how to do tracking reliably enough, it turns out that signal strenght is a great indicator of distance, but then you need many sensor to triangulate the signal origin in space, which is a bit cumbersome to deploy casually.

Then I realize I don't need full tracking, I need directional tracking. I wonder what are the solution to detect signal direction with as small a form factor as possible ...
Logged

surt
Level 7
**


Meat by-product.


View Profile
« Reply #944 on: January 19, 2017, 11:56:46 AM »

Is there any way to pull an image binding point out of a GLSL shader program with the uniform name? Is hard coding the only option?
Code:
layout(binding = 0, r8ui) uniform restrict readonly uimage2DRect srcIndexed;
Code:
glBindImageTexture(???????, buffer.texture, 0, GL_FALSE, 0, GL_READ_ONLY, GL_R8UI);

EDIT:
Nevermind being stupid. Just need to use glGetUniform*.
« Last Edit: January 20, 2017, 06:09:32 PM by surt » Logged

Real life would be so much better with permadeath.
PJ Gallery - OGA Gallery - CC0 Scraps
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #945 on: January 19, 2017, 06:27:27 PM »

Not sure, since I didn't write the library. I'll try and figure it out.
This seems to be the one: https://github.com/jbruening/PNet
Can't seem to find any info on the matter on the GitHub front page at least.

Yeah I can't tell how much you need to do from that github page. I've been using SignalR lately and that framework essentially handles all reconnection logic for problems that are less than 30 seconds. If it goes over 30 seconds the framework fires a callback I can respond to to spin up another thread that attempts to reconnect as long as the connection state is disconnected.

I think it varies quite a bit for each RPC framework unfortunately.
Logged

oahda
Level 10
*****



View Profile
« Reply #946 on: January 20, 2017, 03:35:05 AM »

Dunno, maybe the problems I've been having are simply because I've managed to send signals to the server a fraction of a millisecond before the server changes its state (and refuses to accept certain messages because it's in the wrong state) and not because the messages haven't actually been getting through, or something. Hm. But if it could still fail after x seconds, assuming it works like the solution you are using, then maybe the safety mechanisms should be left in the client anyway...
Logged

_glitch
Guest
« Reply #947 on: January 20, 2017, 11:10:05 AM »

I have problems with programming a 8 dirctional sprite animation movement in XNA. Is someone able to share a link to a tutorial or something like that?
Logged
_glitch
Guest
« Reply #948 on: January 21, 2017, 04:19:55 AM »

Nevermind guys, I found a way by myself
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #949 on: January 21, 2017, 05:31:47 AM »

Dunno, maybe the problems I've been having are simply because I've managed to send signals to the server a fraction of a millisecond before the server changes its state (and refuses to accept certain messages because it's in the wrong state) and not because the messages haven't actually been getting through, or something. Hm. But if it could still fail after x seconds, assuming it works like the solution you are using, then maybe the safety mechanisms should be left in the client anyway...

If you're worried about messages not arriving does the framework not have something like an OnRecieved callback on the server that you check against? Or maybe an OnAcknowledged from the clientside?
Logged

oahda
Level 10
*****



View Profile
« Reply #950 on: January 21, 2017, 06:47:19 AM »

Maybe. Will look into it after the weekend when I'm back at work. c:
Logged

Photon
Level 4
****


View Profile
« Reply #951 on: February 03, 2017, 09:33:50 AM »

Using Haxe and OpenFL and I want to do a simple glow transition for objects. That is, full white overlay of an object that eases into the actual appearance. As I've not really hard-coded this sort of thing before, not sure where to start. Color matrix perhaps?
Logged
Panoramix360
Level 0
*


View Profile
« Reply #952 on: February 07, 2017, 04:43:47 AM »

Someone knows some good article or book about tweening functions?

I want to use them in my game that I'm making on Game Maker!

Thanks!
Logged
DragonDePlatino
Level 1
*



View Profile WWW
« Reply #953 on: February 16, 2017, 05:45:30 AM »

I'm designing an entity component system. Right now, I'm loading information about entities (characters, items, etc) from an external file. Every entity has a unique string associated with it like "hero", "sword" or "apple". Right now, if I want to create a lot of entities, I do something like:

Code:
int bullet_id = ecs_get_blueprint("bullet");

for (int i = 0; i < 100; ++i)
ecs_build_entity(bullet_id);

I do this in two steps because the ecs_get_blueprint() part is slow. I have to run a string comparison against every previous entity name so finding "bullet" is O(n) where n is the number of entities. Instead, I'd like to do:

Code:
ecs_build_entity("goblin");

Where finding the blueprint is O(1). So basically, I want to have a lookup table of small, fixed size (1 - 256) where keys are entity names (16 char) and values are the blueprint ids (integers). I don't need to resize the table or remove anything. All of the entries are added at once and the table needs to be just big enough to hold all of the blueprint ids. What should I look for?
« Last Edit: February 16, 2017, 05:52:06 AM by DragonDePlatino » Logged

JWki
Level 4
****


View Profile
« Reply #954 on: February 16, 2017, 06:03:47 AM »

I'm designing an entity component system. Right now, I'm loading information about entities (characters, items, etc) from an external file. Every entity has a unique string associated with it like "hero", "sword" or "apple". Right now, if I want to create a lot of entities, I do something like:

Code:
int bullet_id = ecs_get_blueprint("bullet");

for (int i = 0; i < 100; ++i)
ecs_build_entity(bullet_id);

I do this in two steps because the ecs_get_blueprint() part is slow. I have to run a string comparison against every previous entity name so finding "bullet" is O(n) where n is the number of entities. Instead, I'd like to do:

Code:
ecs_build_entity("goblin");

Where finding the blueprint is O(1). So basically, I want to have a lookup table of small, fixed size (1 - 256) where keys are entity names (16 char) and values are the blueprint ids (integers). I don't need to resize the table or remove anything. All of the entries are added at once and the table needs to be just big enough to hold all of the blueprint ids. What should I look for?

You want a hashmap, essentially.
Logged
DragonDePlatino
Level 1
*



View Profile WWW
« Reply #955 on: February 17, 2017, 04:08:46 PM »

After some looking around, I found exactly what I want: a perfect, minimal hashmap. They have fast O(1) lookup, no collisions and produce exactly one bucket for each key. The limitation is that you cannot add or remove keys after finding the hash function, which is perfectly fine.

I found solutions like gperf and CMPH, but those generate C files. This example works at runtime, but produces an infinite loop with certain inputs. Does anyone know a good example I could adapt to C? It doesn't have to be minimal (thought that would be preferred) and I don't care if it takes a long time to generate the hash table. I just need fast, O(1) lookup.
Logged

JWki
Level 4
****


View Profile
« Reply #956 on: February 18, 2017, 02:45:47 AM »

After some looking around, I found exactly what I want: a perfect, minimal hashmap. They have fast O(1) lookup, no collisions and produce exactly one bucket for each key. The limitation is that you cannot add or remove keys after finding the hash function, which is perfectly fine.

I found solutions like gperf and CMPH, but those generate C files. This example works at runtime, but produces an infinite loop with certain inputs. Does anyone know a good example I could adapt to C? It doesn't have to be minimal (thought that would be preferred) and I don't care if it takes a long time to generate the hash table. I just need fast, O(1) lookup.

No, you don't.
You said the table is like what, 256 entries maximum? You don't need O(1) in such a case. All the bullshit you have to do to achieve O(1) will cost you more than you gain.

Just store key value pairs in an array, or an std::vector, just like you did before, except that you hash the string keys and use the hashes as keys for the entries instead of the strings. So you'll have pairs of ints, the first one being the hashed string key, the second one being the value. Then do linear search on them.
I guarantee you, that will NOT be slower than using some complex hashmap implementation - definitely not with such low numbers of entries. And it will be faster than your previous approach because you don't have to do string comparisons.
Logged
qMopey
Level 6
*


View Profile WWW
« Reply #957 on: February 18, 2017, 08:38:42 AM »

You can just hash your string with djb2 and I doubt you will have a single collision. Just use a debug-only function to make sure there's no collisions.
Logged
DragonDePlatino
Level 1
*



View Profile WWW
« Reply #958 on: February 18, 2017, 02:58:39 PM »

Ugh...hashmaps are such a pain. I found another perfect non-minimal hashmap implementation, but it frequemtly failed for small inputs. Tried a non-perfect hash function, but the lookup table was huge and I had to dynamically reallocate buckets to resolve collisions.

In the end I just settled with qsort + binary search for log(n) accessal. Not optimal, but it allows me to verify if entity names exist and I can replace it later on without affecting the rest of my code.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #959 on: February 18, 2017, 03:26:59 PM »

Does anyone know of any free cloud hosting offers (or non-cloud) that allow .NET(ASP/MVC) + MSSQL services (the database doesnt have to be mssql, it's just my first preference) ?

EDIT : I just realized that technically I might be able to do this on my linux host using mono + postgres. Anyone ever tried doing that?
« Last Edit: February 18, 2017, 03:38:53 PM by InfiniteStateMachine » Logged

Pages: 1 ... 46 47 [48] 49 50 ... 69
Print
Jump to:  

Theme orange-lt created by panic