So, I am making a roguelike game using Python as my language. I am using NumPy and tcod currently for libraries, and I have been trying to figure out how I can take the procedurally generated map "cells," and append them to indexes within a NumPy array.
Context: I have followed the 2020 tcod tutorial found on the roguelikedev subreddit to get to the point I am at now (Here is a link to the source on GitHub. I have made only trivial changes to colors and such so far). I've coded simple stuff in Java before but never messed with Python much, nor have I ever tried something like this. In short, I feel a little lost.
Basically, I want to change the way the maps are generated. Currently, an area the size of the terminal is preocedurally generated, and when the player moves down some stairs, a new map is generated, and the old one is basically thrown away. The idea being that it's a dungeon. I don't want this. My goal is to have it be an open map, where the player can go North, South, East, or West.
This would require the engine to save the map (I assume to a list or an array or something), and keep updating it whenever the player moves to a new cell on the grid.
Now I'm not asking anyone to write the code for me, but I just can't seem to really wrap my head around how to go about actually doing this.
So far, my problem is I don't know exactly how to put the gamemaps onto a list. Should I make them entries within a dictionary? Use a list? Is what I'm trying to do even possible?
Figured I'd give this site a shot. Any help is appreciated.
Related
I am new to this forum, so this will be my first question ever (by having used the forum for several years now :D).
What's my Problem:
I am working in a Company now, where we want to automate processes like finding lowest and/or highest points/lines in classified 3d point cloud data (such as walls, roofs, ...). So I have a classified point cloud where I don't want to draw the lines myself of the lowest and highest points of walls or roofs or anythin, but figure out how python could do the job for me instead!
What I'd like to know:
To start, I'd like to know what is the best and proper way to process point cloud data using python? I came up with several ideas by simply google searching (such as laspy, open3d, ...) but I am very confused, which one might be the library I'd need for my mission or where I should really start to put effort in learning to deal with a certain package..
So, I am grateful for your answers and suggestions (maybe there exists a similar entry which I haven't found already?).
Thanks
Max
You might want to check out the Open3D Tutorials found here.
There isn't one that does exactly what you're looking for, but pretty dam close (IMO).
I'm not interested in doing what you're doing, but if I was this is where I'd figure it out.
as my question mentioned, does anyone know a way to track arbitrary, previously unknown objects
from a video feed with opencv-python?
Lets say we have a table and there are different objects on it. Suppose the objects begin to
move as if by magic. Is there a possibility to keep track of each object?
I read something about Background Subtraction that highlights objects in the foreground.
And I read something about Optical Flow that gives information about which pixels have
changed compared to the previous frame.
I am a beginner in image processing and I am looking for a way to put it all together
and track arbitrary, previously unknown objects.
I don't want to use a neural network in advance to find and classify the objects. I want
to track the objects as soon as they begin to move. One can assume that the camera is in a fixed position
with a fixed perspective onto the table. Is there a way to track an object
that has just begun to move? All I want to do is drawing a rectangle around the object and keep track of
it.
I don't want to do a classification of objects. I am not interested in the type of object, I am only
interested in the movement of the object.
Can someone give me an impulse?
Code examples would be very welcome.
i want to do something as a parametric study in Abaqus, where the parameter i am changing is a part of the assembly/geometry.
Imagine the following:
A cube is hanging on 8 ropes. Each two of the 8 ropes line up in one corner of a room. the other ends of the ropes merge with the room diagonal of the cube. It's something like a cable-driven parallel robot/rope robot.
Now, i want to calculate the forces in the ropes in different positions of the cube, while only 7 of the 8 ropes are actually used. That means i have 8 simulations for each position of my cube.
I wrote a matlab script to generate the nodes and wires of the cube in different positions and angle of rotations so i can copy them into an input file for Abaqus.
Since I'm new to Abaqus scripting etc, i wonder which is the best way to make this work.
would you guys generate 8 input files for one position of the cube and calculate
them manually or is there a way to let abaqus somehow iterate different assemblys?
I guess i should wright a python script, but i don't know how to make the ropes the parameter that is changing.
Any help is appreciated!
Thanks, Tobi
In case someon is interested, i was able to do it the following way:
I created a model in abaqus till the point, i could have started the job. Then i took the .jnl file (which is created automaticaly by abaqus) and saved it as a .py file. Then i modified this script by defining every single point as a variable and every wire for the parts as tuples, consisting out of the variables. Than i made for loops and for every 9 cases unique wire definitions, which i called during the loop. During the loop also the constraints were changed and the job were started. I also made a field output request for the endnodes of the ropes (representing motors) for there coordinates and reaction force (the same nodes are the bc pinned)
Then i saved the fieldoutput in a certain simple txt file which i was able to analyse via matlab.
Then i wrote a matlab script which created the points, attached them to the python script, copied it to a unique directory and even started the job.
This way, i was able to do geometric parametric studies in abaqus using matlab and python.
Code will be uploaded soon
I am trying write an Abaqus/Python script that will select all the elements that "belong" to a certain face. I.e. taking all the elements that have a connection to one face of a meshed cube (I will calculate the total force acting on that face for force-displacement or stress-strain curves later).
If I do it using the GUI I get:
mdb.models['Model-1'].rootAssembly.Set(elements=
mdb.models['Model-1'].rootAssembly.instances['Part-1-1'].elements.getSequenceFromMask(
mask=('[#0:5 #fff80000 #ff #f #ffe00000 #f000000f #3f',
' #0:6 #fffe #c0003f00 #3 #3fff8 #ffc00 ]', ), ), name='Set-1')
But, getSequenceFromMask does not work in a general case. I tried using findat with no luck.
Is there a way to do that?
define a face set on the part or assembly:
part.Set('facename',faces=part.faces.findAt(((1,0,0),),))
where (1,0,0) is a coordinate anywhere on the face. (Don't use a point on a edge/corner though)
then after meshing you can access the elements attached to that face, something like:
instance.sets['facename'].elements
note if you want to get those elements on the odb after running an analysis it is a little different:
instance.elementSets['FACENAME'].elements
note that the set name is upcased on the odb..
One can select an specific element from its label by using:
mdb.models['model-name'].parts['part_name'].elements.getFromLabel(lable=element_id)
This way it is not necessary to have information about the coordinate of the element. Only the element id is enough to access to it.
You are apparently using a Macro in order to get the location of your surface in order to pick the set using Python. The issue is: the Macro facility uses getSequenceFromMask() by default and isn't very user-friendly...
Fortunately, this default option can be changed! One just needs to run the following line of code:
session.journalOptions.setValues(replayGeometry=COORDINATE,recoverGeometry=COORDINATE)
Now when you record a macro using the MacroManager, you get findAt() which is what you want.
Extra TIP:
You can include this piece of code in the onCaeStartup() function in your custom_v6.env file. It will then run every time you open CAE.
C:\Program Files\Dassault Systemes\SimulationServices\V6R2018x\win_b64\SMA\site\custom_v6.env
I had this issue myself a few days ago. Maybe I'm wrong but as far as I know, there is no way to directly select particular elements. You can select them with a "Bounding Box" or a "Bounding Sphere" or you can get them by your parts/ instances faces and cells. If you need to select the elements in a more specific way then you can get them by the nodes with which they are connected. You can use the "findAt" command with these nodes and get the elements by the "getElements()" command.
That is how I solved it and it works pretty fine. If there are other ways to solve that I will be happy to hear them because this is sometimes really frustrating.
Cheers
I want to create a table with Python that looks like a simple excel table, therefore I have already used the pyExcelerator. But now I thought about just using pyplot.table which seems to be very easy. However, I need to make some changes and I don't know if this is possible in vpyplot.table`.
For example I want to add a cell in the upper left corner and I also want to make two cells beneath the cell t+1 (see the table example below).
So, is it possible to do these changes in pyplot.table or should I better use another way to make tables?
Building a program to generate an table in a image for inclusion into your word document is a bit overkill. Its a lot of added work and completely unnecessary effort. Make the table in Excel and then paste it into Word. It'll look good and will be easier to update and change.
If you are using this as an excuse to learn something new, that is all well and good, but you need to give us more to help you with. SO isn't a code factory. Offer up what you have tried, and samples of code you are having trouble with. We can help with that.