This is a follow-up question to modelling population density in a mock model: Modelling population density in AnyLogic
Now I wanted to implement those changes in my main model. The functionality works, and the agents are generated at the correct places, but somehow they appear behind the image. If I set the the image to not visible, I can see that the agents are actually generated.
Short recap of how the functionality works:
I have traced the borders of regions using a polyline on top of an image of the country. Next, I have created a function to let agents appear in a random location inside one of the polyline shapes.
I am probably overlooking something simple, but could you give me any pointers?
Thanks!
This should be simple. Bring your agents to the front as shown in the following image:
You can experiment also sending your image to back.
Related
I'm running a simulation on a school building on Anylogic PLE version. I used pedGoTo block for Peds (as students) to go to their lockers, using a polygonal area and attractors for each locker. The model runs for a bit but eventually I get the following error:
root.ToLockers.pedGoToTarget:Unreachable target
Click on this link to see a picture of my area and attractors
Click on this link to see a picture of the error during the simulation.
(I'm new to stack overflow and for some reason I'm not allowed to embed pictures)
The peds try to go through walls to reach the attractors. I made sure to draw the polygonal area around walls and any object that might be in the way to avoid this but it keeps happening. It happens with a different attractor every time I run the model so it's not just a specific one. The attractors are set to Random.
How can I fix this to avoid peds trying to go through walls?
It's not exactly clear form the image but my advice would be to try some more debugging of reachability using the following method:
Use the same layout
Create a separate flow where an agent is injected at a random point on the layout
Make the agent attempt to reach that location
There can be two outcomes:
The point is unreachable from anywhere - meaning that a mistake was made in drawing the layout at the destination (locker) location
The point is unreachable from some locations - meaning that there are issues with pathfinding in which case it is advisable to create intermediate points that should be reached before targeting final destination (locker)
For research purposes, I would like to create a Unity VR 3D application that (more or less) simulates the foveal field of view of a person. This means, in particular, I would like to render the whole environment of the application in the full field of view, but certain objects of interest I only want to render in the foveal area.
For the purpose of explaining the problem, I created a simple 2D picture. Please assume it's 3D. In the picture, the green area is the peripheral field of view, and the yellow area is the foveal field of view. The whole environment, like walls, sky, etc., should get rendered in the green and in the yellow area. Particular objects of interests, here the flowers, however, should only get rendered only in the yellow area and - importand - these objects should get cut off when reaching the green area. With this approach, I want to force people moving their head instead of just moving the eyes.
Any idea how to achieve this? Is it possible to use a kind of mask or filter? Or do I need a stencil shader? I looked around but could not find the correct approach.
I'm thinking of making city transport simulation game, based on tile map like simcity. Because transportation is the main component, I'm not gonna describe city thoroughly, like drawing all the buildings or others. But I need to divide the city to districts and villages.
I want them to be generated randomly, based on tile map system - Actually this doesn't have to be tile based, but I don't have any better idea to generate randomly divided districts.
The problem is there are literally to many tiles. Of course I won't make all the tiles to GameObjects, but array storing the information of tile just gets like 4000x3000 (for 12,000,000 tiles). Is it okay? I think this will seriously slow down the game.
I searched for many ways to generate tile maps, but those tile maps are for RPGs.. they are just sprites and background.
My tiles should change dynamically(maybe the colors, and I'm making the game with 3d so maybe the tile can have height that may change), with showing the status of that tile(a small region of the city). What will be better way for my needs?
Thank you!
The short answer is that you should generate a mesh to represent your tiles. This will allow you to represent a large number of tiles as a single game object.
It is not as troublesome as it sounds. I actually went through this myself recently, and have written a step-by-step guide on how to do it, and how to solve a host of other issues I ran in to working with tiles:
http://matthewlynch.net/2017/02/19/efficient-artefact-free-2d-tile-mapping-in-unity-5-5/
The only caveat I would mention (this is discussed in the tutorial, but not directly addressed) is that you should still divide your map up in some way.
I would not recommend exceeding 100x100 tiles in a single mesh, and in fact would recommend breaking it up even further. But once you get the basics of tile->mesh rendering up and running, this is not difficult to do.
I have to code a model that one part of this model is done
on patches and turtles, and another part only display
an image. I want to have these two parts in seperate
view simultaneously.
For example, my model is that it creates 100 turtles with
random xcor & ycor. I code that these turtles move around
view in random path. Now, I want show an image in
another seperate view and these two views (1. view of moving turtles 2. view of displaying an image) is displayed
simultaneously. My problem is that how can I have two seperate
views in NetLogo.
Thanks a lot in advance.
The feature you want doesn't really exist in NetLogo.
Not really. But check out https://github.com/NetLogo/NetLogo/wiki/Multiple-views-via-HubNet :
Users often ask if they can have more than one view in their model and show different things, or show the same things differently, in each one.
Hopefully in the future we'll provide this capability directly. But it is already possible now using HubNet with local clients. It's a bit awkward, but it works. [...]
I want to color the country on selection of the country from a tableView. Can you help me please?
Considering your case, let me give you a heads up that this would require edge detection (so if you haven't done that before, it will take a LONG time), though not lots of it and the following is just one way of approaching this problem:
1) Take out an image context from the map you have.
2) Apply relevant edge detection algorithms in the area you want and use a bright color to differentiate. Note that this way, the inside would not be colored and I can't tell you for sure if that's possible or not.
3) Add that context as a subView on top of the map.
Also take a look at the Quartz 2D programming guide for more tips.
I would suggest something different, though. Keep pre-stored images for all the possibilities and just put a UIImageView with that as its image in front of the map - this will save you a lot of headache.