[Game] Bulldozer

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: [GAME] Bulldozer

12 Jun 2018, 14:22

- Thanks for fixing the flashing and restoring smooth movement with the arrow keys.
- I was enjoying the game but got stuck and cheated by watching this speedrun of the game. Actually, I only found one video of the game so far.
Bulldozer video test 2 - YouTube
https://www.youtube.com/watch?v=RP9pyLWKX54
- I believe it's the original game, based on the name of the user (channel). Nice aesthetics that you've added @TheDewd.
- When did you come across this game? Any other games you like? For pure games like this I like: Arctic Adventure (4-colour graphics), Kye and Pushover.
- Btw the game has an 'undo' option!
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

12 Jun 2018, 14:59

jeeswg wrote:- Thanks for fixing the flashing and restoring smooth movement with the arrow keys.
* You're welcome!

- I was enjoying the game but got stuck and cheated by watching this speedrun of the game. Actually, I only found one video of the game so far.
Bulldozer video test 2 - YouTube
https://www.youtube.com/watch?v=RP9pyLWKX54
* That is a video from the game creator showing some of the gameplay mechanics from his 2008 re-make of his Bulldozer games. If you want a "walk-through" of the original levels 1-60, there is a nice playlist available on YouTube: https://www.youtube.com/watch?v=vQgYyIt ... ySb5ySX7gh

- I believe it's the original game, based on the name of the user (channel).
* Not the original game. Bulldozer 1 first appeared on CD-ROM in 1994 on "24 Games for Windows 95" released by Expert Software, Inc. Bulldozer 2 was included in "Arcade Magic", also released by Expert Software, Inc. Bulldozer 3 was completed in 2002, but remained unreleased until the game creator bundled all of the Bulldozer games together in the 2008 game featured in the video link you shared. The 2008 version is created with Adobe Flash and available on desktop and mobile platforms.

- Nice aesthetics that you've added @TheDewd.
* Thank you! The icons and graphics are from Bulldozer 1 -- the only reference I had in my possession. The "LEVEL" and "PASSWORD" font images are from NFG's Arcade Font Engine. Font is "Ninja Gaiden (Tecmo).

- When did you come across this game? Any other games you like? For pure games like this I like: Arctic Adventure (4-colour graphics), Kye and Pushover.
* Bulldozer 1 (Just "Bulldozer" at the time) was installed on the family computer when I was younger. I enjoy many retro games. Can't think of anything specific right now. I'm a fan of old point-and-click adventure games too that I play using the SCUMMVM software.

- Btw the game has an 'undo' option!
* Coming soon... Adding support for DPI scaling at the moment (actually, already completed that...). I'll try to include an "Undo" in the next version.
Last edited by TheDewd on 12 Jun 2018, 15:12, edited 3 times in total.
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

12 Jun 2018, 15:03

rommmcek wrote:Great, great, great! Very smooth, some constellations are really not too easy!

P.s.: Level 24, wall seems to be rock (not bulldozer alone) permeable at least at coordinats 2,4; 3,6; 4,5; 4,7; where 0,0; being upper left corner.
I'm unable to reproduce this issue. Would you be able to share a screenshot?
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: [GAME] Bulldozer

12 Jun 2018, 15:18

Looks like south-west side is affected:
Attachments
Bulldozer.png
Bulldozer.png (38.4 KiB) Viewed 5632 times
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

12 Jun 2018, 15:51

Updated:

Revision 5 (2018-06-12)
  • Fixed boundary tile being overwritten when pushing boulder into it (Thanks, rommmcek)
  • Added DPI scaling support
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

18 Jun 2018, 12:49

Updated:

Revision 6 (2018-06-18)
  • Added 'Undo Last Move' menu option -- Used only after pushing object
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

19 Jun 2018, 12:17

TheDewd wrote:Added 'Undo Last Move' menu option -- Used only after pushing object
PosNum := RegExMatch(TempMap, "(5|4|6|7)") ; Get position of bulldozer
Although it's possible to make a game without using arrays, (like Zaelia's PacMan https://autohotkey.com/board/topic/5399 ... nal/page-2)
I think if you only use string manipulation, it might be a nightmare :headwall: just to keep track of all player's positions or to implement multiple undo move.
Things would be a lot easier if you use 2D array. :thumbup:

Code: Select all


