In simulation games like Sim City and Factorio, there are numerous interaction between tiny objects that needs to be animated. e.g. random people walking on the sidewalk, then waits for a bus, then board the bus; tiny cars waiting in line for each other at the traffic junction; thousands of items on a convey belt and the robotic arm needs to wait for and item to arrive in front of it to pick it up; conveyor belt sections transferring items from one to another;

I think we cannot check collision detection for every tiny object independently as it will eat a lot of CPU, then what is the technique we can use in these games?

I think I’m really close now, but I’m quite new to Rails framework and Ruby language, I don’t know how to go any further in the progress of turning the current author’s implementation of the feed method into fully using Active Record Query. Please help! Any help would be truly appreciated!

I’m working on a network sniffer program, whose structure uses 3 main classes:

Frame Class – One per monitored frame, holds reference to all the other sub frames

Parse Class – Holds the hex value of the entire frame

Protocol Classes – Individual classes for each network protocol

When a new frame is captured its sent to the Frame() class and put inside a Parse() object for unpacking at each layer:

Inside the frame object, a check is made to see what protocol comes next, that’s then registered up at the top of the frame class (e.g., IPv4 ipv4 = new IPv4(this);), and the Frame instance is passed to that object. When the processing is done in the protocol class, a call is made to one of the switch methods (back in Frame()) to determine which protocol comes next.

I’m trying to find a better class organisation to represent these nested classes. The requirements are that the current protocol class being processed needs to be able to access the fields of the protocol class above it. I was thinking of some sort of inheritance but with so many protocol class types I can’t think of a way to make it work.

The item.content for my field item is ‘active’. However, when I use a comparison operator as seen below, it never equates to True but always False. I thought maybe some spacing issues was the reason, but that seems to not be the case.

Is the content in item.content not a string? I am assuming when I call item.content, its probably a object, but I can’t find any documentation on how to turn a object’s value into a string so it equates to true.

I’m trying to execute a function when setting a certain variable to another value, for example:

myvar = new Action<string>(string s) { /// etc.... }

and the myvar would have a getter and setter like such:

public object myvar { get {return null} set { value("hi there") // not working since "value" is technically not a function } }

so do I need to cast value as a function first? But what if the function is a different kind of function, like Func<string, int, string>, or a simple Action<string> ? And I only want to activate the function if it is a function, so how would I check first?

I couldn’t find any info on what set of compact objects generates the following subcategory:

Let $ k$ be a field of positive characteristic and let $ G$ be either a finite group or a finite group scheme over $ k$ . Then let $ \mathrm{stab}(k[G])$ be a stable model category consiting of finitely generated $ k[G]$ -modules (modulo the projectives). It is a subcategory of $ \mathrm{Stab}(k[G])$ – the stable model category of all $ k[G]$ -modules (modulo the projectives). For $ \mathrm{Stab}(k[G])$ , it is known that compact objects are precisely finitely-generated modules and the simple modules generate $ \mathrm{Stab}(k[G])$ .

More generally, let $ \mathcal{K}$ be a compactly generated stable model category with a set $ \mathcal{C}$ of compact objects and a set $ \mathcal{G}$ of compact generators. What are the compact generators of the subcategory of $ \mathcal{K}$ spanned by objects in $ \mathcal{C}$ ? I realize that this may be unknown, so I’d appreciate any particular examples (I’m more interested in cases where the orignal stable model category has a set of compact generators rather than a single one).

For the definitions I use, I refer to Schwede-Shipley. Of course, substituting the term “stable model category” for “triangulated category” across my question makes no difference.

---- You are about to based to enter information that will be incorporated into your certificate request. For some fields there will be a default value, If you enter '.', the field will be left blank. ---- US []: Michigan []: etc...

Here is where things go sideways. If i just enter through the fields accepting the default values from the .cnf file, i get the following:

In the game I’m developing I need to determine if an action is possible. Whether the action is possible is dependent on a number of factors spread across many objects (ActionDeterminers) in the game. These objects may or may not exist, and whether each of the objects allows the action is dynamic.

I had the idea to implement an Observer-style pattern, where these ActionDeterminers can register themselves with a Subject. When the Subject is asked IsActionPossibleEverywhere, it can then call an interface function on each of the ActionDeterminers: IsActionPossible, and then AND all of their results. Is there a name for this pattern?

The issue I’m facing is that I would also like to notify another set of objects (Observers) of changes in the result of IsActionPossibleEverywhere, using the standard Observer pattern. As far as I can tell, I have two options for this:

Polling. I could simply call IsActionPossibleEverywhere in the main loop, and then notify every Observer when the the result changes from the last call. Unfortunately, the IsActionPossibleEverywhere call could potentially be non-performant (depending on each of the ActionDeterminers).

Give each of the ActionDeterminers the additional responsibility of informing the Subject of when their personal IsActionPossible call might change. The Subject will then call IsActionPossibleEverywhere and inform its Observers if the result changed from the last call. This is considerably more complex and has more potential points of failure.

Please let me know if you have any other ideas for how I could implement this system. Thanks!

I am developing a desktop application that will be run at each station at a call center. It listens for an incoming call, and whenever a call arrives, there are about 30 different classes that need to run various operations. Some of these operations are synchronous, such as setting a flag because they want to log only the first time per call that an event happens. Some of them are asynchronous, such as establishing a socket to another application and sending a start message. At the end of the call, the classes will also have to do some clean up, such as sending an end call message, awaiting a response, and then closing the socket.

Currently, I create all the classes in the composition root, and they live for the life of the application. Each time a call arrives, the state of all of these classes gets reset. Here is a simplified, but working, code sample:

My problem is that this seems kind of fragile. The order in which the objects is started becomes very important, especially if the objects are related. Otherwise you can run into a situation where SocketConnection is feeding messages to MessagePersistence, which hasn’t yet completed its startup. This prevents doing something like running the tasks in parallel.

I feel like it would be better to create these objects as needed, so they can never be in an invalid state. In other words, the call started event would call a factory method to asynchronously create objects. That way, the MessagePersistence dependency passed to SocketConnection will be guaranteed to be in a valid state for receiving messages before SocketConnection is even created.

So my thought would be to make an abstract factory like the following:

The call started event handler would call the factory method to get a collection of IAsyncDisposables, which it would save in a shared data class injected into it. The call ended event handler would also be injected with this shared data class and could just go through all of them and call DisposeAsync to do the cleanup.

Does this technique make sense? I’m used to a factory creating one instance of an object. Is it weird to have a factory that creates a bunch of objects and returns all of them in a collection? Or is that overkill and things are fine the way they are? Or maybe there is some cleaner way that I’m missing? I’m using C# 6.0 if it matters.