Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 My first Win32 game prototype

views
     
TSMat Quasar
post Feb 6 2025, 03:49 PM, updated 10 months ago

Getting Started
**
Validating
64 posts

Joined: Nov 2024
Hi, this Win32 game prototype took me about 9 months from start to finish.

I started with console interface first, then finalized with GUI version.

It is written purely in FASM, using raw Win32 API.
Although it is in GUI, I use TextOutA function in GDI32.dll, which is just displaying text in GUI window, no graphics at the moment.

There is no collision detection yet, no scoring. What you can do with this program is:
1) Move the caret (gun) to the left or to the right
2) Shoot one bullet at one time
3) Watch the enemies moving around

user posted image

For the enemies to move around, I use random number generator to predict the direction of movement.

I have included the source code here (EXE is not included as it is falsely detected as virus).
If you are interested to run the program, you can....
1) Download SHOOT.txt
2) Rename SHOOT.txt to SHOOT.asm
3) Download Flat Assembler for Windows
4) Run FASMW.EXE and open SHOOT.asm
5) Click Compile
6) Go to the File Explorer, and you'll see SHOOT.EXE along with SHOOT.asm.

Note: If you compile yourself, Windows Security won't detect this as virus. Of course, my code does nothing malicious.

But my game is still very crude, I might consider using GDI+ or SDL2 to develop my graphical version of 2D game.


Attached File(s)
Attached File  SHOOT.txt ( 10.15k ) Number of downloads: 27
Kayziealnatz
post Feb 6 2025, 04:54 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
Splendid!
Kayziealnatz
post Feb 6 2025, 04:56 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(Mat Quasar @ Feb 6 2025, 04:49 PM)
Hi, this Win32 game prototype took me about 9 months from start to finish.

I started with console interface first, then finalized with GUI version.

It is written purely in FASM, using raw Win32 API.
Although it is in GUI, I use TextOutA function in GDI32.dll, which is just displaying text in GUI window, no graphics at the moment.

There is no collision detection yet, no scoring. What you can do with this program is:
1) Move the caret (gun) to the left or to the right
2) Shoot one bullet at one time
3) Watch the enemies moving around

user posted image

For the enemies to move around, I use random number generator to predict the direction of movement.

I have included the source code here (EXE is not included as it is falsely detected as virus).
If you are interested to run the program, you can....
1) Download SHOOT.txt
2) Rename SHOOT.txt to SHOOT.asm
3) Download Flat Assembler for Windows
4) Run FASMW.EXE and open SHOOT.asm
5) Click Compile
6) Go to the File Explorer, and you'll see SHOOT.EXE along with SHOOT.asm.

Note: If you compile yourself, Windows Security won't detect this as virus. Of course, my code does nothing malicious.

But my game is still very crude, I might consider using GDI+ or SDL2 to develop my graphical version of 2D game.
*
I was working on this about couple hours ago...

Something that goes like this..



Project Directory Structure

/YourGameProject

├── /assets
│ ├── sprite.png
│ ├── map.png

├── /src
│ ├── main.cpp
│ ├── Game.cpp
│ ├── Game.h
│ ├── Sprite.cpp
│ ├── Sprite.h
│ └── Map.cpp
│ └── Map.h

├── /build (or /bin, depending on your build system)

└── CMakeLists.txt (or Makefile, or any other build system file)



Kayziealnatz
post Feb 6 2025, 04:57 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(Kayziealnatz @ Feb 6 2025, 05:56 PM)
I was working on this about couple hours ago...

Something that goes like this..
Project Directory Structure

/YourGameProject

├── /assets
│  ├── sprite.png
│  ├── map.png

├── /src
│  ├── main.cpp
│  ├── Game.cpp
│  ├── Game.h
│  ├── Sprite.cpp
│  ├── Sprite.h
│  └── Map.cpp
│  └── Map.h

├── /build (or /bin, depending on your build system)