f7::
rows:=16, cols:=20
r:=0,  c:=0 
TempMap2:=[]

TMap:=strsplit(tempmap) ; Make 1D array
While r++ < rows {
     while c++ < cols {
		TempMap2[r,c]:=TMap.RemoveAt(1) ; convert 1D array to 2D array
       } c:=0
} r:=0, c:=0

; Get position of bulldozer
for i, r in TempMap2
	for j, c in r
		if (c=4) || (c=5) || (c=6) || (c=7) {
			bulldozerPos:= i "_" j    ; bulldozer is at row: i col: j
          }			
		
; Get character string value of next positions

b:=strsplit(bulldozerPos, "_")
msgbox, % "Bulldozer is at row: " b.1 " col: " b.2
        .  "`n`nNext character :`n"
        .  "North is " TempMap2[b.1-1][b.2]
        .  "`nSouth is " TempMap2[b.1+1][b.2]
        .  "`nEast  is " TempMap2[b.1][b.2-1]
        .  "`nWest  is " TempMap2[b.1][b.2+1]

; Get character string value of next positions X 2

        .  "`n`nNorth x2 is " TempMap2[b.1-2][b.2]
        .  "`nSouth x2 is " TempMap2[b.1+2][b.2]
        .  "`nEast x2 is " TempMap2[b.1][b.2-2]
        .  "`nWest x2 is " TempMap2[b.1][b.2+2]

Return

Cheers,
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

20 Jun 2018, 02:26

Because maps can be loaded very fast with GDI it is quite easy to implement a raw multiple undo moves however it is not the most efficient way. :think:

Code: Select all


A_DPI := (A_ScreenDPI / 96) ; Calculate DPI scaling
Record:=[] ; Initialize undo record state

backspace::                ; Perform multiple undo
if record[1] {
   tempmap:=record.pop()
   BackgroundLoad(tempmap)
   sleep, 5
  }
else
     record[1]:=Map[CurrentLevel]
return


WM_KEYDOWN(wParam, lParam, Msg, Hwnd) {
    Global ; Assume-global mode
	Static Init := OnMessage(0x0100, "WM_KEYDOWN") ; Call function

	; Define key code and flag names
    Static VK_UP := 26, VK_LEFT := 25, VK_DOWN := 28, VK_RIGHT := 27,
    VK_W := 57, VK_A := 41, VK_S := 53, VK_D := 44, VK_ESCAPE := "1B"

	GuiControlGet, CurrentTab,, Tab ; Get current tab name
	GuiControlGet, FocusedControl, FocusV ; Get current focused control

	; Prevent "dinging" when pressing keys
	If (!RegExMatch(FocusedControl, "(EditFocus|EditPassword|Cancel|OK|Website)")) {
		GuiControl, Focus, EditFocus ; Set focus to hidden edit control
	}

	VK := Format("{:x}", wParam) ; Get key code

	If (CurrentTab = "Main") {
		If (VK = VK_ESCAPE) { ; Escape
			ExitApp ; Terminate the script unconditionally
		}

		If (VK = VK_UP || VK = VK_W) { ; Up/W
			Move(0, -1)
		}

		If (VK = VK_LEFT || VK = VK_A) { ; Left/A
			Move(-1, 0)
		}

		If (VK = VK_DOWN || VK = VK_S) { ; Down/S
			Move(0, 1)
		}

		If (VK = VK_RIGHT || VK = VK_D) { ; Right/D
			Move(1, 0)
		}

		LevelClearCheck() ; Check for remaining boulders
		
		If (TempMap <> record[record.maxindex()])
		record.push(tempmap) ; record current map


	}
}


