Nico
06/24/2020, 6:22 AMtobsef
06/24/2020, 8:32 AMDeactivated User
06/24/2020, 9:55 AMNico
06/24/2020, 10:04 AMNico
06/24/2020, 10:07 AMDeactivated User
06/24/2020, 10:29 AMNico
06/24/2020, 10:33 AMDeactivated User
06/24/2020, 10:33 AMSerVB
06/24/2020, 6:27 PMPoint
but it's mutable. How to define immutable point, for example, to be used as a constant? Is there a vector2 class with the same capabilities, just to name it more suitable for using in velocity/acceleration or is it OK to use Point
here?
2. What's the recommended way to create custom views? What should I override (w/h, hitshape)? Should I always treat xy as the upper-left corner of the view or is it OK to use it as a center in some custom views?
3. How to split logic from representation, for example, where to handle collisions, which place should update position of views (a view itself or some kind of master object)? Need an example and a common algorithm! ๐
4. Scenes are not covered in the guides yet. I wish to see a simple app with a dynamic game scene and a main menu scene (background better be dynamic too). I want to know how I should design actions on scenes so I can easily switch them and pass some progress. And a general discussion of why scenes are needed and when I need to create it.
5. Working with images (yep, another guide). I still don't understand how can I prepare my loaded assets. For example, rotate, scale, mirror. Or should I do this when I render? Also, I have the following two lines in my code, can the first one be improved, can I flip a slice?
skullUp = texture.slice(RectangleInt(192, 0, 24, 14)).extract().flipY().slice()
skullDown = texture.slice(RectangleInt(192, 0, 24, 14))
Also, you even can take a look at my project https://github.com/SerVB/korge-zombie-bird (of course if you have much time) and find some antipaterns a KorGE newbie uses (which I don't even treat as bad practice) and make a video about those and how to implement games better.
If you decide not to create a video on any of these 6 variants but answer here, I will appreciate it too.Deactivated User
06/24/2020, 6:38 PMDeactivated User
06/24/2020, 6:39 PMDeactivated User
06/24/2020, 6:39 PMDeactivated User
06/24/2020, 6:40 PMDeactivated User
06/24/2020, 6:42 PMSerVB
06/24/2020, 7:12 PMSerVB
06/24/2020, 7:14 PMSerVB
06/24/2020, 7:16 PMSerVB
06/24/2020, 7:17 PMNico
06/24/2020, 7:18 PMViews
which can have children
https://github.com/korlibs/korge/blob/64563e41ac104155c52d75320ca568a8a7b1a218/korge/src/commonMain/kotlin/com/soywiz/korge/view/Container.kt#L27Deactivated User
06/24/2020, 8:13 PMSerVB
06/24/2020, 8:29 PMI have testedI'm very curious. Have you any digits? Have you reported it at Kotlin YouTrack so they can fix it?
Deactivated User
06/24/2020, 8:31 PMDeactivated User
06/24/2020, 8:32 PMDeactivated User
06/24/2020, 8:32 PMDeactivated User
06/24/2020, 8:32 PMDeactivated User
06/24/2020, 8:34 PMSerVB
06/24/2020, 8:44 PMIPoint
as deprecated. Because for example if it gives only 10% performance loss only on native targets -- well, I can totally live with it. I would rather not have warnings from compiler...
And if there is huge loss of performance, for instance, 50%, we should better report it to Kotlin team so they fix it and add regression tests.Deactivated User
06/24/2020, 9:01 PMDeactivated User
06/24/2020, 9:01 PMDeactivated User
06/24/2020, 9:02 PMSerVB
06/24/2020, 9:08 PMSome places required IPoint, others Point and was a bit confusingI think it's more than OK, not confusing. Some places aren't meant to modify the point so they should receive IPoint. Like a constant reference in C++. Is there any other reason?..
Deactivated User
06/24/2020, 9:09 PMDeactivated User
06/24/2020, 9:09 PMDeactivated User
06/24/2020, 9:10 PMDeactivated User
06/24/2020, 9:11 PMSerVB
06/24/2020, 9:35 PMcast the IPoint to Point and modify itWell yes, but actually I won't do this because I don't want to harm myself ๐ I guess the same is true for stdlib functions. For example, the function
.map
is not trying to cast its receiver to mutable iterable and spoil it. And the same is true for that C++ case: nobody will try to cast a constant reference to a reference and modify it because it's obviously a not designed action while it's easily performable.
What I want is to have some compiler protection. And the current situation is that I have plain Points everywhere: I don't know which functions modify their arguments and which not. I can unintentionally change the function to modify its argument because I forget that it has been designed not to do so.
If I could use IPoint, I would be reminded that the function shouldn't try to change its parameter. And I will know where I can pass contstants because I believe nobody will try to cast.
My opinion is that IPoint shouldn't be deprecated so I can use it. Of course, this doesn't mean immutable, this means read-only and it has its limitations. However, we all using Kotlin for quite a while and I believe we are used to read-only types and we know how to work with them.
PointImmutableThis is an option, but it's not required. This will just add one more class and complexity but will give extra guaranties. I think this can be done later if there is such demand
Deactivated User
06/24/2020, 9:48 PMtobsef
06/24/2020, 9:52 PMSerVB
06/24/2020, 9:58 PMWe can undeprecate the IPoint interfaceAwesome! Really looking forward to see this change.
The core at least must be as fast as possibleI still don't get the problem. Is it that when I pass an implementation where interface is declared in Kotlin Native, it's slow? If yes, of course it should be fixed from Kotlin side. It's great that the library works around this problem. I think Kotlin Native team will be happy to investigate and fix this, but more info is needed, for example, benchmarks. I can try to prepare the info if you confirm that I understand the problem right.
tobsef
06/24/2020, 10:05 PMcenterOn(rootView)
is broken again and I had to switch to absolute positioning. And my game map tiles showed a minimal spacing at the corners, so my game looked like a chess board. I oversized my tiles 1% to get rid of it.
I try to summarize this and other game jam problems and bugs next week.Deactivated User
06/24/2020, 10:06 PMDeactivated User
06/24/2020, 10:08 PMtobsef
06/24/2020, 10:09 PMIPoint
. I often used it as class delegation. This was very handy for game objects, that have a position and also provide all of the nice IPoint functions, like distanceTo()
. Switching to Point
is not an option, because it's not an interface and not open
.Deactivated User
06/24/2020, 10:16 PMIvรกn C.
06/24/2020, 11:09 PMSerVB
06/24/2020, 11:23 PMSerVB
06/24/2020, 11:25 PMIvรกn C.
06/24/2020, 11:56 PMRezMike
06/25/2020, 2:43 AMcenterOn(rootView)
, maybe you should use centerOnStage
function? I added it in 1.13.7, it uses virtual width/height to center a viewNico
06/25/2020, 5:49 AMNico
06/25/2020, 6:30 AMtobsef
06/25/2020, 7:20 AMcenterOnStage()
. But I can't use it. My game components extend the Container
class and add other views during init{}
. So calling centerOnStage()
for an added image, will always trigger a NPE
because the stage is null
for a unattached Container. So this is why I provide the rootView
, which is basically the Stage. Or is there a lifecycle phase where I can add Views after attach?
PS: We have a crazy time shift
Deactivated User
06/25/2020, 7:55 AMtobsef
06/25/2020, 11:23 AMtobsef
06/25/2020, 11:26 AMcenterOnStage()
. The problem is the order... I add the image to the FaqComponent, before the FaqComponent is attached to another View.RezMike
06/25/2020, 11:34 AMfun Container.faqComponent(): FaqComponent {
return FaqComponent().addTo(this).onAttach()
}
where onAttach()
is your custom functionIvรกn C.
06/25/2020, 3:12 PM