News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

How does game development work in assembly language?

Started by Khatch, September 26, 2023, 10:03:58 PM

Previous topic - Next topic

Khatch

https://gamedev.net/forums/topic/659359-creating-a-compiler-for-my-engine-using-llvm/5170539/

<>

https://www.reddit.com/r/asm/comments/krwtg2/how_does_game_development_work_in_assembly/

</>

zedd151

Hello Khatch,
First, welcome to the forum.

Second, just re-posting links is not a great way to make an introduction.
Tell us a little about yourself, your programming experience, and what brought you to this forum...


Zedd

jj2007

Quote from: Khatch on September 26, 2023, 10:03:58 PMhttps://www.reddit.com/r/asm/comments/krwtg2/how_does_game_development_work_in_assembly/
Gamedev in assembly on win32 is bordering on masochisticly tedious

The Reddit guys have no idea :greensml:

GuiParas equ "PacMan demo", w200, h360, b none
guiTimerMs=200    ; default is 20; place before the include line
include \masm32\MasmBasic\Res\MbGui.asm
SetGlobals imgX1, imgX2, imgY1=50, imgY2=100

Event Timer    ; set game logic
  mov edx, GuiWidth
  .if imgY1>30
    dec imgY1
  .elseif imgY1<99
    inc imgY1
  .endif
  add imgX1, 9
  If_ imgX1>edx Then Clr imgX1
  sub imgX2, 6
  If_ Sign? Then mov imgX2, edx
  GuiCls

Event Paint        ; display three images
  GuiImage 99, fit
  GuiImage 98, imgX1, imgY1, 50, 50
  GuiImage 98, imgX2, imgY2, 30, 33
EndOfCode

Resources (included in attachment; see this thread on RCDATA vs RC_DATA):
#include "resource.h"
01 RT_MANIFEST    "\\Masm32\\MasmBasic\\Res\\XpManifest.xml"
98 RCDATA "PacMan.gif"
99 RCDATA "ChessBoard.jpg"

21 lines of code. The most difficult part was finding a gif on the web. I had no luck finding a transparent one that goes from right to left.

NoCforMe

(JJ, I feel I'm following you around like a stray dog ...)

OP, please realize that what JJ posted above is not regular assembly language, but a variant, a special dialect if you will, called MasmBasic. It's a great way to program, but it's not everyone's cup of tea (not mine for sure), so just be aware of that.

But his point stands: programming anything in assembly language is not the tedious torture that many will lead you to believe it is (mostly C, Python, Java, etc., programmers who have no clue).

You're in the right place for these kinds of questions for sure.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on September 27, 2023, 06:46:38 AMOP, please realize that what JJ posted above is not regular assembly language, but a variant, a special dialect if you will, called MasmBasic.

It's a library, it is perfectly compatible with the Masm32 SDK, and it assembles just fine with any MASM version above 6.14, with UAsm, and with AsmC. Define "regular assembly language", please.

NoCforMe

Quote from: jj2007 on September 27, 2023, 06:49:40 AMDefine "regular assembly language", please.

MASM32 without MasmBasic, straightforward MASM using Microsoft's ML going back to the early 2000s.

Of course, if anyone wants to use your (MasmBasic) libraries as you pointed out, they're certainly free to, and more power to them. Don't want to convince anyone to do otherwise.

Just trying to explain what's what so the OP doesn't get confused.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on September 27, 2023, 06:53:51 AM
Quote from: jj2007 on September 27, 2023, 06:49:40 AMDefine "regular assembly language", please.

MASM32 without MasmBasic, straightforward MASM using Microsoft's ML going back to the early 2000s.

Dear friend, if I see any evidence that you are using in your code rv(), print, str$(), chr$() and other dangerous non-Microsoft stuff, I will report you to the code Gestapo :cool:

There is a great PlaySound example at \Masm32\examples\exampl04\jacts\jacts.asm
With a tiny modification, it becomes a MasmBasic source, with many advantages such as the deb macro:
if 1
    include \masm32\MasmBasic\MasmBasic.inc
    uselib winmm
else  ; *** disable the next 36 lines, they are no longer needed ***
.386
.model flat,stdcall
option casemap:none
;-----------------------------------------------------
;About      Joe's Alarm/Countdown Timer/StopWatch!
;Author:    farrier jcurran@network-one.com
;Dialog window with the following functions
;  Stopwatch with "1/100 sec accuracy" at least that is what is displayed!
;      immediate lap times can be displayed briefly without stopping SW
;  Countdown Timer (CDT) with drop down box controls for hour, minute, & seconds
;      Upper limit 59 Hours, 59 minutes, & 59 seconds
;      If Repeat After Countdown checkbox is checked CDT will repeat
;  Alarm Clock (AC) using DateTimePicker control to set alarm time and date
;For CDT & AC when time expires, an "alarm" sound is played using
;  multimedia playback "PlaySound" API.  A file picker control is used to
;  allow the user to change the sound played.
;The most recently selected options are saved in a file \Windows\jacts.ini
;  When the program runs the next time, that file is used to set the options
;  for the current session.
;-----------------------------------------------------
;-----------------------------------------------------
;INCLUDES
;______________________________________
include \masm32\include\windows.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\shell32.inc        ;For GetModuleFileName
include \masm32\include\comctl32.inc        ;For DateTimePicker
include \masm32\include\comdlg32.inc        ;For GetOpenFileName
include \masm32\include\winmm.inc          ;For MultiMedia Playback
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\comctl32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\winmm.lib
endif

Jacts.asm is a 1,130 lines source, but replacing the stuff on top with one or two MasmBasic lines works with 99% of the \Masm32\Examples sources. But reinventing the wheel is more fun, of course ;-)

NoCforMe

Of course, you could just use C or C++ and eliminate a lot more of that nonsense ...

Or better yet, why not project ourselves, say, 5-10 years into the future, when all programming will be totally obsolete because ChatGPT:

QuoteChatGPT, make me a game where a monster chases people around a castle with ... [gory details here]

So we can see that learning assembly language is a complete waste of time, a total dead end ...
Assembly language programming should be fun. That's why I do it.

daydreamer

#8
Quote from: NoCforMe on September 27, 2023, 08:22:02 AMOf course, you could just use C or C++ and eliminate a lot more of that nonsense ...

Or better yet, why not project ourselves, say, 5-10 years into the future, when all programming will be totally obsolete because ChatGPT:

QuoteChatGPT, make me a game where a monster chases people around a castle with ... [gory details here]

So we can see that learning assembly language is a complete waste of time, a total dead end ...
No we assembly programmers meet in zion, joining the resistance  :badgrin:
Computer languages is tools to make programs, just choose one you prefer
Many here grew up with assembly programming, so we like continue use it, thanks to masm32 sdk we could continue use it and not be stuck in dos retrogames coding

my none asm creations
https://masm32.com/board/index.php?topic=6937.msg74303#msg74303
I am an Invoker
"An Invoker is a mage who specializes in the manipulation of raw and elemental energies."
Like SIMD coding