• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

DevLog I've started to code my dream game :-)

AutmnLeaf

New member
Tutorial Author
Joined
Feb 19, 2018
Messages
31
It was when I was 14 years old when I fell deeply in love with Commodore 64's Ultima IV. Since then I've wanted to make some kind of 2D Ultima game. This is what I've achieved so far:


The visibility blocking routine is the thing I've been coding. It isn't perfect, but good enough for me... :) Somewhere in the middle of the video you'll get a rough idea how the visibility routine works... The code got quite complicated, though...
 
Last edited:
Love the title of your thread! Cerberus X sometimes make dreams come true, or at least ideas come true indeed.
How is that visibility blocking routine supposed to work?
 
Don't wish to rain on your parade but there are a few remakes already, http://xu4.sourceforge.net/ is probably the best. Of course that doesn't mean you shouldn't carry on with your own version (or a similar feeling game) if you're doing it to scratch an itch! Good luck!
 
I improved the visibility blocking routine a bit. Here's one picture:
screenshot.jpg

It could be a bit better.

The actual idea is quite hard to explain and the code got quite complicated. But since there are alreade many 2D Ultima remakes, I'll share the code to check the right side of the player.

Before checking, the code marks all tiles, that may block the visibility with 8's into showMap that's size is the visible area. Then I have another check for the showMap array. All "alone" 8's are marked with 9's. If 9's block the visibility the blocking number is 7. This could work better.

In fact the checking of other sides may have removed the necessary 8's for checking, this is why in the code below the check is made for the actual blocking tile in some parts. The code of blocking tile is 6.

The right side of the player is checked like this (the code really got complicated :)):

Cerberus:
        For Local y:Int = 0 To 17 - 1
            For Local x:Int = 0 To 17 - 1
                
...

                If (map[inMap(scrollX / 16 + x, scrollY / 16 + y)] = 6 Or showMap[x + y * 17] = 9) And x > 8 Then
                    For Local xp:Int = x + 1 To 17 - 1
                        If y = 8 Then
                        
                            Local mark:Int
                        
                            If showMap[x + y * 17] = 8 Then mark = 2
                            If showMap[x + y * 17] = 9 Then mark = 7
                            
                            showMap[xp + y * 17] = mark

                        Endif
                                                
                        If y > 4 And y < 17 - 1 -  4 Then
                        
                            For Local yp:Int = y + 1 To 17 - 1
                                'If showMap[xp - 1 + yp * 17] = 8 Then
                                If map[inMap(scrollX / 16 + xp - 1, scrollY / 16 + yp)] = 6
                                    For Local xpp:Int = xp To 17 - 1
                                            showMap[xpp + yp * 17] = 2
                                    Next                               
                                
                                Else
                                    Exit
                                Endif
                            
                            Next   
                        
                        
                            For Local yp:Int = y - 1 To 0 Step -1
                                'If showMap[xp - 1 + yp * 17] = 8 Then
                                If map[inMap(scrollX / 16 + xp - 1, scrollY / 16 + yp)] = 6
                                
                                    For Local xpp:Int = xp To 17 - 1
                                        showMap[xpp + yp * 17] = 2
                                    Next
                                
                                
                                Else
                                    Exit
                                Endif
                            Next
                        
                        Endif
                        
                    Next
                
                Endif
...

The worldmap is in map array and the inMap function inside the map array always returns values that are inside the array.

It's a miracle that I understand anything about the code above, since I didn't comment it at all.
 
That's nice! I enjoyed the video. I enjoy seeing the games that people are making and it is great seeing people's game making dreams come true! Keep up the good work!
 
Last edited:
Check out the roguelike dev world - e.g. r/roguelikedev or RogueBasin - for ideas that will help you code a game like this. For example, field of view calculations are a very standard thing and various algorithms are used.
 
I found some spare time to improve to visibility blocking routine this weekend. There's full source code in the video... :)

 
Back
Top Bottom