Jump to content

Recommended Posts

Posted (edited)

Capture.PNG.8f0fac0b13102c557b979afc9bc5302c.PNG

 

What this is

Nova is a 2D game engine for AutoIt 3.3.16.1. Rendering is Direct2D on a Direct3D 11 device, presented by DXGI, text by DirectWrite - reached through COM vtable addresses resolved at import time. No C runtime, no compiler, no DLL to build, no include beyond Nova.au3: you keep writing .au3.

You write two functions. The engine owns the window, the device and the timing.

Func Update($fDT)              ; runs at a fixed 60 Hz
    $fVy += 1400 * $fDT
    $fY  += $fVy * $fDT
EndFunc

Func Draw()                    ; once per frame, after the logic
    _Nova_FillRect(0, 400, 960, 140, _Nova_RGB(40, 44, 52))
    _Nova_FillRect($fX, $fY, 32, 32, _Nova_RGB(255, 80, 40))
    _Nova_TextUI("FPS " & Int(_Nova_FPS()), 8, 8)
EndFunc

_Nova_Create("My game", 960, 540)
_Nova_Run("Update", "Draw")    ; blocks until the window closes
_Nova_Destroy()

Four verbs - Create, Run, Quit, Destroy - are the whole lifecycle.

What is in the box

139 public functions and about 9 650 lines of engine source, in these families:

  • window + device, vsync, and a CPU rasteriser you can force if the GPU path is unavailable
  • rectangles, lines, ellipses, circles, colours as 0xAARRGGBB
  • images: load PNG, draw, draw a part of a sheet, scale, mirror, rotate, alpha
  • text: DirectWrite for world space, one simpler UI call for HUDs
  • tile maps: a level is a piece of text, one character per tile, only the visible tiles are drawn
  • physics: AABB bodies with gravity, terminal velocity, ground snap, anti-tunnelling sub-steps, and a body that spins with its own angular acceleration, inertia and speed cap, slides with friction, and carries one free slot for whatever your game needs
  • camera: absolute, or follow with smoothing and map clamping
  • input: keyboard, mouse, wheel, XInput gamepad, plus an injection API so a run can be scripted
  • particles, a named scene stack, seeded random, a flat key/value save file
  • animations whose frames each have their own duration, and a debug overlay (box, velocity arrow, facing mark) you switch on for one body at a time
  • sound: dsound.dll for .wav effects - volume, pitch and pan - and winmm/MCI for music, both shipped with Windows, and the .wav path falls back to MCI by itself on a machine that refuses DirectSound
  • _Nova_Capture(): the engine hands you the pixels it computed as a PNG - not a screenshot of your desktop
  • _Nova_LastError() explains any failure in a sentence; nothing fails silently

Three games to open right now

  • examples/01_hello.au3 - twenty lines: a window, a bouncing ball, a keyboard.
  • examples/03_catch.au3 - the game the attached course builds, step by step: a character that walks a four-frame strip, fruit that falls, a catch that scores, three lives, three screens, particles and sound.
  • examples/02_plateforme.au3 - a full platformer: 3 levels written as text, coins, spikes, camera, HUD, title / game / win-lose screens, keyboard and gamepad.

It tests itself

Every example and every test accepts /check: the game plays itself, captures its own frame, and exits with a return code. One command runs the whole proof, and its exit code is the number of failed steps:

python tools/nova_suite.py --rapport
  • 14 steps, 0 failures - on the 32-bit interpreter and on the 64-bit one
  • the two interpreters write the same pixels: the diff of the two captures is 0 pixels out of 468 000
  • 3 image locks compare a PNG against coordinates computed by hand (69 + 35 + 23 assertions), so a rendering regression is a failing test, not a screenshot nobody noticed
  • 59 COM calls checked argument by argument against the ABI table, 210 unit assertions on the API contract
  • /route replays the platformer's physics frame by frame and searches, for every platform, a jump frame that actually lands on it - a level asking for a jump the physics cannot give fails the run instead of shipping. It reports the measured apex (138 px), not the V^2/2G formula (144 px), because the integration is discrete and snaps to the pixel.

The attached PDF is a course, not a changelog

Nova-course.pdf, 23 A4 pages: nine steps, each one a program you can run, from an empty window to the complete catch game, then ten graded exercises, a "when it does not work" table and a glossary. It is generated from docs/course.md by tools/nova_pdf.py, and the build is gated: the listing in chapter 12 is examples/03_catch.au3 line for line, and every complete program printed in the course is compiled and kept alive for three seconds by the same suite. A course that drifts from the code it cites fails the build.

What it does not do

Being honest saves everybody a thread.

  • No shaders, no blend modes beyond alpha, no post-processing.
  • Isometric maps, pathfinding and animation state machines are yours to write; the engine stops at the primitives.
  • Pitch and pan exist only on the DirectSound path, so a machine that refuses dsound.dll keeps its sounds (MCI takes them) and loses those two controls, which answer $NOVA_ERR_UNSUPPORTED. Format support on the MCI path is whatever your Windows has; WAV is what the tests exercise, MP3 is not forbidden, just not covered.
  • A few hundred sprites per frame before the AutoIt interpreter, not the GPU, becomes the limit.
  • 32-bit and 64-bit are both measured, but they are two builds: ship the interpreter you tested with. What makes that possible is that every Direct2D call in the engine passes its structures by address - the one form the two ABIs agree on. Sprite rotation is drawn as a rotated FillRectangle for that reason, so a segment and a turned bitmap paint the same on both.

Getting started

Unzip    Nova-1.0.zip

keep the folder layout, and either include the umbrella file or double-click an example:

#include "Nova.au3"

MANIFEST.md says which of the six shipped files are indispensable and which folders only exist for the demo. docs/quick_start.md is the ninety-second version, docs/api.md lists all 139 functions with their error codes, and docs/technique.md (French) holds the measurements behind every rule.

Requirements: AutoIt 3.3.16.1 (either AutoIt3.exe or AutoIt3_x64.exe) and Windows 10 or 11. Licence MIT.

Feedback, bug reports and "this API is awkward because..." are welcome. If you file a bug, run the suite first - it usually tells you whether the engine or your game is guilty.


 

Edited by Numeric1
From 0 and 1 to the stars, it all starts with binary, Numeric1
 
Posted

Mario ? Giana ? :)

 

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted

Signature beginning:
* Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
* ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button:

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * 

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors  * HTML editor * 

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Posted (edited)
23 hours ago, mLipok said:

Mario ? Giana ? :)

 

@mLipok Yes - Mario is already in the box: examples/02_plateforme.au3 is a tile level with coins, moving platforms, a HUD and win/lose scenes, and its /route mode proves every jump actually reaches its platform.
Since then the engine runs both 32-bit and 64-bit - measured on both, not merely compiled for both - and it covers most of the physics a 2D game needs: bodies and gravity, terminal velocity, tile collisions, anti-tunnelling sub-steps, friction, sprite rotation and mirroring.
To check that myself I wrote a complete fighting game - two fighters, best of 3, a CPU opponent, keyboard and gamepad - without writing a single line of C, without compiling anything, and without downloading one asset: the 6 PNG and the 8 WAV come out of formulas, so a rebuild gives the same bytes. The game drives and screenshots itself in /check, 17 pixel assertions on one locked frame, same image byte for byte on both widths. The engine is easy to use; that is the point.
Bonus: FightDemo-1.0.zip 

 

Edited by Numeric1
From 0 and 1 to the stars, it all starts with binary, Numeric1
 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...