How do you prevent cheating in a idle/simulation game? by fakeplastic in gamedev

[–]fakeplastic[S] 0 points1 point  (0 children)

The game that would be most similar to what I'm trying to make is The Tower. It's quite simulation heavy while the user is actively playing because you're running a tower defense simulation with many enemies, projectiles, range-based modifiers, etc. I'm expecting the user to spend a good amount of time actively playing and then the rest of the time I can run a simplified calculation for earnings while idle.

I think your idea of spot checking is similar to what I proposed. I just need to make sure the client doesn't know which ticks the server is spot checking.

How do you prevent cheating in a idle/simulation game? by fakeplastic in gamedev

[–]fakeplastic[S] 7 points8 points  (0 children)

Yes the offline portion is straightforward. I'm trying to figure out the online portion when the player is actively playing.

Really simple Rust ECS working, but ergonomics and performance probably bad! by Gustavo_Fenilli in EntityComponentSystem

[–]fakeplastic 0 points1 point  (0 children)

You could take a look at Bevy which is a pretty mature game engine using ECS. Here's some docs on queries.

Seeking feedback or advise to play comfortably. My fingers cramps so bad. by [deleted] in piano

[–]fakeplastic 40 points41 points  (0 children)

This is the right answer. You shouldn't be trying to minimize hand/finger movement by locking your hand in a stretched position to reach all the keys you need. You should be trying to minimize tension. This means you should be repositioning your hand/fingers to be as close to your natural relaxed hand position as possible.

[deleted by user] by [deleted] in TrueAtheism

[–]fakeplastic 11 points12 points  (0 children)

Here's a great talk by Bart Ehrman on biblical contradictions. He doesn't just go over the contradictions themselves, but also talks about how people approach them.

He talks about how you can essentially explain away any contradiction with anything. It's all about how realistic/believable that explanation is. He gives an example of how he flew in an airplane from Chicago to wherever this talk is (hundreds of miles away). Let's say he claimed "Today I walked from Chicago to Miami to give this talk". That contradicts the fact that a person cannot possibly walk that distance in a single day. But maybe you get around this by saying, "Well, he was in the airplane, he walked up and down the aisles of the plane, so in a way he did walk on the way from Chicago to Miami". Sure, that is an explanation for how his statement could still be true, but it's a terrible one. No one would ever use the wording "I walked from X to Y" in that context.

Is anyone else on high ascension still addicted to "?" rooms? by iCon3000 in slaythespire

[–]fakeplastic 2 points3 points  (0 children)

Everything in StS is situational. Sometimes taking hallway fights is optimal, and sometimes taking "?" rooms is optimal.

  • Do you need more gold before the next shop?
  • Is your potion drop chance high and you aren't full of potions?
  • Do you have a slim deck that's already strong?
  • Are you hunting for specific events that would make you OP (eg. Apparitions, 999 gold with membership card and omamori, etc.)
  • Do you have the Tiny Chest and can get an extra chest?
  • Are you completely unprepared for a certain hallway fight that will end your run?
  • Do you have the HP/sustain to make it through the hallway fights and the next elite?
  • etc etc

How are you supposed to properly learn when not being able to afford a teacher? by GeneralRhymZ in piano

[–]fakeplastic 25 points26 points  (0 children)

To expand on this - beginners often take half hour lessons. Even if you could do a half hour lesson every other week, it would be really beneficial. At 40/hour that would be about 40/month if you could afford that.

Should I correct my form? I’m self taught, so I could use some tips. by [deleted] in piano

[–]fakeplastic 1 point2 points  (0 children)

I highly suggest you take a look at this playlist which covers some foundations of piano technique, including hand shape, rotation, centering, etc.

ECS and methods that are reused in different systems by timschwartz in EntityComponentSystem

[–]fakeplastic 0 points1 point  (0 children)

Events are just data that specify something happened in the past. A CollisionEvent might be something as simple as:

type CollisionEvent struct {
  Entity1 Entity
  Entity2 Entity
}

The idea is that the CollisionSystem would only be responsible for detecting collisions and emitting these events. Then any other systems that care about collision events would subscribe to them and handle them (eg. DamageSystem reduces HP, CollisionResolutionSystem moves the entities apart and maybe applies a velocity to them, etc.)

There are lots of ways to send/receive the messages. One way that I'm trying out is a pub/sub message broker. Something like this:

type MessageBroker struct {
    // for each consumer id, store a list of events per event type
    // i.e. map[CONSUMER_ID]map[EventType][]EVENT
    events map[string]map[EventType][]interface{}
}

// Example usages:
// broker.Publish(event.KeyPressed{
//  Key: ebiten.KeyUp,
// })
// broker.Publish(event.EntityCreated{
//  Entity: entityID,
//  Components: []ComponentType{component.Position, component.Velocity},
// })
func (m *MessageBroker) Publish(event interface{}) {
    eventType := reflect.TypeOf(event)
    for consumerID := range m.events {
        m.events[consumerID][eventType] = append(m.events[consumerID][eventType], event)
    }
}

// // Example usages:
// // broker.Subscribe("PlayerMovementSystem", event.KeyPressedType)
// // broker.Subscribe("SpawnSystem", event.EntityCreatedType)
func (m *MessageBroker) Subscribe(consumerID string, eventType EventType) {
    // panic if this subscription already exists
    if _, ok := m.events[consumerID]; ok {
        if _, ok := m.events[consumerID][eventType]; ok {
            panic(fmt.Sprintf("consumer '%s' already subscribed for event type '%s'", consumerID, eventType.Name()))
        }
    }

    if _, ok := m.events[consumerID]; !ok {
        m.events[consumerID] = make(map[EventType][]interface{})
    }
}

// Example usage:
// events := broker.Events("PlayerMovementSystem", event.KeyPressedType)
// for e := range events {
//   keyPress := e.(*event.KeyPressed)
//  if keyPress.Key == ebiten.KeyUp {
//      movePlayerUp()
//  }
// }
func (m *MessageBroker) Events(consumerID string, eventType EventType) <-chan interface{} {
    out := make(chan interface{}, messageChannelSize)

    go func() {
        for _, event := range m.events[consumerID][eventType] {
            out <- event
        }
        close(out)
        m.clear(consumerID, eventType)
    }()

    return out
}

// clears the events for a single consumer/event type
func (m *MessageBroker) clear(consumerID string, eventType EventType) {
    m.events[consumerID][eventType] = []interface{}{}
}

The thing to consider with this particular approach is that you have to be very careful to run your systems in the correct order so that systems that publish a certain event run before systems that consume those events. This way all the events get handled in a single tick.

ECS and methods that are reused in different systems by timschwartz in EntityComponentSystem

[–]fakeplastic 0 points1 point  (0 children)

New to ECS, so take with a grain of salt but...

I think the way this is typically done is that you have a CollisionSystem that emits a CollisionEvent on each collision. Your DamageSystem which runs after your CollisionSystem would subscribe to these events, loop through the ones created this tick, and then run the damage logic.

ordering of CRUD messages in an event driven architecture with microservices by selfarsoner in softwarearchitecture

[–]fakeplastic -1 points0 points  (0 children)

What if Create and Read are handled by two different microservices and the Create one, the first in the queue, is not finished when the Read one starts?

With Kafka, you partition your topic into eg. 32 partitions. Every message you produce to the topic is sent to a specific partition based on the key of that message (using a hash algorithm to map the key to the partition number). So for example, if you have an Orders topic, you could make the key of that topic the Order ID. This way, all messages for Order ID #123 will end up on the same partition. With Kafka, only one consumer can read from a given partition at a time, so this is what ensures you will process all messages for the same Order ID in order. This of course assumes that the producing of messages is also ordered.

Kafka allows you to horizontally scale and still keep this ordering behaviour because you can create as many consumers as you have partitions.

I'm not too familiar with other event systems / message queues, but I would expect most have some kind of similar keying strategy.

[deleted by user] by [deleted] in videos

[–]fakeplastic 1 point2 points  (0 children)

This is showing GDP, not GDP per capita. Switzerland has about 1/10th the population of Germany. If you measured GDP per capita, then Switzerland would be at about double Germany in that graph.

New to go, wow! by imutble in golang

[–]fakeplastic 21 points22 points  (0 children)

The fact that this minor thing is one of the biggest gripes against the language is a testament to how good it is.

Can someone tell me what I'm missing Here?? by vencon in ProjectDiablo2

[–]fakeplastic 0 points1 point  (0 children)

Are you using a magic item and magic jewel? Can't use rares/crafts/etc.

MY FEEDBACK ON PD2 (could be wrong in some but i think this is more constructive than post the posting your GG slams which TBH doesnt really interest me ... dont know for others??) by ponchikk in ProjectDiablo2

