Posts: 46
Threads: 9
Joined: Apr 2022
Reputation:
2
04-27-2022, 11:08 AM
(This post was last modified: 04-27-2022, 11:09 AM by Ikerkaz.
Edit Reason: Add some words
)
Hi to everyone!
First of all, sorry for my terrible english, I'm from Spain
I will try to explain myself.
I am making a Star Trek space game, some kind of mix between EGATrek and ST: Armada. I don't know if I am going to finish it, but I am enjoying the creation as a hobby
Currently the game displays background space, stars, planets and several ships (allies and enemies). You have 3 allied ships, and you can move them with mouse (clicking on the screen rotates and moves the ship automatically).
My problem is that the game is a little slow when I paint nebulae or several things on the screen. I am using all software graphics, but I read several days ago that you can load graphics into hardware, with the "33" switch, and in theory the game would speed up.
I tried to recode all the game with this option, but I failed. The game paints some things, but others don't. Also, I tried to use display order, but I don't know how to use it, and sometimes the game displays only the hardware graphics previously loaded, or it only displays some points and lines (I drew them with PSET and LINE in some parts of the code).
Please can you help me? If anybody wants the source code, I will be pleased to send it to you.
Thank you !!!
IKZ
10 PRINT "Hola! "
20 GOTO 10
Posts: 276
Threads: 14
Joined: Apr 2022
Reputation:
27
04-27-2022, 11:46 AM
(This post was last modified: 04-27-2022, 12:17 PM by OldMoses.)
Hi Ikerkaz,
I'm not very experienced with hardware images, having had similar results to what you are experiencing. I do recall Steve having treated the subject a bit on the old forum, which I've linked to below. They will reduce CPU usage, but I'm not sure how much that will affect speed. You generally have to limit hardware images to things that you are not changing on the fly. There are a lot of things that can be speed killers.
https://qb64forum.alephc.xyz/index.php?t...#msg128883
PS. If your screen display zooms or pans around, is your code painting details that may be off screen? That was a big speed killer in one of my projects which took me months to figure out.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 46
Threads: 9
Joined: Apr 2022
Reputation:
2
No, I tried not to paint objects that are off screen.
Thank you for your help OldMoses, I will continue investigating this...
10 PRINT "Hola! "
20 GOTO 10
Posts: 3,922
Threads: 174
Joined: Apr 2022
Reputation:
210
04-27-2022, 02:07 PM
(This post was last modified: 04-27-2022, 02:08 PM by bplus.)
Hello @Ikerkaz
Welcome to the forum!
I could not tell from your question are you drawing objects like spaceships each time or using their image as sprite?
As OldMoses said, Background is good for hard images (I hardly use Hard image either), but also allot of graphic drawing can be saved into a separate image with handle and that may save some time too. Are you doing that?
b = b + ...
Posts: 176
Threads: 13
Joined: Apr 2022
Reputation:
5
Hi @Ikerkaz,
First two things... Big fan of Star Trek and Amstrad (cpc464)... Woo Hoo!
I may not be of much help... But, from my experience in space games, certain things just do not move... eg: Galaxies and Nebulae (unless you are travelling 'through' them) in comparison to the relative speed of your ship... they just do not move. Stars (unless warp speed is used) should move 'slowly'. Asteroids and planets a little quicker... (Note: If you are going for accuracy, Starships are not permitted to use warp speed within a solar system - here ends today's lesson.. lol)
Question: Are you using some kind of "cloud" type function to draw the nebula? If you are not flying through it, my advice would be, use a fixed image instead.
If it is at all possible, may I see a screenshot, of what you have done so far?
J
May your journey be free of incident. Live long and prosper.
Posts: 46
Threads: 9
Joined: Apr 2022
Reputation:
2
(04-27-2022, 02:07 PM)bplus Wrote: are you drawing objects like spaceships each time or using their image as sprite?
As OldMoses said, Background is good for hard images (I hardly use Hard image either), but also allot of graphic drawing can be saved into a separate image with handle and that may save some time too. Are you doing that?
Actually I have one image loaded with _LOADIMAGE, only 1 sprite, and I'm drawing objects each time.
Starships are not the problem because they are small. My big problem is the nebulae. They also are images loaded, and currently I draw them with _PUTIMAGE but only a piece of them (the one that is currently visible on the screen). The other part of it and the rest of the objects are not painted.
(04-27-2022, 08:02 PM)johnno56 Wrote: Hi @Ikerkaz,
First two things... Big fan of Star Trek and Amstrad (cpc464)... Woo Hoo!
I may not be of much help... But, from my experience in space games, certain things just do not move... eg: Galaxies and Nebulae (unless you are travelling 'through' them) in comparison to the relative speed of your ship... they just do not move. Stars (unless warp speed is used) should move 'slowly'. Asteroids and planets a little quicker... (Note: If you are going for accuracy, Starships are not permitted to use warp speed within a solar system - here ends today's lesson.. lol)
Question: Are you using some kind of "cloud" type function to draw the nebula? If you are not flying through it, my advice would be, use a fixed image instead.
If it is at all possible, may I see a screenshot, of what you have done so far?
J I have a CPC6128 and it is working almost perfectly
The nebulae are big PNGs with transparency. Actually I paint a faded "galaxy" background, over this I paint starships and then I paint nebulae, in order to show some king of transparency effects.
This is a current screenshot, it is totally incomplete and it have a lot of things that I have to change (among some random numbers that I use for debugging the program).
Grettings!
IKZ
10 PRINT "Hola! "
20 GOTO 10
Posts: 3,922
Threads: 174
Joined: Apr 2022
Reputation:
210
Wow! you've allot going on, 1 regular looking screen and 6 screenettes! I hope you aren't redrawing the whole 7 when you update only one screenette(=tiny screen).
I suspect you have a large monitor you are doing this on.
b = b + ...
Posts: 276
Threads: 14
Joined: Apr 2022
Reputation:
27
That looks amazing! I can't wait to see it working.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 19
Threads: 0
Joined: Apr 2022
Reputation:
4
Quote: Also, I tried to use display order, but I don't know how to use it, and sometimes the game displays only the hardware graphics previously loaded, or it only displays some points and lines (I drew them with PSET and LINE in some parts of the code).
The HARDWARE screen is cleared every time you use DISPLAY, so you’ll need to repaste it each time you update. This can be an issue if you were sometimes only updating mini screens to save time. The SOFTWARE page shouldn’t be cleared unless you do it yourself, so guessing why that wouldn’t display is more difficult. Could be a DISPLAYORDER issue,maybe you used it multiple times and didn’t always include the SOFTWARE layer? In general, you should set the DISPLAYORDER once and forget about it
Posts: 176
Threads: 13
Joined: Apr 2022
Reputation:
5
04-28-2022, 09:01 PM
(This post was last modified: 04-28-2022, 09:02 PM by johnno56.)
Fascinating. Using both 'Constitution' and 'Galaxy' class starships in the same game... lol
Thank you for the image. Much appreciated.
J
ps: My cpc464 died a natural death some decades ago... I now use an emulator. I actually still have the user manual... You just have to love hardcopy for reference... lol
May your journey be free of incident. Live long and prosper.
|