Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bunch of math2d and 3d features and test programs #60

Draft
wants to merge 1 commit into
base: unstable
Choose a base branch
from

Conversation

UbuntuJackson
Copy link

/math2 contains features for ray to line intersection. Can be used for more precise collision detection, as well as detection with polygons. Also has other neat usecases.
/math3 contains some WIP 3d stuff, and I'd recommend we keep it there to be worked on. It can be useful for 2d stuff as well in some cases.
/test contains some test projects. We should keep it in there to demonstrate existing features, though we need to make it a bit tidy. It's a bit harder to describe the rest of the folder I added, but it has to do with how I'd like to make like, a signal system in Brux, something similar to what godot has.

Copy link
Contributor

@hexaheximal hexaheximal Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this, and what is the point of including this?
Also, why is b using the auto type?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole communication folder is basically an attempt to connect events between objects in the game. It's supposed to be almost like signals in Godot. I think we should consider other ways to have objects referring to eachother without referencing them directly. Events should be stored in an std::vector. Other objects will look in that list and use the match event function to look for what it's expecting. With this we can indicate everything between indicating that a gameoverscreen should be triggered, a coin has been collected, and what should happen when a button is pressed. This avoids these cluttered update functions with a bunch of for loops. Ideally iteration should not be done in update functions unnecessarily to make it easier to look at.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole communication folder is basically an attempt to connect events between objects in the game. It's supposed to be almost like signals in Godot. I think we should consider other ways to have objects referring to eachother without referencing them directly. Events should be stored in an std::vector. Other objects will look in that list and use the match event function to look for what it's expecting. With this we can indicate everything between indicating that a gameoverscreen should be triggered, a coin has been collected, and what should happen when a button is pressed. This avoids these cluttered update functions with a bunch of for loops. Ideally iteration should not be done in update functions unnecessarily to make it easier to look at.

Okay, so basically a pubsub interface. Shouldn't that be done in squirrel though?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whatever we'd wanna have in squirrel, we should consider to have it in C++ too, as there isn't any debugging interface for squirrel set up yet. I'm very willing to contribute to this project as it seems easy to build on, but not if I'm forced to use a language I can't debug.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if there is a system to debug squirrel currently... why hasn't anyone told me?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if there is a system to debug squirrel currently... why hasn't anyone told me?

There is, actually: https://github.com/shatteredmoon/squirrel_imgui_debugger

Kelvin actually starred it a while back.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then maybe making it more well-known would be a good idea.
Second, I think we should have as many features as possible as a part of the engine. Why would we have almost everything in squirrel, when we can't even inform people on how to debug it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then maybe making it more well-known would be a good idea. Second, I think we should have as many features as possible as a part of the engine. Why would we have almost everything in squirrel, when we can't even inform people on how to debug it?

Debugging isn't really the relevant problem here. The problem is that doing it on the native side doesn't seem necessary and could easily cause type-related issues.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I would absolutely say that debugging is a problem if you ask me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing purposes, but now we have another folder dedicated to testing projects.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing purposes, but now we have another folder dedicated to testing projects.

Okay, makes sense!

Should it be moved into there then?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks confusing...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ask more specific questions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The syntax on lines 15-16 looks really odd. Also, the indentation doesn't make much sense.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wish it was custom to show me the right way when telling me I am doing it the wrong way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use something like glm for this instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really at the stage where I can do that. It should be considered later, as I am focusing on one thing at a time. Would never get these features done if I always went the extra mile. Can we end that question at that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really at the stage where I can do that. It should be considered later, as I am focusing on one thing at a time. Would never get these features done if I always went the extra mile. Can we end that question at that?

Sure, that can be saved for a future commit if it works. It just doesn't make much sense to do it from scratch when there are well battle-tested libraries already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very confusing, and I'm still not sure why you would choose to implement this yourself instead of just using a library like glm.

Copy link
Contributor

@hexaheximal hexaheximal Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brux is not ready for 3D yet. This should be saved for another time when it makes more sense to include.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but I don't know how to filter it out every time I do a new pull request and simultaneously do my own changes. I am not very neat at operating git and github yet.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second, I would heavily recommend that we keep the core 3d math features though, as you never know when they come in handy. They are very basic and you are gonna want them either way in the future. It's definitely possible to keep it in there while making it look clean and ready for future use.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but I don't know how to filter it out every time I do a new pull request and simultaneously do my own changes. I am not very neat at operating git and github yet.

git stash is what you're probably looking for.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second, I would heavily recommend that we keep the core 3d math features though, as you never know when they come in handy. They are very basic and you are gonna want them either way in the future. It's definitely possible to keep it in there while making it look clean and ready for future use.

Good point, but shouldn't it at least have a configure flag for it so it can be disabled when not needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest a practice for how we would handle said configure flags. We might have more WIP things in the future, and the community being informed about how we go about this would be beneficial.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest a practice for how we would handle said configure flags. We might have more WIP things in the future, and the community being informed about how we go about this would be beneficial.

