How to define ahead vehicle in veins? - veins

I am using omnetpp 5.4.1, veins 4.7.1 and sumo-0.30.0. I want to define the vehicles that are ahead of other vehicles.
for instance I want that just ahead vehicle send message but behind vehicle only receive messages whose senders are ahead vehicles.
how can I do it I appreciate any help

In a small simulation, you could simply note down the module ID of such vehicles and configure your application to only send messages if the ID is one of the special ones you wrote down.
In a large simulation, it is probably easier to think how a vehicle would determine its role in real life - e.g. based on exchanged messages - then implementing this mechanism in your simulation.

Related

Anchor smart contract where two parties pays the contract and one of them get's the amount

i'm new to solana development and working on a personal project using the anchor framework.
I fould some resources like solana escrow example and some youtube videos on solana PDA but not able to understand it completely. What i want to achive is:
Let's sat there are two players A & B, both pay same amount (ex: 0.01 SOL) to the contract, based on a condition or i invoke a function (not sure how it's done) one of the player is paid the amount (winner).
How can i achive this using the solana (Anchor), i would really appreciate some resource.
Thanks 🙂
Couple things going on here -
Think of a PDA, 'Program Derived Address', as an account address derived from the address of your program and whatever you salt it with, instead of a random address. This is useful for storing some data that you'd like to be able to grab later without having to remember the address, and rather just needing to remember what you salt this with. In your case, you'd likely want to create an account with a PDA salted with some kind of GameID or player (for instance, player A creates a game, and you generate a PDA with your program address and player A's pubkey).
PaulX's Escrow Program is a excellent resource, however he is not using Anchor framework and is instead implementing it natively, which sounds out of scope for what you're working on.
I think my dutch token auction program may be of some use for you, as far as PDA's go. Additionally, check out the Solana Cookbook, or more specifically the section on sending SOL, which is a method within the SystemProgram.
Solana/Anchor is awesome, but it's difficult without scouring the docs. The Solana Cookbook and the Anchor Discord Server are your friends!

Blockchain implementation in IoT environment

I'm new in blockchain implementation but I think that I understand how it works. The problem is that we want to implement blockchain in our IoT platform and all implementations and samples that I found are focus in financial environments (bitcoins).
Reading how it works I asume, that we will create a block for every message of every device. But I don't know if it is the best approach because we have a lot of vehicles (around 1000) that send us their position every 5 second (17280 messages by vehicle in a day). I'm worried about the volumen of the data. I'm not sure if it is that how we have to used it, or is better to create a block with a compilation of all information of every vehicle in a day.
I hope that you can understand my question because my English is not very good :)
Thanks in advance.

How to put Amazon Mechanical Turkers in a waitlist?

I am a social psychology researcher. I have developed an online game that identifies players' specific behavioral factors. Each game requires a specific number of players to play simultaneously. In addition, all players should pass a screening phase through which we identify their skills and my program matches players with similar skills to play with each other.
My problem is how to make the players go through the screening phase and wait for others to pass the screening phase before starting the games? Is there anything on MTurk like a wait list? What is the average number of users who participate in a typical study at the same time? Is it possible to make them wait till we reach a specific number of players in the wait list?
Otree supports this functionality. As user Thomas pointed out, wait pages accomplish it.
In particular, when defining a View (same you would in Django) you just specify the variable wait_for_all_groups to be True. The app will not progress until all participants arrive. The definition of the wait page can be a simple as below, but you can also trigger methods like the reassignment of groups with wait pages.
class MyWait(WaitPage):
wait_for_all_groups=True
In the past, I have put such a wait page at the beginning of the instructions for the game.

Akka Actor: Path lookup efficiency

I am creating actors that represents physical devices and their state. As devices come online I create them "on demand" by sending and Identify message to the actor's path and then if it does not exist yet I create one. Potentially, there could be several million of these devices.
My concern is that the Identify look-up will take a performance hit as the number of actors increases. Is this a valid concern?
I was considering using a router strategy to segment the actors, but then I found that searching on the path with a wild card for the router yielded ActorIdentities from each router. I assume that a ConsistentHashingRouter would suit this scenario, but before I go down that rabbit hole I just want to make sure I am not optimizing prematurely.
The entity which creates an actor is only its parent (there no other way), which means that that parent actor does not need to use Identify at all, just check context.child(name).isDefined. That is very efficient, although you might want to shard your devices across multiple parents if you really have a massive number of them.

Collecting online statistics for a non-online game

I want to collect statistics from an RPG game. This data should be stored in one place, online, so I can analyse it later.
Example of events -
Player achieved something
Player win the game using this way
So the question is : what is the best way, with minimum effort, to implement this functionality ?
I understand that I will have anyway to implement message sending functionality on the game's side.
I know that this can be implemented using Amazon SQS, but this doesn't seem to be the easiest way.
Idealy - it should be like that : I just send data from game, in form of messages. After that - I can retrieve the data from cloud storage and parse/analyze it.
P.S. I don't want a server at home
If you don't want to use an existing service, you can build a simple webapp & receive events by REST urls.
Example:
http://my.statistics.server/achieve?player=123&category=456&level=789
http://my.statistics.server/win?player=123&score=12345
You could also packet the events up & append a keyed hash, if you want to make falsification a bit more difficult.
Example:
http://my.statistics.server/record?packet=<base64 data..., plus HMAC>
See:
https://en.wikipedia.org/wiki/Hash-based_message_authentication_code
Depending on the platform you are going to write the game on, but I have used Flurry Analitica and it worked for my mobile games like
Flurry Analitics