MapSet(LevelNumber) {
	Global ; Assume-global mode

	UndoArray := []
	Record := []

	Menu, GameMenu, Disable, &Undo Last Move`tCtrl+Z
	CurrentLevel := RegExReplace(LevelNumber, "\D") ; Get level number
	CurrentLevel := (CurrentLevel > Map.MaxIndex() ? 1 : CurrentLevel)
	TempMap := Map[CurrentLevel] ; Copy map data to TempMap variable
	BackgroundLoad(TempMap) ; Generate background image
	Record.push(tempmap) ; record first undo state
	Gui, Show,, Bulldozer - Level %CurrentLevel% ; Update window title
}

User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

23 Jul 2018, 15:50

Updated:

Revision 7 (2018-07-23)
  • Code optimization
    • Minimized code in some areas
    • Improved functionality
    • Rearranged order of some functions to group with other related code parts
  • Background color selection
    • The background color can be changed to one of the 16 presets (as in the original Bulldozer 1 game)
    • Custom background colors are selected using the color chooser dialog
  • New fontmap for increased readability of level/password display text
    • Changed the fontmap image (display lettering at bottom of window) for increased readability & better aesthetics
  • Debug Mode
    • Special mode enabled by clicking the Bulldozer on the 'About' screen while holding Ctrl + Alt + Shift
    • Level skip by pressing keys F11 (Previous) & F12 (Next) when Debug Mode enabled
  • Save/Read settings with INI file
    • Save/load background color selection between game sessions
  • Custom tilemap & fontmap images
:!: Note: Please take care not to display level passwords in public areas that may spoil the game for other players.
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

23 Jul 2018, 17:34

Thank you for all the improvements you have made. 8-)
I particularly appreciate line 784 : If (UndoArray.MaxIndex() > 1) { ; Number of times to allow 'Undo' :angel:
this could be part of the ini file

Code: Select all

infinite_undo = 1
  1. Debug mode is not working for me (AHK 1.1.28.02 Unicode x32 on WIN_7 64bit)
    (Skips the levels correctly, but the script displays the "Level Select" when you try to play.) :cry:
  2. Automatically save/load last played level would be also great. :roll:
ini file

Code: Select all

load_last_played_level = 1
TheDewd wrote:Use a custom tilemap or fontmap image by including in the script directory as tilemap.png or fontmap.png
Tilemap.png ---> dimension of the image ? :think: size of the tiles ? :think: number of tiles ? :think:
fontmap.png ---> idem :think: :?:

Cheers
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

24 Jul 2018, 07:20

SpeedMaster wrote:this could be part of the ini file

Code: Select all

infinite_undo = 1
Thanks for the suggestion! I'll consider it for the next release.
SpeedMaster wrote:Debug mode ... (Skips the levels correctly, but the script displays the "Level Select" when you try to play.) :cry:
Did you make any modifications to the script? Do you have another script running that has remapped any of these keys? I can't reproduce this issue. Any other information you can provide would be helpful and much appreciated.
SpeedMaster wrote:Automatically save/load last played level would be also great. :roll:
Thanks for the suggestion! I'll consider it for the next release.
SpeedMaster wrote:Tilemap.png ---> dimension of the image ? :think: size of the tiles ? :think: number of tiles ? :think: fontmap.png ---> idem :think: :?:
My initial thought was that the user could just visit the link from my previous post that has examples of tilemap/fontmap images. You can take those images and edit them into something new.

Tilemap (480x32) [32x32 tiles] [15 Count]
Fontmap (768x16) [16x16 tiles] [48 Count]
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

24 Jul 2018, 09:58

TheDewd wrote:Did you make any modifications to the script?
No
TheDewd wrote:Do you have another script running that has remapped any of these keys?
Not that I know, I have disabled my other running scripts.
TheDewd wrote:I can't reproduce this issue.
I am right-handed and I have a french keyboard (AZERTY) for these reasons I do not use the WASD keys to move.
The focus stays on tab control and in windows 7 you can switch tab with cursors ( left, right).

Here is a script that reproduce this behaviour. If you can change tab with your cursors that's it :thumbup:

Code: Select all

Gui, Add, Tab3,, General|View|Appearance|Settings
gui, show, w500 h500
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

26 Jul 2018, 16:17

Updated:

Revision 8 (2018-07-26)
  • Fixed issue where arrow keys were changing tabs
  • Added additional options to menus
  • Save/Load game states
Hope you enjoy it!
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

26 Jul 2018, 17:45

TheDewd wrote:Fixed issue where arrow keys were changing tabs
Works fine now thanks :thumbup:
TheDewd wrote:Added additional options to menus
Unlimited undo :dance: (Great ! some levels are really difficult to complete without it) :!:

The game is almost identical to the original now however the original game displays a message + congratulation sound when you have completed a level
07_27_18 @12_14_28.PNG
07_27_18 @12_14_28.PNG (8.21 KiB) Viewed 5264 times

Cheers,
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

31 Jul 2018, 23:28

Updated.

Made some drastic changes. Removed a lot of "bloat" features I no longer felt belonged in this game.

See main post.
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

02 Aug 2018, 12:42

hello,

Nice Level Menu Selector 8-) Thanks.

I added check mark flags to keep track of resolved levels. :idea:
(the original script is not modified, I only added new lines and functions for the flags)
flags.PNG
flags.PNG (3.22 KiB) Viewed 5183 times
I used Run-length encoding from Rosetta to store resolved levels in the ini file.
Run-length encoding https://rosettacode.org/wiki/Run-length ... AutoHotkey



Cheers,
Last edited by SpeedMaster on 05 Aug 2018, 06:13, edited 1 time in total.
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

02 Aug 2018, 15:34

SpeedMaster wrote:I used Run-length encoding from Rosetta to store resolved levels in the ini file.
Excellent! I had planned to add this feature in a future release. The original author included this in his 2008 release of the game. I may borrow your code if you don't mind! :)
SpeedMaster wrote:Levels 64 and 127 are unplayable :cry:
Thanks for finding this! I've already made a solution that I'll include in the next release. The issue is when the bulldozer begins on a target at the start of the level.
Reeree

Re: [GAME] Bulldozer

04 Aug 2018, 14:34

Can You please tell me how to get through level 163 on Bulldozer codezone. This level is really hard
User avatar
TheDewd
Posts: 1506
Joined: 19 Dec 2013, 11:16
Location: USA

Re: [GAME] Bulldozer

06 Aug 2018, 16:11

Updated: Revision 10 (2018-08-06)
  • Fixed levels 64 & 127 not showing a target due to bulldozer start location (Bulldozer starts on top of target)
  • Added level completed status to the Level Select screen
Thanks, SpeedMaster!

Note: Please let me know if any issues with latest release.
User avatar
SpeedMaster
Posts: 494
Joined: 12 Nov 2016, 16:09

Re: [GAME] Bulldozer

07 Aug 2018, 17:11

TheDewd wrote:Thanks, SpeedMaster!
You're welcome! :D
The game is now fully functional. Well done ! :thumbup: :clap:

I will try to learn how to make games by string manipulation. :o Thanks!

Minor optional bug fix:
I have set a drawing priority to fully preserve transparency of the player on target.
This works well for most of the themes but it could also ruin estetica of some others. :think:

Code: Select all

BackgroundUpdate(arrUpdate) {
	Global ; Assume-global mode
	For K, V In arrUpdate {
		
		DllCall("Gdiplus.dll\GdipFillRectangle", "Ptr", pBackgroundGraphics, "Ptr", pBackgroundBrush, "Float", ((32 * ((!(M := Mod(V.I, 20)) ? 20 : M) - 1)) * DPI), "Float", ((32 * (Ceil(V.I / 20) - 1)) * DPI), "Float", (32 * DPI), "Float", (32 * DPI))


		MapChar:=SubStr(Maps[LevelNum], v.i , 1)

		if MapChar in 8,9,B,C,D,E,F,A,1		; draw background elements
		drawtile(MapChar, v.i)

		if (MapChar=3)                      ; draw target with item
		drawtile(1, v.i)

		drawtile(V.C, v.i)					; draw player
			
	}
	; Redraw background image
	GuiControl, +Redraw, % hBackground
}	

DrawTile(tilechar, pos, redraw:="false") {
	global
	if (tilecol:=InStr("89BCDEFA2317456", tilechar, 1))
	DllCall("Gdiplus.dll\GdipDrawImageRectRect", "Ptr", pBackgroundGraphics, "Ptr", pTheme, "Float", ((32 * ((!(M := Mod(Pos, 20)) ? 20 : M) - 1)) * DPI), "Float", ((32 * (Ceil(Pos / 20) - 1)) * DPI), "Float", 32 * DPI, "Float", 32 * DPI, "Float", (TileCol - 1) * 32, "Float", 0, "Float", 32, "Float", 32, "Int", 2, "Ptr", 0, "Ptr", 0, "Ptr", 0)
	
	; Redraw background image
	if (redraw)
	GuiControl, +Redraw, % hBackground
}	
Theme:AHKBAN
Ahkban.png
Ahkban.png (8.39 KiB) Viewed 5068 times

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: KruschenZ and 121 guests