Page 3 of 3

Re: Started My Very First Love2d Game

Posted: Thu Dec 28, 2023 6:11 pm
by kingnoob
dusoft wrote: Thu Dec 28, 2023 6:02 pm
kingnoob wrote: Thu Dec 28, 2023 5:38 pm Dragging a line is just a way of showing that selection is in progress. But I should have mentioned that. Soon I'll make a readme that can be updated as progress is made.
I meant having an option to drag a line from one planet to another as an alternative to clicking first and clicking second. I tried that, but it didn't work and it took me a second to find out I can click on a planet and then another and that initiates transfer.
Good idea! +1 :)

Re: Started My Very First Love2d Game

Posted: Sun Dec 31, 2023 4:08 am
by kingnoob
I'm almost done with the SendShips panel. There are 4 more buttons I want to put at the bottom. I could probably get it done tonight but I will be relaxing with a movie instead! It is all draw instructions until it is done then the permanent features will be taken out and drawn once to a canvas. Click on the numbers or percentage boxes or the slider bar to send ships. And keyboard works as well. The percentage boxes and slider can be instantaneous or require send to be clicked. I won't attach the files until there is a better AI.

Re: Started My Very First Love2d Game

Posted: Sun Dec 31, 2023 5:54 am
by knorke
Hi
you should add version numbers to your filenames, otherwise it quickly gets confusing.
Anyway, I tried the version from this post viewtopic.php?p=258162#p258162 (I believe) and it instantly hangs up. (Program not responding, have to close it via task manager)

In initiate.lua there are two places where it can get stuck in endless loops:

Code: Select all

function InitStars() 
    for i = 1, 200 do
        ::try_again::
        star[i].x = love.math.random(20, width - 20)
        star[i].y = love.math.random(20, height - 30)
        for j = 1, i do
            if j ~= i then
                if Distance(i, j) < 60 then
                    goto try_again
and same problem in InitPlayers()

There is are no exit-conditions for the loop, if every random position too close then it will loop forever.
It might work on your computer because width and height are set to desktop pixel dimensions. Likely your screen is larger. On my smaller screen it might be impossible to fit so many randomly placed stars.

1) You should keep coordinates for drawing and for logic separate.
In your case the playable map size depends on screen resolution.
2) Avoid using goto, there is usually a cleaner way.
3) Make sure loops always have an exit condition. For example, if after 10 attempts the position is still too close then use it anyway or stop generating new stars.

After fixing that, I could start.
I could not send ships to some stars because sometimes the window was partly offscreen and the "send" button could not be reached.

Are you planning to have local multiplayer? I like this style of game but I haver never seen one with local mp. Selecting planets could work by tab-ing through them with keys, no need for multiple mouses.
For example have two buttons to cycle back/forth through enemies planets.
Two buttons to cycle through your own planets. Fifth button to send ships.

Re: Started My Very First Love2d Game

Posted: Sun Dec 31, 2023 7:31 am
by kingnoob
knorke wrote: Sun Dec 31, 2023 5:54 am Hi
you should add version numbers to your filenames, otherwise it quickly gets confusing.
Anyway, I tried the version from this post viewtopic.php?p=258162#p258162 (I believe) and it instantly hangs up. (Program not responding, have to close it via task manager)

In initiate.lua there are two places where it can get stuck in endless loops:

Code: Select all

function InitStars() 
    for i = 1, 200 do
        ::try_again::
        star[i].x = love.math.random(20, width - 20)
        star[i].y = love.math.random(20, height - 30)
        for j = 1, i do
            if j ~= i then
                if Distance(i, j) < 60 then
                    goto try_again
and same problem in InitPlayers()

There is are no exit-conditions for the loop, if every random position too close then it will loop forever.
It might work on your computer because width and height are set to desktop pixel dimensions. Likely your screen is larger. On my smaller screen it might be impossible to fit so many randomly placed stars.

1) You should keep coordinates for drawing and for logic separate.
In your case the playable map size depends on screen resolution.
2) Avoid using goto, there is usually a cleaner way.
3) Make sure loops always have an exit condition. For example, if after 10 attempts the position is still too close then use it anyway or stop generating new stars.

After fixing that, I could start.
I could not send ships to some stars because sometimes the window was partly offscreen and the "send" button could not be reached.

Are you planning to have local multiplayer? I like this style of game but I haver never seen one with local mp. Selecting planets could work by tab-ing through them with keys, no need for multiple mouses.
For example have two buttons to cycle back/forth through enemies planets.
Two buttons to cycle through your own planets. Fifth button to send ships.
I will have to make some adjustments for lower resolution screens. For mp you mean two people sharing the same keyboard? Can I ask, what is the resolution of your screen? I'm thinking that it will take a major rewrite from scratch to accommodate all these ideas. Feel free to submit code or even make a fork. If you submit code you can name a star! :) Thanks :)

Re: Started My Very First Love2d Game

Posted: Sun Jan 07, 2024 6:24 pm
by knorke
Sorry, I do not have the time to submit code. So I can only give some feedback.

My laptop's resolution is 1366*768. Some libraries exist for the resolution problem, for example: viewtopic.php?t=92494
Usually it does not require a complete rewrite, just inserting a few lines and some edits.

Yes, I meant local multiplayer sharing the same keyboard. (Or later on, maybe gamepads)

Re: Started My Very First Love2d Game

Posted: Thu Feb 08, 2024 11:49 pm
by GVovkiv
knorke wrote: Sun Jan 07, 2024 6:24 pm My laptop's resolution is 1366*768. Some libraries exist for the resolution problem, for example: viewtopic.php?t=92494
Usually it does not require a complete rewrite, just inserting a few lines and some edits.
Yay!