Converting SDL2 Tutorials from Parallel Realities

Show off your project created with Hollywood
dwayne_jarvis
Posts: 22
Joined: Wed Mar 03, 2021 8:15 am

Converting SDL2 Tutorials from Parallel Realities

Post by dwayne_jarvis »

I am working my way through Converting the SDL2 tutorials from Parallel Realities from C Source Code to Hollywood.

This was mostly as an exercise to understand game programming and to see what Hollywood RebelSDL can do and so far with the first eight Tutorials almost complete I am happy with the results.

I reached out to Sean from Parallel Realities to see if they were OK for me to release the source code and I got a NO in response , claiming someone could reverse engineer the code back to C and no pay for the tutorials. Also the assets are copyrighted. I will try and compile the assets and check with Sean again to see if I can release this on OS4Depot.

If anyone is interested to get the source code I will call Sean and see if I can release it to him to sell through his itch account. I am not asking for any money personally, but love to get this in to the hands of as many Hollywood coders as possible.

Not sure how to upload pics but once I work it out, I will see if I can upload a few here or maybe my itch account.

Regards,

Dwayne
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Converting SDL2 Tutorials from Parallel Realities

Post by airsoftsoftwair »

dwayne_jarvis wrote: Mon Mar 06, 2023 6:16 am Not sure how to upload pics but once I work it out, I will see if I can upload a few here or maybe my itch account.
Yeah, would definitely be interested in seeing this so even if you don't have permissions to upload source code, some pictures would be nice or a YouTube video maybe.
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Converting SDL2 Tutorials from Parallel Realities

Post by Allanon »

Yes, it would be very interesting to just see it in action! :)
User avatar
Juan Carlos
Posts: 884
Joined: Mon Sep 06, 2010 1:02 pm

Re: Converting SDL2 Tutorials from Parallel Realities

Post by Juan Carlos »

Yes, I waiting to are pictures or video working the RebelSDL, because someones que are rebels, although the live go ya no son good like in the móviles with rebels...
dwayne_jarvis
Posts: 22
Joined: Wed Mar 03, 2021 8:15 am

Re: Converting SDL2 Tutorials from Parallel Realities

Post by dwayne_jarvis »

Had several goes at recording my AMIGA through a capture card on the PC after many hours it was finally uploaded and ready to share through YouTube. https://youtu.be/7tC-M1dPJ00 (most of that time was waiting for youtube to check for copyright material and change to SD and HD formats).

Your can see CubicIDE with three windows open when I start the video then load an ATTRIBUTIONS file that shows the copryrighted material used in the video.

The first shows the based files used for the main application to launch including a common file, defs and structs.

Second Windows shows a number of files used for the basic framework, including atlas, fonts, textures, sound, widgets, utils etc.

The third windows are all the files that are used to make up the game logic for the game.

When running the game I used the widget system to change the options for the music and turn it down. This is done deliberately in case the music gets blocked from YouTube for copyright reasons.

I had to reduce the star count from 250 to 100 to avoid the occasional slow down. I have not optimised the code to use more standard Hollywood data types and the source code relies on Linked Lists to store resources.

As stated this is Tutorial number 8. If there is enough interest I can upload a video from another tutorial. I have also compiled the entire source material and compressed it to a single 5Mb file and will check with Steve from Parallel if I can upload this to OS4Depot.

Thanks for you patience.

Dwayne
User avatar
Juan Carlos
Posts: 884
Joined: Mon Sep 06, 2010 1:02 pm

Re: Converting SDL2 Tutorials from Parallel Realities

Post by Juan Carlos »

Good video showing the SDL examples working with RebelSDL, thank you.
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Converting SDL2 Tutorials from Parallel Realities

Post by airsoftsoftwair »

Thanks for posting, very nice to see this! I certainly wouldn't mind to see more videos of the SDL2 tutorials...
dwayne_jarvis
Posts: 22
Joined: Wed Mar 03, 2021 8:15 am

Re: Converting SDL2 Tutorials from Parallel Realities

Post by dwayne_jarvis »

Here's another one. This is the sdl2Gunner demo from Parallel Realities.

It took longer because of various personal things happening in life. However from the coding front. Some things to highlight are:

- QuadTree was re-implemented from another source which was based upon LUA with very minor changes (Copyright (C) 2008 Samuel Stauffer <samuel@descolada.com>)

