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

AutmnLeaf

Member
Joined
Feb 19, 2018
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:

Pierrou

Active Member
Joined
Jul 6, 2017
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?
 

Paul59

Active Member
CX Code Contributor
Joined
Dec 13, 2018
Location
UK
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!
 

AutmnLeaf

Member
Joined
Feb 19, 2018
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 X:
        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.
 

En929

New Member
Joined
Jan 8, 2019
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:

Gerry Quinn

Active Member
Joined
Jun 24, 2017
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.
 

AutmnLeaf

Member
Joined
Feb 19, 2018
I found some spare time to improve to visibility blocking routine this weekend. There's full source code in the video... :)

 
Top Bottom