Need help converting my C game to Hollywood, looking for suggestions.

Find quick help here to get you started with Hollywood
Post Reply
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Need help converting my C game to Hollywood, looking for suggestions.

Post by MarisaG1967 »

First question:
What is the recommended method to convert structs to "hollywood method"

Will edit to add more questions as they come up...
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by Flinx »

Tables.
You have two syntax variants. The second looks similar to the C struct access. From the manual:

Code: Select all

a = {} ; create empty table
a["name"] = "John Doe"  ; assign "John Doe" to index "name"
a.name = "John Doe"  ; assign "John Doe" to index "name"

b = a["name"]
b = a.name
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by MarisaG1967 »

Thanks! Will give that a try!
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by MarisaG1967 »

I'm assuming that this will work as well:
typeofstruct.structinstance.structfield.fieldvalue

?
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by Flinx »

Code: Select all

typeofstruct={}
typeofstruct.structinstance={}
typeofstruct.structinstance.structfield={}
typeofstruct.structinstance.structfield.fieldvalue=123
NPrint(typeofstruct.structinstance.structfield.fieldvalue)
ForEach(typeofstruct, NPrint)
ForEach(typeofstruct.structinstance, NPrint)
ForEach(typeofstruct.structinstance.structfield, NPrint)
NPrint("")

; shorter version:
typeofstruct={structinstance={structfield={fieldvalue=345}}}
NPrint(typeofstruct.structinstance.structfield.fieldvalue)
ForEach(typeofstruct, NPrint)
ForEach(typeofstruct.structinstance, NPrint)
ForEach(typeofstruct.structinstance.structfield, NPrint)

WaitLeftMouse()
Of course I don't know if it could be done better for your program. And I'm not perfect at many things in Hollywood either; I only know what I've already used. But keep asking, someone will answer :)
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by MarisaG1967 »

Interesting suggestion, thanks!
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by Flinx »

By the way, have you already decided how the game's graphics will be designed? As far as I can see, there are two fundamentally different approaches in Hollywood. The classic approach, where an image is constantly being rebuilt and synchronized with the vertical sync, and the later layer functions, which are more suited to more powerful graphics hardware. I've done everything with layers so far, but I've never built a game, and I didn't have the Amiga as my target platform for my current project..
MarisaG1967
Posts: 24
Joined: Sat Jun 22, 2024 4:15 am
Location: South San Francisco, CA
Contact:

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by MarisaG1967 »

It's a card game so animation will be minimal at first and maybe added on later. I'm thinking sprites for now. I'm targeting amiga/mac/Linux and maybe even windows.
--- https://amigacity.xyz - Website for all things related to the Amiga
--- https://hollywood.retro-os.live - Fan site for the Hollywood programming environment
--- https://discord.gg/ExmkwrV8ZA - Discord for Hollywood fans
Flinx
Posts: 342
Joined: Sun Feb 14, 2021 9:54 am
Location: Germany

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by Flinx »

For a card game, I think any approach will work.
User avatar
Juan Carlos
Posts: 932
Joined: Mon Sep 06, 2010 1:02 pm

Re: Need help converting my C game to Hollywood, looking for suggestions.

Post by Juan Carlos »

To make a card game may be easier start it all from Hollywood, although it is true that the poker engines is more easy to try adapt it from C, I tryed to make a Texas Holdem Poker but it was a little complicated for me the CPU engine as rival and convert a example from C or Java is complicated. But to make a easy card game the best option is 100% Hollywood using layers to visual effects.
Post Reply