The MASM Forum

Projects => Game Development => Topic started by: felipe on June 04, 2018, 02:08:12 PM

Title: Tita in labyrinths
Post by: felipe on June 04, 2018, 02:08:12 PM
 :biggrin: Tita in labyrinths...
:icon_eek: You have post this game before, wtf?
:biggrin: Features: Same logic as before...
:icon_confused: What?
:biggrin: The game is the same as before...
:eusa_snooty: What's wrong with this dude?...
:biggrin: The game is far from been optimized...
:icon_eek: Ok, stop please...
:biggrin: I have ported the game into 64 bits...
:shock: Ok, i see...
:biggrin: I have done this as an exercise, also i have uploaded here this because tita was my first game for 32 bits. Also it can help others to get closer to 64 bits...
;) Ok, i like that...
:biggrin: The logic as i say is the same and all is the same as the 32 bits version. It was just ported to 64 bits. There wasn't an intention to optimize the game nor to improve it or to make a change on it. It is not worthed i think...
;) Ok, anything else?...
:biggrin: Of course! complete source code included.
:greenclp:
:biggrin: the .exe attached...
:t

:P
Title: Re: Tita in labyrinths
Post by: zedd151 on June 04, 2018, 02:21:22 PM
Okay, I downloaded and tried it out. What is the object of the game?
I simply don't understand.   :(

I see no labrynths, or are they 'hidden'?

also I looked at the code and see numerous 32 bit registers, is that intentional or an oversight during the conversion?


It seems too work, but as I don't understand fully the object of the game cannot comment further.
Title: Re: Tita in labyrinths
Post by: zedd151 on June 04, 2018, 02:48:10 PM
 Found the 32 bit version here.  (http://masm32.com/board/index.php?topic=6554.msg70255#msg70255)

This version seems to work exactly the same, congrats! But I still don't get the game. How to 'win'??  :icon_confused:

maybe I'm just 'slow'..   :P
Title: Re: Tita in labyrinths
Post by: aw27 on June 04, 2018, 04:24:52 PM
Runs well here and the code style follows the "do it rough and without mercy" fashion, which I adopt as well (most of the time).  :t

Hi Zed, the labyrinths are there. May be something is missing or was cut short in your system.
Title: Re: Tita in labyrinths
Post by: zedd151 on June 04, 2018, 04:30:45 PM
Quote from: AW

Hi Zed, the labyrinths are there. May be something is missing in your system.

That is quite possible. I have been tweaking Windows 10 to death trying to get the OS small as possible due to small 32 GB hard drive.

can you post a screen capture?

This is what I have:
Title: Re: Tita in labyrinths
Post by: aw27 on June 04, 2018, 04:37:30 PM
OK
Title: Re: Tita in labyrinths
Post by: zedd151 on June 04, 2018, 04:40:02 PM
Odd that. I knew something was amiss. lemme try running it from an unaldulterated copy of Win 10, or even WinPE.....


>>> a little later -->>>

I don't have a backup of the original install of Win 10, but on WinPE I get the same result.  :icon_confused:

I'm sure it is a nice little game.
Title: Re: Tita in labyrinths
Post by: felipe on June 05, 2018, 02:18:09 AM
zedd from this page of microsoft:https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-intro (https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/winpe-intro) i read:
QuoteWindows PE is not a general-purpose operating system. It may not be used for any purpose other than deployment and recovery.
And also:
QuoteWindows PE does not support any of the following:
Running 64-bit apps on the 32-bit version of Windows PE.

So i guess that even if you have the winpe 64 version you will have problems when trying to use this "tool" as a general purpose windows OS.  :idea:

AW thanks for trying it.  :icon14:
Title: Re: Tita in labyrinths
Post by: felipe on June 05, 2018, 02:31:52 AM
Quote from: zedd151 on June 04, 2018, 02:21:22 PM
also I looked at the code and see numerous 32 bit registers, is that intentional or an oversight during the conversion?

This is normal behavior, even lots of windows api variables will still be 32 bits.  :idea:

Btw, thanks for trying it too zedd.  :icon14:
Title: Re: Tita in labyrinths
Post by: zedd151 on June 05, 2018, 05:38:33 AM
  quoting Microsoft ....
Quote from: felipe
...Windows PE is not a general-purpose operating system. It may not be used for any purpose other than deployment and recovery.

[rant]

No kidding. It is a tool I use for whatever purposes I need, including cleaning the garbage they put into Windows 10 Home Edition. It is very helpful in escaping the intrusive Full Windows 10 version. I'll be damned if Micros**t tells me what to have or not on MY system, and I'm tired of my executables getting deleted from MY hard drive, by 'Defender;   MrT  (I pity da fool) and whatever other tricks they try to pull.

I have great ire against Micro$oft. Have you seen the amount of data they collect? The further up the road they get the worse they become. Micros**t, Google and others have become the largest Trojan programming organization on the planet. There is a good reason why I have shut down Windows Update completely. I have a nice Clean Running Non Intrusive Windows operating system now.
[/rant]

Also regarding the above quote from Micros**t, They should tell the dozens of companies that package their own (Not MS) recovery, backup, and other utilities around and to run on WinPE. So that quote by itself is inaccurate.

Sorry for the rant, it is not directed towards you, you seem to mean well.

Quote
Btw, thanks for trying it too zedd

It looks like a nice little game.   :t
Title: Re: Tita in labyrinths
Post by: Siekmanski on June 05, 2018, 06:09:32 AM
Nice little game. works on win 8.1
Title: Re: Tita in labyrinths
Post by: felipe on June 05, 2018, 07:43:56 AM
Thanks for trying it siekmanski.  :icon14:

Quote from: zedd151 on June 05, 2018, 05:38:33 AM
you seem to mean well.

:biggrin:

Zedd i understand you, that's why i use windows 8.1... :bgrin: Is much less intrusive and controllable, i think that you will like  :idea:. As regard with what you have done with your OS i will said that if it can't run an app that only uses the kernel32.dll (as the main front let's say) probably you have broken it a little... :idea:
Title: Re: Tita in labyrinths
Post by: zedd151 on June 05, 2018, 07:48:12 AM
Quote from: felipeprobably you have broken it a little...

Isn't the first time, either.  :(
But I'm working on a better approach using 'dism.exe' to clean up unwanted components.

My taskbar and start menu are screwed up a little as well.

At any rate, that is some nice code. Reminds me of old dos games.
I never knew how to code like that for the console.
Title: Re: Tita in labyrinths
Post by: felipe on June 05, 2018, 07:54:21 AM
Actually windows supplies nice console functions. You can have a look to tita 32 bits or other console programs in this forum. Also the win api docs will help you a lot. Also (not an expert here), but if you have a question with it maybe i can help.  :idea:
Title: Re: Tita in labyrinths
Post by: aw27 on June 06, 2018, 05:34:59 AM
Quote from: zedd151 on June 05, 2018, 07:48:12 AM
Isn't the first time, either.  :(

It looks like there is something wrong with the video drivers
Title: Re: Tita in labyrinths
Post by: zedd151 on June 06, 2018, 06:21:26 AM
Quote from: AW
It looks like there is something wrong with the video drivers

That's sound advice,  or should I say video advice.  You you are probably 100 %  correct

I'm my haste to get my OS down to a more manageable size,  I purposely neglected to install drivers.  The ones supplied by MS seem to work fairly well and no complaints or error messages from any programs that I run.   But I will now try to install just the video drivers and not the complete install without the gui interface for adjustments I'll never make.  As soon as I get home from work.

Sorry felipe for the hijack,  had to reply to aw


Later-------------------------------------------------------------------;

I reinstalled the video driver package. Have the same results, sad to say. I've done so much tinkering on this box it's hard to know which 'tinker' is causing this bug.

When I have a free weekend afternoon, I will do a complete factory reinstall of Windows 10 and the full driver ensemble. Of course I will not keep my computer set up that way.  I will re install my lighter version of Windows 10 from a backup. (That only takes 8 minutes or less to reinstall)
Title: Re: Tita in labyrinths
Post by: daydreamer on June 06, 2018, 06:29:38 PM
Quote from: felipe on June 05, 2018, 07:54:21 AM
Actually windows supplies nice console functions. You can have a look to tita 32 bits or other console programs in this forum. Also the win api docs will help you a lot. Also (not an expert here), but if you have a question with it maybe i can help.  :idea:
nice Little game,but it doesnt work properly when rendering the 4 ghosts  :P
just kidding,great to make a 64bit game :t
so with so much experience with console games, you can tell all the escape codes?


Title: Re: Tita in labyrinths
Post by: felipe on June 07, 2018, 01:27:36 AM
 :biggrin: I have actually used the Virtual-Key Codes.  And in my laters console programs i have used the easy name: VK_LEFT, VK_SPACE, ETC.  :idea: The code above was the first of the console games i did and when i ported to 64 bits now, i didn't intended almost any improvement (even with the comments).  :idea:
Pacman has always been a great game.  :icon14:
Title: Re: Tita in labyrinths
Post by: felipe on June 07, 2018, 01:49:59 AM
Btw, thanks for trying it daydreamer. I hope you have enjoyed yesterday your national day celebration.  :t

I mean yesterday according to the forum date, i really don't know the date there in sweden.  :idea:
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 03:07:14 AM
Quote from: zedd151 on June 04, 2018, 04:30:45 PMThis is what I have:
Same for me on Win7-64 - no labyrinth, just one line of stars. It seems, though, that it prints the labyrinth lines, unfortunately all of them to the same row. Check your data section, and remember what CrLf means. Screenshot below.
Title: Re: Tita in labyrinths
Post by: daydreamer on June 07, 2018, 03:14:48 AM
Quote from: felipe on June 07, 2018, 01:49:59 AM
Btw, thanks for trying it daydreamer. I hope you have enjoyed yesterday your national day celebration.  :t

I mean yesterday according to the forum date, i really don't know the date there in sweden.  :idea:
Thanks, about 5 hours left of it
No I meant you become expert on this :
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences (https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences)
Title: Re: Tita in labyrinths
Post by: aw27 on June 07, 2018, 03:47:18 AM
Felipe,
You need to set the console window size to 80x25, it is not enough SetConsoleScreenBufferSize. This explains some problems.
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 04:09:27 AM
True but that doesn't solve the CrLf problem.
Title: Re: Tita in labyrinths
Post by: zedd151 on June 07, 2018, 06:18:23 AM
Quote from: jj200
Same for me on Win7-64 - no labyrinth, just one line of stars. It seems, though, that it prints the labyrinth lines, unfortunately all of them to the same row. Check your data section, and remember what CrLf means. Screenshot below.

A-ha,  I  was troubleshooting flaws on my end.  I hadn't thought about debugging the executable.

Title: Re: Tita in labyrinths
Post by: felipe on June 07, 2018, 03:04:54 PM
That's weird. Don't know how the size of the console window can affect this. I had resize the window (using the system menu of the console window) and i can't see anything similar to the zedd and jj screenshots.  :idea:
And what's wrong with the crlf?  :idea:

Btw, thanks for trying it jj2007.  :icon14:
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 03:43:57 PM
Quote from: felipe on June 07, 2018, 03:04:54 PMAnd what's wrong with the crlf?
That it's not a crlf.
Title: Re: Tita in labyrinths
Post by: aw27 on June 07, 2018, 04:46:57 PM
Quote from: felipe on June 07, 2018, 03:04:54 PM
That's weird. Don't know how the size of the console window can affect this. I had resize the window (using the system menu of the console window) and i can't see anything similar to the zedd
It is not by resizing it is when the default size is not  80x25 that we will see it.
Title: Re: Tita in labyrinths
Post by: zedd151 on June 07, 2018, 06:09:38 PM
Quote from: AW on June 07, 2018, 04:46:57 PM

It is not by resizing it is when the default size is not  80x25 that we will see it.

Right click on title bar, select properties, in the 'Layout' tab change width to 80 and height to 25. uncheck "let system position Window" and uncheck "Wordwrap"

That does the trick . now the game displays the labrinths.


New screenshot. Reduced physical size to 75% and converted to gif for filesize


Just think I was ready to undertake a reinstall of an unmodified Windows 10.   :dazzled:
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 07:02:03 PM
Quote from: zedd151 on June 07, 2018, 06:09:38 PMuncheck "Wordwrap"
Interesting - no such option on Win7, so that seems a new feature on Win10.

Still no labyrinth on Win7, simply because the CrLfs aren't what they should be. Strange that it works on Win10, though. And Felipe has lost interest, it seems.
Title: Re: Tita in labyrinths
Post by: zedd151 on June 07, 2018, 07:29:41 PM
Have you tried resizing the console window jj?
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 08:16:29 PM
Quote from: zedd151 on June 07, 2018, 07:29:41 PM
Have you tried resizing the console window jj?

Yes. Have you looked at the source?
Title: Re: Tita in labyrinths
Post by: zedd151 on June 07, 2018, 08:23:03 PM
Quote from: jj2007
Yes. Have you looked at the source?

Yep.
Title: Re: Tita in labyrinths
Post by: aw27 on June 07, 2018, 09:18:56 PM
Felipe,

I had a look at the code.
1) You are not obtaining the output handle.
I don't see anywhere this:
mov     rcx,STD_OUTPUT_HANDLE
call    GetStdHandle

2) You need to set the window size with:
SetConsoleWindowInfo
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 09:48:18 PM
Quote from: AW on June 07, 2018, 09:18:56 PM1) You are not obtaining the output handle.
I don't see anywhere this:
mov     rcx,STD_OUTPUT_HANDLE
call    GetStdHandle

He uses WriteConsole instead.

Strange that nobody spots this:firslab0    byte     '********************************************************************************',0dh
            byte     '*       *******************                               **********************',0dh
            byte     '******* ******************* ********************** ***************            **',0dh
Title: Re: Tita in labyrinths
Post by: aw27 on June 07, 2018, 09:59:55 PM
Quote from: jj2007 on June 07, 2018, 09:48:18 PM
Quote from: AW on June 07, 2018, 09:18:56 PM1) You are not obtaining the output handle.
I don't see anywhere this:
mov     rcx,STD_OUTPUT_HANDLE
call    GetStdHandle

He uses WriteConsole instead.

Strange that nobody spots this:firslab0    byte     '********************************************************************************',0dh
            byte     '*       *******************                               **********************',0dh
            byte     '******* ******************* ********************** ***************            **',0dh


He needs the output handle to set the size of the console.
If the console has the correct size the characters will flow from line to line even without crlf and the labyrinth will work.
Title: Re: Tita in labyrinths
Post by: jj2007 on June 07, 2018, 10:20:55 PM
Relying on the "correct" size and line wrapping is a hack for me. If he uses "***", 0Dh, 0Ah it will work with any size that is wide enough.
Title: Re: Tita in labyrinths
Post by: felipe on June 08, 2018, 01:20:20 AM
I  don't used getstdhandle because i use createconsolescreenbuffer which returns a handle for the screen buffer.