Add option(USE_3DMATH "Include 3D math APIs" OFF) to CMakeLists.txt and add #cmakedefine USE_3DMATH to src/config.hpp.in. Then you can add the ifdef to the relevant files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what this does.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns collision info for an intersection between two Ray2 instances.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returns collision info for an intersection between two Ray2 instances.

But... this is in math3?...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. It's a very poweful function for 3d collision. Should be kept so that people are aware of it's existance. There is a lack of good references for ray to plane inersection. We could do first person shooters using this function. Keep it there to be used one day.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be included in brux itself. Move this into the squirrel-based test suite.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squirrel-based? You think it's bad to test basically anything in C++?

Copy link
Contributor

@hexaheximal hexaheximal Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Squirrel-based? You think it's bad to test basically anything in C++?

Real brux applications are written in squirrel, so it would make the most sense to test within squirrel.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty pissed at this point, maybe I should not contribute at all if you're just gonna missinform me on a massive scale.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put effort into this, and I feel like other people are just puking at what I make.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't test this within squirrel because I can't make this within squirrel at the moment. Would having test projects in there to demonstrate the functionality cause any problems at all? I guess I could provide them myself, but like... do you wanna download an external repository to get those examples? If you wanna test how something runs, instantiate an example project. It will demonstrate how it runs pretty quickly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You tell me, I don't know everything.

Copy link
Contributor

@hexaheximal hexaheximal Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You tell me, I don't know everything.

Appears to be unintentional. You should remove this file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more thought-out answer: I didn't add it manually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (as well as the rest of the build files) should not be included. Use git commit --amend to clean up this mess.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't completely know how --amend works.

Copy link
Contributor

@hexaheximal hexaheximal Jun 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't completely know how --amend works.

It's quite simple, actually.

Just do git rm -rf [filenames] to remove the files you don't need (and you can also use git add [filenames] to add new changes) and run git commit --amend to edit the last commit.

Then you can run git push --force to force-push it into your branch.

@hexaheximal
Copy link
Contributor

hexaheximal commented Jun 19, 2023

It looks like this can't actually be merged due to merge conflicts since breaking changes have been made since the previous commit on your branch. Can you try running git reset --hard HEAD && git pull, making your changes again, and then force-pushing to your branch?

@UbuntuJackson
Copy link
Author

It looks like this can't actually be merged due to merge conflicts since breaking changes have been made since the previous commit on your branch. Can you try running git reset --hard HEAD && git pull, making your changes again, and then force-pushing to your branch?

What does making my changes again mean, and how do I do that efficiently? You mean literally resetting it to an earlier head, pulling and copy pasting my backed up stuff in there? I feel like I'm being misdirected, can you make really sure that I don't misunderstand this? I'd need more details.

@hexaheximal
Copy link
Contributor

You mean literally resetting it to an earlier head, pulling and copy pasting my backed up stuff in there?

Correct. That would be needed to properly fix the commit as it would make it based on the latest upstream commit, which would fix all of the merge conflicts and also give you a chance to fix some of it.

@UbuntuJackson
Copy link
Author

You mean literally resetting it to an earlier head, pulling and copy pasting my backed up stuff in there?

Correct. That would be needed to properly fix the commit as it would make it based on the latest upstream commit, which would fix all of the merge conflicts and also give you a chance to fix some of it.

Is this like, how you do it every time you do a pull request, or can I avoid it most of the time in the future? Again, I wanna be properly directed with this.

@hexaheximal
Copy link
Contributor

hexaheximal commented Jun 19, 2023

Is this like, how you do it every time you do a pull request, or can I avoid it most of the time in the future? Again, I wanna be properly directed with this.

Usually, no. If the commit history is new enough, it can be merged just fine.

However, in this case it's old enough that the code has changed significantly since you last pulled into your branch.

There are a few solutions to the merge conflicts in this case:

  1. Merge upstream back into your branch and fix the merge conflicts in the merge commit.
    Upsides:
    Really easy to do
    Downsides:
    Creates another merge commit and further complicates the commit tree.
  2. Amend the conflict fixes into your commit
    Upsides:
    Doesn't create an additional merge commit
    Downsides:
    Makes the commit history even more confusing since you're targeting a different commit than the actual parent commit, and it can easily look confusing since you're adding in existing changes again into your own branch, in your commit, in a weird way, which would just make the git blame look confusing.
  3. Revert the commit, pull from upstream, and re-commit (This is what I'm recommending)
    Upsides:
    Doesn't have any of the downsides of the previous 2 options.
    Downsides:
    Requires you to back up your changes somewhere else and re-commit them later in a way that works properly with the latest upstream commit.

@tulpenkiste
Copy link
Contributor

This PR is now incompatible with the unstable branch (due to #71) so this would need to be reworked or closed without merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants