flat assembler
Message board for the users of flat assembler.

Index > Windows > My first Win32 console game prototype

Author
Thread Post new topic Reply to topic
MatQuasar



Joined: 25 Oct 2023
Posts: 105
MatQuasar 28 Apr 2024, 08:43
Hi all, although not my first game (as I have written simple game for DOS and EPOC), this is my first Win32 attempt to sketch a shooting game prototype.

Currently it only allow moving of spaceship (a "^" symbol), no weapon firing, and no enemies yet.

I still don't know how to keep track each of the bullet (can be more than one) and moving it simulateneously.....

My code use ANSI escape sequence, and currently it is only prototype. Looking for your feedback!


Description: Screenshot
Filesize: 6.83 KB
Viewed: 910 Time(s)

Capture.PNG


Description: v0.01 - Moving spaceship only, no weapon, no enemies
Download
Filename: shooter.asm
Filesize: 6.1 KB
Downloaded: 54 Time(s)

Post 28 Apr 2024, 08:43
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3976
Location: vpcmipstrm
bitRAKE 28 Apr 2024, 10:05
It is working well here. I tried to break it with too many keys, changing direction, etc. Yet, it remained responsive.
Post 28 Apr 2024, 10:05
View user's profile Send private message Visit poster's website Reply with quote
MatQuasar



Joined: 25 Oct 2023
Posts: 105
MatQuasar 28 Apr 2024, 10:11
bitRAKE wrote:
It is working well here. I tried to break it with too many keys, changing direction, etc. Yet, it remained responsive.


This is good feedback!! Very much appreciated, especially from expert like you.

Next I will work on bullet firing.... Laughing
Post 28 Apr 2024, 10:11
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1590
Location: Toronto, Canada
AsmGuru62 28 Apr 2024, 21:47
I think the way it should work is that you have your objects coordinates in a 2D array -- which is modeled after the console X rows and Y columns.
Then during the game you move the objects: gun is moving, bullets flying, enemies moving according to some AI.
When objects move -- you write it all into a memory buffer -- your model.
Then, finally, you dump the whole buffer into console in one operation -- Console API has a function for that.
Now, you do that dumping often, like 40 times per second or so.
Post 28 Apr 2024, 21:47
View user's profile Send private message Send e-mail Reply with quote
MatQuasar



Joined: 25 Oct 2023
Posts: 105
MatQuasar 29 Apr 2024, 07:00
AsmGuru62 wrote:
When objects move -- you write it all into a memory buffer -- your model.
Then, finally, you dump the whole buffer into console in one operation -- Console API has a function for that.


I have never thought of this, and am not sure if I will be able to use Console API to achieve that, I just looked at WriteConsoleOutput.

AsmGuru62 wrote:

Then during the game you move the objects: gun is moving, bullets flying, enemies moving according to some AI.


I think for gun (spaceship) and bullet, don't need AI. But for enemies (alien invasion), maybe will use random number generator (I have the code from @resolution years ago, make use of functions in ADVAPI32.DLL).

Thank you for the suggestion.
Post 29 Apr 2024, 07:00
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3976
Location: vpcmipstrm
bitRAKE 29 Apr 2024, 12:14
My thoughts were similar to AsmGuru62 - reducing API calls, because API is very slow. There is a number of techniques.

Configuring console to remove processing: Modern console is very complex. It can do UTF-8 and ANSI codes with legacy terminal emulation.

Cache operations by building up strings with periodic console update.

Someone has actually made a console game engine, lol.
https://github.com/ural89/ConsoleCraftEngine
Post 29 Apr 2024, 12:14
View user's profile Send private message Visit poster's website Reply with quote
MatQuasar



Joined: 25 Oct 2023
Posts: 105
MatQuasar 29 Apr 2024, 12:54
bitRAKE wrote:

Someone has actually made a console game engine, lol.
https://github.com/ural89/ConsoleCraftEngine


I checked, it uses ncurses, and ncurses used ANSI , like VT 220/320/420/520 (no idea what are they).... So is my approach correct in using ANSI escape code to move cursor and draw sprite?
(Maybe I should reread your post Embarassed )

I know what AsmGuru62 meant, draw in the background first then move it to screen buffer.
Post 29 Apr 2024, 12:54
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3976
Location: vpcmipstrm
bitRAKE 29 Apr 2024, 14:47
MatQuasar wrote:
VT 220/320/420/520 (no idea what are they)
Oh, you don't want to know. CRTs integrated into a desk-like furniture - the heavy steel and pressed wood terminals were hard on the back. This one skyscraper had a freight ramp that zigzagged down eight floors. Built to such a standard that they looked new at the end of their life - powered up to some CP/M based software system. My adolescent self thought they should have just pitched them out the window - to be dismantled by gravity.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 29 Apr 2024, 14:47
View user's profile Send private message Visit poster's website Reply with quote
Hrstka



Joined: 05 May 2008
Posts: 55
Location: Czech republic
Hrstka 30 Apr 2024, 12:25
Quote:
My adolescent self thought they should have just pitched them out the window - to be dismantled by gravity.

We call it "hardware acceleration by free fall" Very Happy
Post 30 Apr 2024, 12:25
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.