This is just a porting work to an old game (my first in 32 bits). The intention it was not to make a full improvement. Because in the 32 bits version the only problem reported was another issue and was fixed (with help of AW) i didn't even revised again the code. The program still works for me and as far as i know for others too. Until now the problems are in a computer with some "special format" (zedd) and from the one of jj (?).

Also i has changed the console window size before trying the game and i have no problems to play it at all. Neither i see a problem with crlf. You should have a look to the writeconsole funtion and relateds.  :idea:
Title: Re: Tita in labyrinths
Post by: felipe on June 08, 2018, 01:24:21 AM
Oh btw, the screenshot (last one) from zedd is a little weird too, in the sense that shows the cursor, which is been made invisible in the program. Bur as i said his OS is a little special i will say again.  :idea:
Title: Re: Tita in labyrinths
Post by: felipe on June 08, 2018, 01:27:18 AM
Also the char for tita in that screenshot is not the one that was intended.  :idea:
Title: Re: Tita in labyrinths
Post by: zedd151 on June 08, 2018, 02:12:48 AM
Quote from: felipe on June 08, 2018, 01:24:21 AM
Oh btw, the screenshot (last one) from zedd is a little weird too, in the sense that shows the cursor, which is been made invisible in the program. Bur as i said his OS is a little special i will say again.  :idea:

This Saturday I plan on doing a fresh factory install,  all drivers included.  I will then find out if the font/hidden cursor is repaired or not,  plus any other anomalies caused by my modified system. Through process of elimination I will get to the bottom of this.   :icon_cool:

I will then make a backup of the "clean" install for future references.    :icon_mrgreen:
Title: Re: Tita in labyrinths
Post by: jj2007 on June 08, 2018, 02:25:51 AM
Quote from: felipe on June 08, 2018, 01:20:20 AMi have no problems to play it at all
That is the right attitude :t
Title: Re: Tita in labyrinths
Post by: felipe on June 08, 2018, 03:19:25 AM
jj2007 i don't know if that is sarcasm or not. Anyway i have just revised a little the code and i have found a very odd thing here:


   lea     rsi,firslab0  ; Line by line.
        mov     rbx,2024            ; The size of each labyrinth.

completelab:
        mov     rcx,r14 ; stdoutx.
        mov     rdx,rsi
        mov     r8,1
        lea     r9,chrswrit
        mov     dword ptr[rsp+20h],NULL
        call    WriteConsole

        inc     rsi         ; Next line.

        dec     rbx
        cmp     rbx,0         ; Until we finish.
        jne     completelab


And the same problem in the 32 bits version:

            mov                 esi,offset firslab0                                 ; Line by line.
            mov                 ebx,2024                                            ; The size of each labyrinth.

align 4

completelab:

            push                NULL
            push                offset chrswrit
            push                1                                               
            push                esi
            push                stdoutx
            call                WriteConsole
           
            inc                 esi                                                 ; Next line.

            dec                 ebx
            cmp                 ebx,0                                               ; Until we finish.
            jne                 completelab


Both of course are bad comments. And in both the approach is really inefficient. It's not actually writing line by line, it's doing it char by char.  :P

Btw and anyway....soon as i can i will try this (both versions) in a windows 7.  :idea:
I will remind here to all of you that this code may used, reused, improved, corrected, destroyed, ignored, etc, etc. But not necessarily by me.  :biggrin:  :idea:
Title: Re: Tita in labyrinths
Post by: zedd151 on June 08, 2018, 06:11:47 AM
Quote from: felipe
I will remind here to all of you that this code may used, reused, improved, corrected, destroyed, ignored, etc, etc. But not necessarily by me.  :biggrin:  :idea:

This weekend I'll look at the 32 bit version to see what if anything I  could do with it.   :icon_cool:
Will be my first coding session for quite some time.

I need a break from trying to break my OS.   :P

Quote from: felipe
jj2007 i don't know if that is sarcasm or not.
Sounds like jj being jj. You get used to it.
Title: Re: Tita in labyrinths
Post by: jj2007 on June 08, 2018, 12:47:21 PM
Quote from: felipe on June 08, 2018, 03:19:25 AM
jj2007 i don't know if that is sarcasm or not.