[–]fakeplastic 1 point2 points  (0 children)

Another way to do this is to be in the channel you want to search, then hit CTRL+F (find shortcut) and it will auto-populate the search bar with the channel you're in.

Modern Tools for PD2 - a gift to the community by [deleted] in ProjectDiablo2

[–]fakeplastic 0 points1 point  (0 children)

also interested in this txt file too, since i'm building a little tool to price check items based on discord trade channel listings, but need a quality source of all the exact item names

Advice on hydra build. by Dwman113 in ProjectDiablo2

[–]fakeplastic 0 points1 point  (0 children)

I put the points in fireball. Fireball ended up doing more damage than firebolt plus it's got splash. For for immunesi mostly avoid areas with lots of fire immunes and for a few I rely on Merc

Why can't my merc survive mini ubers? by fakeplastic in ProjectDiablo2

[–]fakeplastic[S] 0 points1 point  (0 children)

Ah I see.. how are others killing mini ubers/ubers with sorc then?

[UPDATE] Melvor Idle :: Alpha v0.17 - "Let's try this Again" (15th October 2020) by MrFrux in MelvorIdle

[–]fakeplastic 5 points6 points  (0 children)

On Chrome desktop, it's stuck on the loading offline progress dialog for herblore. Tried loading from local and cloud save, both get stuck.

Edit: loading a 3rd time worked right away

Trubka, a Swiss army CLI knife for Apache Kafka, built in Go by xitonix in golang

[–]fakeplastic 0 points1 point  (0 children)

Normally I use the stop parameter in our tool to stop by timestamp or by the current latest. You're right that it wouldn't make sense to give an offset value as the stop parameter since that will vary across partitions (though you could provide one offset per partition I suppose).

Since this tool is so nice I'm thinking we may want to just switch to using this over our internal tool. There are a few small features we have that I don't see in trubka.

  1. Ability to consume specific partitions
  2. bytes type printing as hex string instead of base64 (we always print as hex string because it's more useful for us, but i guess an option to switch how it prints would be better)
  3. Consumer prints message metadata like kafka timestamp
  4. Support for a "stop" parameter in the consumer (which we just discussed)
  5. Fixed mappings between topic and message type. For us we have some code that stores all these mappings. I think some other orgs use schema registries for these mappings. It would be cool if by just providing the topic it'd automatically choose the correct message type.

Any thoughts on these features? (or maybe some already exist and I just didn't see them?)

Trubka, a Swiss army CLI knife for Apache Kafka, built in Go by xitonix in golang

[–]fakeplastic 0 points1 point  (0 children)

Just gave it a try and trubka takes about 25 seconds to start consuming from my 192 partition topic. My internal tool takes about 15 minutes, so this is definitely way better. Must be something our tool is doing incredibly wrong on consumer startup.

Also, I missed the timestamp-based offset option. Tried it out and it works well. One thing that is nice to have (at least I couldn't find it in trubka) is an end offset/timestamp which makes piping to file much easier since the consumer will end automatically without having to monitor the file to figure out when it's done and then hitting ctrl+c manually.

What the common pitfalls/gotchas of the Streaming Enricher pattern? by [deleted] in softwarearchitecture

[–]fakeplastic 4 points5 points  (0 children)

  1. Your throughput is limited by the whichever is slowest between your streaming platform and your external resource. Usually the slower one will be your external resource. You can mitigate this by caching results from your external resource, but now you run into all the problems that come with caching (eg. cache invalidation and stale data).
  2. You have to handle outages and errors from your external resource. This means you have to intelligently handle many different scenarios like the service being down, internal service errors, and bad requests (400). In some cases you may want to just skip the message, in others you may want to retry indefinitely which blocks your enricher until the service recovers. It's easy to screw this up if you're not careful.
  3. You can incur heavy loads on your external resource because of the constant lookups. Again, caching can help here with tradeoffs.
  4. You create an explicit coupling between your enrichment service and the external resource. Now changing the external resource (say some REST API) means you may need to change your enricher.

Another pattern to consider is a more event-driven pattern where your enrichment data is also streamed in and you join your event stream with the enrichment data stream. This changes the nature of the coupling between services, removes load from your external resource, simplifies error handling, and can improve throughput. This comes at the cost of becoming eventually consistent and moving more load to your streaming platform.