└── CMakeLists.txt (or Makefile, or any other build system file)
*
I got my hands on the documentation, and tried to look it up on ChatGPT. It was very frustrating, they kept giving me error. I finally managed to move the sprite around the map..
Maybe I'll post it here if I got time ya
SUSifourtos
post Feb 6 2025, 05:01 PM

Look at all my stars!!
*******
Senior Member
2,256 posts

Joined: Feb 2012



If u are serious, use proper Game Engine...

Construct3
Gdevelop
Godot

I can build this, graphical, sound, deeper gameplay version, within hours with engine above.

Cobstruct 3, gdevelop are no code

Both 3 above can export to almost all gaming platforms.....

Html, win, macos, Linus, Xbox, iOS, android
Godot even can export playstation.....
But u need QC by Sony to publish
Kayziealnatz
post Feb 6 2025, 05:04 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(ifourtos @ Feb 6 2025, 06:01 PM)
If u are serious, use proper Game Engine...

Construct3
Gdevelop
Godot

I can build this, graphical, sound, deeper gameplay version, within hours with engine above.

Cobstruct 3, gdevelop are no code

Both 3 above can export to almost all gaming platforms.....

Html, win, macos, Linus, Xbox, iOS, android
Godot even can export playstation.....
But u need QC by Sony to publish
*
I do actually agree and I am using few engines. I am just testing the water to get my feet wet. biggrin.gif

Out of those three, I heard good things about Godot that it allows u to build your own engine on top of it.
Kayziealnatz
post Feb 6 2025, 05:05 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
With MIT LICENSE!!!
SUSifourtos
post Feb 6 2025, 05:11 PM

Look at all my stars!!
*******
Senior Member
2,256 posts

Joined: Feb 2012



QUOTE(Kayziealnatz @ Feb 6 2025, 05:04 PM)
I do actually agree and I am using few engines. I am just testing the water to get my feet wet. biggrin.gif

Out of those three, I heard good things about Godot that it allows u to build your own engine on top of it.
*
Nope.
I deepdive 3 above
All 3 are unique.

Godot, powerful enough to challenge unity.
But need coding

Construct 3, visual code, pricey.
Gdevelop, less powerful, but totally free. Also no code.


For non coder, don't go Godot.

The essence of a Game is not powerful engine.
Like 2024 hit, vampire survivors
Can easily built with simple engine

But those AAA bullshit that cost 100m still a pile of shit after launched.


For indie, you need a proper scale for your project, and creative enough to dig deeper in gameplay.

Btw, I am switching to Godot for 1 feature, it can run local LLM and API to Ur game. That's Game changing
Kayziealnatz
post Feb 6 2025, 05:17 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(ifourtos @ Feb 6 2025, 06:11 PM)
Nope.
I deepdive 3 above
All 3 are unique.

Godot, powerful enough to challenge unity.
But need coding

Construct 3, visual code, pricey.
Gdevelop, less powerful, but totally free. Also no code.
For non coder, don't go Godot.

The essence of a Game is not powerful engine.
Like 2024 hit, vampire survivors
Can easily built with simple engine

But those AAA bullshit that cost 100m still a pile of shit after launched.
For indie, you need a proper scale for your project, and creative enough to dig deeper in gameplay.

Btw, I am switching to Godot for 1 feature, it can run local LLM and API to Ur game. That's Game changing
*
I am dabbling with Godot, RPG Maker VX Ace, RPG Maker Mz, Phaser and Defold.

I am mostly wanting to make a 2d top down or isometric RPG. RPG Maker are streamlined that way.

I am basically still beginner. I liked and enjoyed exploring and experimenting options I got.

I think I most prolly go for Godot in the far flung future.

Only because at the highest rung I wanna make my own game engine, so why not learn along the way whilst make two or three games at least on my way

Kayziealnatz
post Feb 6 2025, 05:19 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
It's not the engine that count, its how you use them that makes all the difference.

Well, not entirely true but you got what I meant

This post has been edited by Kayziealnatz: Feb 6 2025, 05:19 PM
flashang
post Feb 6 2025, 11:32 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(Mat Quasar @ Feb 6 2025, 03:49 PM)
Hi, this Win32 game prototype took me about 9 months from start to finish.

