FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál

Is there any method to perform this action automatically or all at once? [closed]

I would like to know if there is a way to build a js, a script for the following: https://www.chunkbase.com/apps/seed-map#seed=999&platform=bedrock_1_21&dimension=overworld&x=1214&z=-353&zoom=0.82 so that with a single key combination, or just by pressing a button, all the generated coordinates can be selected and displayed on the screen, if possible, functional for Tampermonkey

  • ✇Recent Questions - Game Development Stack Exchange
  • How to live on sphere?Tony Max
    What I want to achieve I want to generate sphere planet world, seamless of course, for RTS game like Planetary Annihilation: TITANS, which means I want: place walking agents on sphere, move them on a sphere surface, be able to do A* pathfinding generate polygonal regions on sphere like Voronoi have world divided by chunks (possibly reduced to 1D array) to effectively perform calculations like local avoidance. generate seamless surface heightmap based on noise functions AND not to store this hei
     

How to live on sphere?

What I want to achieve

I want to generate sphere planet world, seamless of course, for RTS game like Planetary Annihilation: TITANS, which means I want:

  • place walking agents on sphere, move them on a sphere surface, be able to do A* pathfinding
  • generate polygonal regions on sphere like Voronoi
  • have world divided by chunks (possibly reduced to 1D array) to effectively perform calculations like local avoidance.
  • generate seamless surface heightmap based on noise functions AND not to store this height map as a texture but just store height overrides in chunks. This way I can have just uint seed and overrides instead of keeping huge heightmap texture.

How would I do it in seamless 2D world

In 2D space things are really simple even if your world one axis seamless: 2D map can be imagined as cylinder, or both axis are seamless: 2D map can be imagined as torus. enter image description here

Coordinates

They are just float x, y. Moving is just adjusting coordinates. Distance between 2 points is just distance between 2D vectors. Seamlessness of moving is achieved by % operation with coordinates, like x = x % x_max.

World as 2D grid

2D world can be represented as 2D grid where each cell is a chunk with which I can effectively store and access data, because 2D grid is reduced to 1D array. 2D position can be easily converted to chunk index and back.

Heightmap noise generation

Seamless noise can be tricky, but here we have golden treasure of map noise generation from red blob games.

Presenting world and LOD

I would use simple plane mesh with rectangular connection of triangles to represent terrain of 2D world. LOD then could be implemented by recursively add vertices into mesh cells like tree. Again with 2D world it is simple because mesh / data / LOD are all grid based.

Problems of doing same with sphere world

Because claimed / x-seamless / xy-seamless 2D worlds are all not really the sphere (they are plane / cylinder / torus in terms of wrapping) there can't be 1:1 transformation between 2D and spherical 2D world.

When trying to wrap rectangular around sphere something should be disturbed. It could be that we actually run all logic in 2D but project coordinates on sphere, but we will get disturbed positions near poles. enter image description here

Or we can run logic on sphere and project positions back to 2D then we will get disturbed 2D representation like what happens with earth map when it represented in 2D, which is what called Equirectangular projection. enter image description here

One way or another I need some "grid" representation of chunks, because in the end I need to test what chunks of sphere camera see and effectively cull objects which are not in visible chunk.

Cubemap solution

Representing sphere as cubemap kills all problems working with sphere, because sphere now represented as 6 2D grids.

  • Constructing mesh is just get cube (or six plane faces) with vertices adjusted in a way they lay on unit sphere. LOD is now also possible because we can work with faces separately.
  • Store and access needed chunk now isn't a problem also because now we are back on 2D grids. enter image description here

Problem with cubemap coordinate system

Many thanks again to red blob games and this article in particular. Here we can find a way to implement coordinate system for cubemap world. But moving across faces is a huge mess, not only because it require to map direction for each face but also because when both x and y have to be wrapped to another face it becomes ambiguous which face to choose. So moving on cube map becomes problematic for corner cases.

Use cubemap only for data

I think it is possible to use spherical coordinate system latitude and longitude and reimplement common operations like moving, getting distance, etc. but on sphere instead of 2D surface and use cubemap representation only for storing data in and read from chunks.

Where to live finally?

  • Living on sphere means to deal with spherical calculations which are more complex to understand and expensive because require trigonometrical functions. But then coordinate system becomes natural because we actually live on sphere and just map it on cubemap when need to work with rectangular chunks.
  • Living on cubemap means to deal with cubemap coordinate system which is complex core of all this approach also producing prohibited moving cases. But in return we get nice and simple 2D calculations for everything with natural storing data in rectangular chunks and only use sphere to represent our world in 3D as a planet.

What I want as an answer

Maybe I already answered my question and there is no place to answer anymore and I just need to chose one way or another comparing pros and cons. But maybe I miss something, maybe there is another smart way to do what I need without overcomplicating everything. I will appreciate any advice.

Libgdx modelinstance rotates about some imaginary circle circumference. NOT its own center y axis! [duplicate]

So confused about how rotation works based on local y axis of modelinstance:

This how I create the modelinstance:

 //create a red box:
            ModelBuilder mBuilder = new ModelBuilder();
            mBuilder.begin();
            Material mat = new Material();
            mat.set(PBRColorAttribute.createBaseColorFactor(Color.RED));
            MeshPartBuilder mpartbuilder = mBuilder.part("boxy", GL20.GL_TRIANGLES, VertexAttributes.Usage.Position|VertexAttributes.Usage.Normal,mat);
            BoxShapeBuilder.build(mpartbuilder,10f,0,10f,2f,2f,5f);
            ModelInstance mInstance = new ModelInstance(mBuilder.end());

From code above I can see that modelinstance center is at 10f, 0, 10f.

I create the camera as such: viewing down on the modelinstance:

camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), 
Gdx.graphics.getHeight());
camera.position.set(10f,10f,17.5f);
camera.lookAt(10f,0,10f);  //so its looking at the center of 
modelinstance

//so, the up is the Y value of the center point of the modelinstance!
// I did also try:  Vector3.Y 
camera.up.set(new Vector3(10f,0,10f).Y); 
    camera.near = 0.1f;
    camera.far = 300f;

camera.update();

I also try to rotate the modelinstance as such:

if(Gdx.input.isKeyPressed(Input.Keys.B)){

        if(true) {
            camera.lookAt(10f,0f,10f);
            Gdx.app.log("rotating", "see");
            Matrix4 mat41 = new Matrix4();
            mat41.set(ThreeDWithMultipleScreensGame.gameMainPlayerReference.transform);
            //mat41.rotate(new Vector3(10f,0,10f),new Vector3(0,1f,0));
            mat41.rotate(camera.up.Y, 10f * delta);
            //mat41.setToRotation()
            ThreeDWithMultipleScreensGame.gameMainPlayerReference.transform.set(mat41);
            ThreeDWithMultipleScreensGame.gameMainPlayerReference.transform.getTranslation(ThreeDWithMultipleScreensGame.playerCurrentPosition);

            camera.update();
           
        }

        if(false)
        try{
            ThreeDWithMultipleScreensGame.gameMainPlayerReference.transform.rotate(new Vector3(10f,0,10f).Y,20f);
            camera.lookAt(10f,0,10f);
            camera.update();
        } catch (Exception e) {
            e.printStackTrace();
            Gdx.app.log("the_error","see: " + e.toString());
        }
    }

