flatx007 Posted 12 hours ago Posted 12 hours ago Quote 3D Maze Ball (AutoIt3 + C) A hybrid of AutoIt3 and a native C DLL. AutoIt controls the logic and window, while C handles all graphics via raycasting directly to a pixel buffer. No third-party engines. How it works Two layers: 1. AutoIt3 (maze_ball.au3) — the game's brain. Handles keyboard input, calculates ball physics (inertia, bounces), creates the window, and runs the game loop. 2. C DLL (maze_rc.c) — the graphics engine. Raycasting (pseudo-3D like Wolfenstein), draws the sky with the sun, the floor with shadows, and walls. The ball is rendered as a 3D sphere with texture and highlights. How AutoIt draws 3D AutoIt itself is not fit for 3D, so we bypass it via a raw pixel buffer: - In AutoIt, we create a DllStruct — an array of 307200 pixels (640x480). - Pass a pointer to this memory to the C DLL. - C fills the buffer with colors — all math at full CPU speed. - When the frame is ready, AutoIt calls StretchDIBits from the Windows API — copies the buffer directly to the window. Features Lighting — sun in the south, shadows from walls fall to the north. Smooth gradients via multi-sampling, ambient occlusion at the base of the walls. Physics — the ball has inertia, it rolls by itself after acceleration and slows down by friction. Bounces off a wall at the angle of reflection upon impact. The camera automatically turns into the corridor after turning. Build and Run 1. Install MinGW (gcc). 2. Run build_maze.bat — it will build mazeball_rc.dll and the 32-bit version. 3. Run maze_ball.au3 via AutoIt3. Controls: Up/Down arrows — accelerate/brake, Left/Right — turn (strafe in a dead end), Q or Esc — exit. AutoIt3.7z maze_ball.au3 argumentum, ioa747, Gianni and 1 other 4
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now