I started with console interface first, then finalized with GUI version.

It is written purely in FASM, using raw Win32 API.
Although it is in GUI, I use TextOutA function in GDI32.dll, which is just displaying text in GUI window, no graphics at the moment.

There is no collision detection yet, no scoring. What you can do with this program is:
1) Move the caret (gun) to the left or to the right
2) Shoot one bullet at one time
3) Watch the enemies moving around

user posted image

For the enemies to move around, I use random number generator to predict the direction of movement.

I have included the source code here (EXE is not included as it is falsely detected as virus).
If you are interested to run the program, you can....
1) Download SHOOT.txt
2) Rename SHOOT.txt to SHOOT.asm
3) Download Flat Assembler for Windows
4) Run FASMW.EXE and open SHOOT.asm
5) Click Compile
6) Go to the File Explorer, and you'll see SHOOT.EXE along with SHOOT.asm.

Note: If you compile yourself, Windows Security won't detect this as virus. Of course, my code does nothing malicious.

But my game is still very crude, I might consider using GDI+ or SDL2 to develop my graphical version of 2D game.
*
Personal Opinion :

Using any other library / 3rd party library (GDI+, SDL2, game engine, graphics / audio / video, ... ) are mean for improve visual, but not the main logic.

Port over to other system (web, mobile phone, different os, different cpu) need some different development tools.

Congras, you make the first move.

smile.gif


Kayziealnatz
post Feb 7 2025, 12:51 AM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(flashang @ Feb 7 2025, 12:32 AM)
Personal Opinion :

Using any other library / 3rd party library (GDI+, SDL2, game engine, graphics / audio / video, ... ) are mean for improve visual, but not the main logic.

Port over to other system (web, mobile phone, different os, different cpu) need some different development tools.

Congras, you make the first move.

smile.gif
*
Between SDL2 and SFML, which one is more viable based on your personal exp
TSMat Quasar
post Feb 7 2025, 08:53 PM

Getting Started
**
Validating
64 posts

Joined: Nov 2024
QUOTE(flashang @ Feb 6 2025, 11:32 PM)
Congras, you make the first move.

smile.gif
*
Thank you.
I am now testing doing graphical version of shooting game using SDL2, can put sound effect and get random number easily, basically these are files to be distributed together with my game code and EXE:

user posted image

The libraries used are:
CODE

        'SDL2.DLL'
        'SDL2_IMAGE.DLL'
        'SDL2_MIXER.DLL'


For example, the first line of code will be :
CODE
       cinvoke SDL_Init,SDL_INIT_VIDEO or SDL_INIT_AUDIO  


Note: C calling convention, hence cinvoke, which is equivalent to:
CODE
push SDL_INIT_VIDEO or SDL_INIT_AUDIO
call   [SDL_Init]
add   esp, 4    


Easy isn't it, then to open MP3, first line is:
CODE
cinvoke Mix_OpenAudio,22050,AUDIO_S16SYS,2,1024


Basically it is just calling the SDL2 libaries function, none of which is doing from scratch.

This post has been edited by Mat Quasar: Feb 16 2025, 12:59 AM
TSMat Quasar
post Feb 9 2025, 12:10 AM

Getting Started
**
Validating
64 posts

Joined: Nov 2024
QUOTE(Kayziealnatz @ Feb 7 2025, 12:51 AM)
Between SDL2 and SFML....
*
Now is SDL3 already, I am out! Just 3 weeks ago, they released SDL3:

https://github.com/libsdl-org/SDL/releases/tag/release-3.2.0

Also, what is SDL:

QUOTE
About SDL
Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

SDL officially supports Windows, macOS, Linux, iOS, and Android. Support for other platforms may be found in the source code.

SDL is written in C, works natively with C++, and there are bindings available for several other languages, including C# and Python.


Since it is written in C, calling the SDL libraries function must be using C calling convention (caller clean up the stack on return).