Both ways of rotating make the modelinstance rotate NOT about its center! It follows the path of an imaginary circle that is centered who knows where!

  • ✇Recent Questions - Game Development Stack Exchange
  • Mouse coordinates to world space offsetting?Valtsuh
    so i'm trying to make a mouse to world space function, and I seem to always end up with the rays cast offsetting. I've looked at numerous tutorials, tried numerous examples. Tried with glm, gluUnProject, but what ever I try I always seem to get similar results to what my function gets. Which looks like something below: Not sure which part of code to paste, so, The function itself: drx::util::V3 MTW(double z) { double w = drx::gfx::canvas.w; // 640.0; double h = drx::gfx::canvas.h; // 48
     

Mouse coordinates to world space offsetting?

so i'm trying to make a mouse to world space function, and I seem to always end up with the rays cast offsetting.

I've looked at numerous tutorials, tried numerous examples. Tried with glm, gluUnProject, but what ever I try I always seem to get similar results to what my function gets. Which looks like something below: offset

Not sure which part of code to paste, so,

The function itself:

drx::util::V3 MTW(double z) {
    double w = drx::gfx::canvas.w; // 640.0;
    double h = drx::gfx::canvas.h; // 480.0;
    double mx = drx::view::window.mouse.x;
    double my = drx::view::window.mouse.y;
    double x = (2.0 * mx) / w - 1.0;
    double y = 1.0 - (2.0 * my) / h;
    drx::util::V4 clip = {x, y, z, 1};
    drx::util::MAT4F viewInv = this->GetView().Inve(); // inverted view matrix
    drx::util::MAT4F projectionInv = this->projection.Inve(); // inverted projection matrix
    drx::util::V4 wld = viewInv * projectionInv * clip;
    wld = wld.Divide(wld.w);
    drx::util::V3 ray = { wld.x, wld.y, wld.z };
    return ray;
}

With given z value set to 1.0, I get what was displayed in the gif, but if I set z to -1.0, I get a tiny line:

tiny line

View matrix:

this->view.matrix[0][0] = this->right.x;
this->view.matrix[0][1] = this->right.y;
this->view.matrix[0][2] = this->right.z;
this->view.matrix[1][0] = this->up.x;
this->view.matrix[1][1] = this->up.y;
this->view.matrix[1][2] = this->up.z;
this->view.matrix[2][0] = this->front.x;
this->view.matrix[2][1] = this->front.y;
this->view.matrix[2][2] = this->front.z;
this->view.matrix[0][3] = -this->position.Dot(this->right);
this->view.matrix[1][3] = -this->position.Dot(this->up);
this->view.matrix[2][3] = -this->position.Dot(this->front);
this->view.matrix[3][3] = 1.0f;

Projection matrix:

float sf = tanf(fov * 0.5);
this->matrix[0][0] = 1.0f / (ar * sf);
this->matrix[1][1] = 1.0f / sf;
this->matrix[2][2] = -((f + n) / (f - n));
this->matrix[3][2] = -1.0f;
this->matrix[2][3] = -((2.0f * f * n) / (f - n));

The lines in the image and gif, mean, red == camera.front, blue == camera.up and green == camera.right vectors.

I'm not too sure what sort of lines I should be seeing, so if anyone can shed some light into all that, I'd be very grateful. Will provide more info, if asked.

  • ✇Techdirt
  • Elon Only Started Buying Up Twitter Shares After Twitter Refused To Ban Plane Tracking AccountMike Masnick
    Ever since he first started to make moves to purchase Twitter, Elon Musk has framed his interest in “rigorously adhering to” principles of free speech. As we’ve noted, you have to be ridiculously gullible to believe that’s true, given Elon’s long history of suppressing speech, but a new book about Elon’s purchase suggests that from the very start a major motivation in the purchase, was to silence accounts he disliked. According to an excerpt of a new book by reporter Kurt Wagner about the purcha
     

Elon Only Started Buying Up Twitter Shares After Twitter Refused To Ban Plane Tracking Account

20. Únor 2024 v 21:10

Ever since he first started to make moves to purchase Twitter, Elon Musk has framed his interest in “rigorously adhering to” principles of free speech. As we’ve noted, you have to be ridiculously gullible to believe that’s true, given Elon’s long history of suppressing speech, but a new book about Elon’s purchase suggests that from the very start a major motivation in the purchase, was to silence accounts he disliked.

According to an excerpt of a new book by reporter Kurt Wagner about the purchase (and called out by the SF Chronicle), Elon had reached out to then Twitter CEO Parag Agrawal to ask him to remove student Jack Sweeney’s ElonJet account (which publicly tracks the location of Elon’s private plane). It was only when Agrawal refused, that Elon started buying up shares in the site.

The excerpt slips in that point in a discussion about how Jack Dorsey arranged what turned out to be a disastrous meeting between Agrawal and Musk early in the process:

The day after, Dorsey sent Musk a private message in hopes of setting up a call with Parag Agrawal, whom Dorsey had hand-picked as his own replacement as CEO a few months earlier. “I want to make sure Parag is doing everything possible to build towards your goals until close,” Dorsey wrote to Musk. “He is really great at getting things done when tasked with specific direction.”

Dorsey drew up an agenda that included problems Twitter was working on, short-term action items and long-term priorities. He sent it to Musk for review, along with a Google Meet link. “Getting this nailed will increase velocity,” Dorsey wrote. He was clearly hoping his new pick for owner would like his old pick for CEO.

This was probably wishful thinking. Musk was already peeved with Agrawal, with whom he’d had a terse text exchange weeks earlier after Agrawal chastised Musk for some of his tweets. Musk had also unsuccessfully petitioned Agrawal to remove a Twitter account that was tracking his private plane; the billionaire started buying Twitter shares shortly after Agrawal denied his request.

In other words, for all his posturing about the need to purchase the site to support free speech, it appears that at least one major catalyzing moment was Twitter’s refusal to shut down an account Elon hated.

As we’ve pointed out again and again, historically, Twitter was pretty committed to setting rules and trying to enforce them with its moderation policies, and refusing to take down accounts unless they violated the rules. Sometimes this created somewhat ridiculous scenarios, but at least there were principles behind it. Nowadays, the principles seem to revolve entirely around Elon’s whims.

The case study of Sweeney’s ElonJet account seems to perfectly encapsulate all that. It was widely known that Elon had offered Sweeney $5k to take the account down. Sweeney had counter-offered $50k. That was in the fall of 2021. Given the timing of this latest report, it appears that Elon’s next move was to try to pressure Agrawal to take down the account. Agrawal rightly refused, because it did not violate the rules.

It was at that point he started to buy up shares, and to present himself (originally) as an activist investor. Eventually that shifted into his plan to buy the entire site outright, which he claimed was to support free speech, even though now it appears he was focused on removing ElonJet.

At one point, Elon had claimed that he would keep the ElonJet account up:

Image

But, also, as we now know, three weeks after that tweet, he had his brand new trust & safety boss, Ella Irwin, tell the trust & safety team to filter ElonJet heavily using the company’s “Visibility Filter” (VF) tool, which many people claim is “shadowbanning”):

Image

Less than two weeks later, he banned the account outright, claiming (ridiculously) that the account was “doxxing” him and publishing “assassination coordinates.”

Image

He then also banned Sweeney’s personal account, even as it wasn’t publishing such info. Followed by banning journalists who merely were mentioning that @ElonJet had been banned.

At this point it should have been abundantly clear that Musk was never interested in free speech on Twitter (now ExTwitter), but it’s fascinating to learn that one of the motivating factors in buying the site originally — even as he pretended it was about free speech — was really to silence a teenager’s account.

❌
❌