- Re-wrote code that used linked list for standard LUA lists using CreateList (from hollywood) for speed where possible (don't know if there was an increase or not).

- Effects have been implemented, including smoke effects, explosions, debris.

NOTE: The effects from the original code are added to the entities quadtree. I split this into two quadtrees and added the debris to a second quadtree without collision checks and this sped things up dramatically.

- Renamed all functions in preparation for using tables to hold functions and possibly use OOP to avoid lots of duplicate code.

The next tutorial will be re-written with this in mind and might take longer. Once this is done I will send source code to Steve from Parallel Realities to see if it is significantly different to the C Source that he is happy for me to release it.

Demo this time is running on Windows. I tried to run this from my OS4 machine but the frame rate dropped to less than 1 FPS once the game started. I had to turn off all effects and it ran faster but it was a big disappointment to see compared to the last tutorial running on OS4, but there is a lot more happening and the playfield is significantly larger.

I might write the next tutorial from my OS4 machine or code on Windows and check on my OS4 machine for optimisations.

https://youtu.be/uxLMM_doeyk
Link to video above.

Comments and feedback welcome. If interested in learning more about the conversions or if you want to help, feel free to contact me directly.

I quickly captured this on my PC but have not added the attributions to the video, so I will do it from this posting.

ATTIRUBTIONS for Assets include Parallel Realities and the below:
EnterCommand.ttf
- By jeti
- https://www.dafont.com/enter-command.font

The End
- Created by Robert Friedrich.
- http://www.amazon.com/Robert-Friedrich/e/B00F6N9E8A

dova_b8d_toys_master.mp3
- By ISAo
- https://opengameart.org/users/isao

35681__jobro__laser4.ogg
- Laser4.wav, by jobro
- https://freesound.org/people/jobro/sounds/35681

47252__deleted-user-364925__bad-explosion.ogg
- bad explosion, by deleted_user_364925
- https://freesound.org/people/deleted_us ... unds/47252

76969__michel88__paino.ogg
- paino.wav, by Michel88
- https://freesound.org/people/Michel88/sounds/76969

148309__keemocore__robot-step-short-medium-heavy.ogg
- robot step short medium-heavy.wav, by keemocore
- https://freesound.org/people/keemocore/sounds/148309

170959__timgormly__metal-clang.ogg
- Metal Clang.aif, by timgormly
- https://freesound.org/people/timgormly/sounds/170959

263133__pan14__tone-beep.ogg
- tone beep.wav, by pan14
- https://freesound.org/people/pan14/sounds/263133

264762__farpro__guiclick.ogg
- guiclick.ogg, by farpro
- https://freesound.org/people/farpro/sounds/264762

321102__nsstudios__laser1.ogg
- laser1.wav, by nsstudios
- https://freesound.org/people/nsstudios/sounds/321102

470587__silverillusionist__heavy-impact.ogg
- Heavy Impact, by SilverIllusionist
- https://freesound.org/people/SilverIllu ... nds/470587

523089__magnuswaker__explosion-1.ogg
- Explosion 1, by magnuswaker
- https://freesound.org/people/magnuswaker/sounds/523089

536786__egomassive__screamm.ogg
- ScreamM.ogg, by egomassive
- https://freesound.org/people/egomassive/sounds/536786

572936__bloodpixelhero__error.ogg
- Error, by BloodPixelHero
- https://freesound.org/people/BloodPixel ... nds/572936

577965__colorscrimsontears__rpgpowerup.ogg
- rpgPowerup.wav, by colorsCrimsonTears
- https://freesound.org/people/colorsCrim ... nds/577965
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Converting SDL2 Tutorials from Parallel Realities

Post by airsoftsoftwair »

Nice! How does this perform on an X5000?
dwayne_jarvis
Posts: 22
Joined: Wed Mar 03, 2021 8:15 am

Re: Converting SDL2 Tutorials from Parallel Realities

Post by dwayne_jarvis »

That's the problem. It gets less than 1fps on an X5000 and I don't know why. I know I have optimised the original firstly by using a LUA specific quadtree which reduced the collision checks from hundreds to less than ten every frame.

The quadtree I used also adapts to only requires updating entities in the quadtree when they are moved. The original code clears and rebuild the quadtree every loop. All this cost was adding two additional variables to the entity holding a bx, by value pair representing the x and y value before the entity was moved.

I also moved the debris particles that are created into a separate quadtree to avoid performing two move calculations when only one is required.

This improved the speed dramatically on Windows so they were worth doing. But on the X5000 I had to turn off all explosions, smoke and debris effects otherwise it ground to a halt. I suspect it is having trouble blitting that many textures on the screen every loop, but this is only mu guess.

I created my own font rendering and created texture sizes for the fonts which are not to the power of two so I am unsure if this is the issue. The Atlas Images that were created by Parallel Realities are a power of two. But the png transparencies seem to be a bit odd. As you can see from the logo at the start of the demo (this is from Windows).

I have started another tutorial and project and might get back to this later on. However if anyone is happy to work through this with me, I can provide source code but might need to change the assets.

Are there specific version of SDL libraries that could improve the performance on OS4?

Regards,

Dwayne
Post Reply