I heard people says even DOTA2 and CS2 are using SDL 3.0.

This post has been edited by Mat Quasar: Feb 16 2025, 05:07 PM
Kayziealnatz
post Feb 9 2025, 03:00 AM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(Mat Quasar @ Feb 9 2025, 01:10 AM)
Now is SDL3 already, I am out! Just 3 weeks ago, they released SDL3:

https :// github.com/libsdl-org/SDL/releases/tag/release-3.2.0
*
Wow, so its kinda brand new, we can make our own snowball effect


QUOTE(Mat Quasar @ Feb 9 2025, 01:10 AM)

Also, what is SDL:
Since it is written in C, calling the SDL libraries function must be using C calling convention (caller clean up the stack on return).
*
 
I see



QUOTE(Mat Quasar @ Feb 9 2025, 01:10 AM)

I heard people says even DOTA2 and CS2 are using SDL 3.0.
*
That is correct, I just looked it up
flashang
post Feb 9 2025, 04:33 PM

Casual
***
Junior Member
355 posts

Joined: Aug 2021


QUOTE(Kayziealnatz @ Feb 7 2025, 12:51 AM)
Between SDL2 and SFML, which one is more viable based on your personal exp
*
Personally, I would use unreal / unity for more complex projects.


as for SDL2 / SFML, reference from the internet :

-----
SDL2, or Simple DirectMedia Layer 2,
is a cross-platform software development library that provides low-level access
to audio, keyboard, mouse, joystick, and graphics hardware.

SDL is a cross-platform multimedia library designed to
provide low level access to audio, keyboard, mouse, joystick, etc.
It also supports 3D hardware via OpenGL.

-----
SFML stands for Simple and Fast Multimedia Library,
which is a cross-platform software development library written in C++.
It provides a simple interface for handling graphics, audio, and network functionalities,
making it popular among game developers and multimedia application creators.

SFML uses OpenGL under the hood and the main difference is that in OpenGL you will be writing your own renderer, 2D or 3D, from scratch.
SFML it easier to use because you have do less yourself.

-----

* depends on your development tool / familiar tool.

C -> SDL
C++ -> SFML

-----
If you're not create your own engine, use existing engine is preferred, as your project could expand more easily.


smile.gif



This post has been edited by flashang: Feb 9 2025, 11:01 PM
Kayziealnatz
post Feb 10 2025, 04:20 PM

Getting Started
**
Junior Member
178 posts

Joined: Oct 2024
QUOTE(flashang @ Feb 9 2025, 05:33 PM)
Personally, I would use unreal / unity for more complex projects.
as for SDL2 / SFML, reference from the internet :

-----
SDL2, or Simple DirectMedia Layer 2,
is a cross-platform software development library that provides low-level access
to audio, keyboard, mouse, joystick, and graphics hardware.

SDL is a cross-platform multimedia library designed to
provide low level access to audio, keyboard, mouse, joystick, etc.
It also supports 3D hardware via OpenGL.

-----
SFML stands for Simple and Fast Multimedia Library,
which is a cross-platform software development library written in C++.
It provides a simple interface for handling graphics, audio, and network functionalities,
making it popular among game developers and multimedia application creators.

SFML uses OpenGL under the hood and the main difference is that in OpenGL you will be writing your own renderer, 2D or 3D, from scratch.
SFML it easier to use because you have do less yourself.

-----

* depends on your development tool / familiar tool.

C -> SDL
C++ -> SFML

-----
If you're not create your own engine, use existing engine is preferred, as your project could expand more easily.
smile.gif
*
I am so wanting to use UE but my modest laptop doesnt allow me xD

I might try my hands on Unity later

meng6
post Feb 16 2025, 02:19 AM

Getting Started
**
Junior Member
63 posts

Joined: Aug 2020
So much Game Engine info here, thanks for the sharing thumbup.gif

 

Change to:
| Lo-Fi Version
0.0176sec    0.23    6 queries    GZIP Disabled
Time is now: 1st December 2025 - 07:01 AM