Ok, it seems I have to explain it:

Quote from: jj2007 on June 08, 2018, 02:25:51 AM
Quote from: felipe on June 08, 2018, 01:20:20 AMi have no problems to play it at all
That is the right attitude :t

Imagine for a moment that there is a fat bug in M$ Office, and Millions of users complain bitterly that they can't use M$ Word. And then the CEO of Microsoft says "We tested it, and it runs just fine on our computers, where is the problem?".

How would Micros**t's clients react?

In this thread, I have repeatedly pointed to your bug, but you have chosen to ignore that. To help others, I'll explain it briefly here:

If you print to the console, and your strings are ending with 0Dh (aka carriage return, cr) instead of 0Dh, 0Ah (aka carriage return + line feed, crlf, aka 13, 10), then all you can see is one line, because the strings will not advance at all. I have pointed to this phenomenon shortly after the "It looks like there is something wrong with the video drivers" post:

QuoteSame for me on Win7-64 - no labyrinth, just one line of stars. It seems, though, that it prints the labyrinth lines, unfortunately all of them to the same row. Check your data section, and remember what CrLf means.

Finally, and I promise this will be my last comment on your coding:
completelab:

            push                NULL
            push                offset chrswrit
            push                1                                               
            push                esi
            push                stdoutx
            call                WriteConsole
           
            inc                 esi                                                 ; Next line.

            dec                 ebx
            cmp                 ebx,0                                               ; Until we finish.
            jne                 completelab


For a while, I have noted that you don't use invoke. That makes it difficult to read your code, and it is, of course, an elegant way to introduce bugs that are difficult to chase, especially in x64. But it looks very professional and close to the bare metal etc.; to improve the look even further, however, I would suggest to care a little bit for the basics, such as flags:
            dec                 ebx
            cmp                 ebx,0                                               ; Until we finish.
            jne                 completelab

            dec                 ebx
            jne                 completelab                                       ; Until we finish.
Title: Re: Tita in labyrinths
Post by: felipe on June 08, 2018, 04:08:55 PM
Yes the cmp was inefficient code too. But i don't think that has anything to do with the look of the code.  :idea:

There's no  problem with crlf because of this:

From microsoft win32 api documentation:

Quote
High-Level Console Modes
...

Both of the following console output modes are enabled for a console screen buffer when it is created:

·   Processed output mode
·   Wrapping at EOL output mode
...

ENABLE_WRAP_AT_EOL_OUTPUT   
Used with a console screen buffer handle to cause the current output position (cursor position) to move to the first column in the next row (line) when the end of the current row is reached.
...

That's the reason for the use of only the 0ah control char. Of course that was inefficient too, because even this character wasn't required. :idea:

Btw, as for me, there's no problems to receive more comments, so from my side, there's no need to promises to not make more comments to tita's original code. (i mean this appliying to the 64 bits version as well).  :idea:

As respect to the microsoft comparision...Don't know what to say, probably it's not too much related with my case... :P

Btw as i said before soon as i can i will run both original versions in a windows 7 to see if i can get something similar to your screenshot.  :idea: But as i have said too, this has been an (almost) fully mechanical port from this old (my first 32 bit game) to a 64 bit version, with almost none improvement intended, nor code revision either.  :idea:
Title: Re: Tita in labyrinths
Post by: aw27 on June 08, 2018, 04:21:06 PM
Quote
Btw as i said before soon as i can i will run both original versions in a windows 7 to see if i can get something similar to your screenshot.
No need, my capture  was made on Windows 7. (http://masm32.com/board/index.php?topic=7193.msg77875#msg77875)  :badgrin:
Title: Re: Tita in labyrinths
Post by: felipe on June 09, 2018, 08:21:12 AM
 :P