AutoHotkey Games.

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

AutoHotkey Games.

23 Sep 2017, 15:38

Hey, how is it going folks.

I have been using AHK for about two years now so I thought I would finally come check out the forum and see if anyone else does some of the same things with AHK as I tend to more often than not do. That is to create games or game like scripts. Up until now I have mostly avoided using the forums at all, mainly because even if I have a problem that I could use help with, I don't speak geek / nerd and would have no idea what to call any given problem or search for it, I also have no patience to wait a few hours for a reply let alone the days or weeks that it could take.

So, like I said I have avoided bothering with the forums. I started out using AHK to automate a few small programs, but because I don't use a computer for work I quickly ran out of things that needed to be automated (more or less), I ended up putting AHK aside and there it would still be if I had not discovered that I could make GUI's with it.
That was about a year ago, and since then I have made what must be in hundreds of scripts with AHK. Although I have made many conventional AHK scripts, I tend to find the greatest pleasure in the aforementioned games and the like, and because I enjoy working on such things, there must be others that have also played around with the like.

I did see a few posts before writing this thread on other games people had made, but many of the links were dead, and I saw no pictures or videos of the games in question, which is really all that I am interested in. The only person I have ever found so far that posts videos or Images or videos of there work is a guy on youtube by the name of SpawnNova. Much of what he does is not final polished games, but this is something that I also tend to do. Speaking as someone who still has much to learn, I tend to create scripts that test out ideas and proof of concepts.

So if you have images of similar projects or better yet videos of them please share. I would also love to hear about some of the concepts you have come up with for solving any number of things related to this topic. For example, I was playing around with simulated gravity a few months ago, I worked out a good system that met my needs at the time, but I would love to know how others might have tackled it.

Although others might love to see your code, the code itself or a copy of your games is really not what I am interested in, and even if you were to try to share the actual game with me, I would likely never run it. This is more about visuals and concepts not hard fast code.

Anyway... I have only worked on a few games and I rarely see them to completion before I want to move onto my next project. But here are a few of the games and the like I have worked on /made

They are not very good, but each new project builds off the last.

AutoHotkey PONG:


AutoHotkey Space Invaders:


Zombie Game:


Platform style game (mega man-ish) *** Not my most complete game, but my fav thus far.


***Concept*** Movement / Game A.I (I use these kinds of scripts to flush out new ideas)


With the example above, I was working on automating the "Bots" to form patterns. The Idea is/was that I would have a trigger that would cause the different blocks to assemble into patterns such as the transformer logo , super mario, etc etc. Shown is my early work on seeing if the method of getting the bots to move would work the way I wanted them to.


***Concept*** Movement. (Another quick example of how I work out new ideas about automating the movement for game objects)


As you can they are not great, but I enjoy working on them and I would love to see what anyone else has made using AHK.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: AutoHotkey Games.

23 Sep 2017, 15:44

I'm impressed :o :thumbup: :clap: - and I've to admit I'm a big fan of your tutorial videos at YT!! <kowtow smiley>
User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: AutoHotkey Games.

23 Sep 2017, 18:27

God damn. AHK has really grown since GDIP was used.

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat

User avatar
tidbit
Posts: 1272
Joined: 29 Sep 2013, 17:15
Location: USA

Re: AutoHotkey Games.

23 Sep 2017, 20:18

Impressive stuff :O

and welcome!

edit: oh wow! Autobots is very similar to a failed idea I had (it was intended for 1D, work on a line. for someones arduino light strip. I liked it, so tried to implement in 2D. it.. failed. hard.)
well, similar in the fact that it's moving blocks that collide :P either way, it reminded me of it. great stuff you got.
Description:
* Came from an idea for maestrith and he arduino light display.
* Start out with N dots and an N wide display. The dots have a chance to move
left, right or stay still.
* A baby dot may also be created If:
- 2 or more dots overlap
- AND a 1-in-3 chance is rolled
- AND there has been no baby created within N time
- AND the board isn't full.
* There is also a death system, but it was behaving funny so it's disabled.
* The map is reset once full.
not sure on its current state as I was making some edits. but it seems to work decently.

Code: Select all

/*
Name: Pointless display thingy
Version 1.0 (Wednesday, December 23, 2015)
Created: Wednesday, December 23, 2015
Author: tidbit
Credit: 

Hotkeys:
    esc --- Quit

Description:
    * Came from an idea for maestrith and he arduino light display.
    * Start out with N dots and an N wide display. The dots have a chance to move
      left, right or stay still.
    * A baby dot may also be created If:
      - 2 or more dots overlap
      - AND a 1-in-3 chance is rolled
      - AND there has been no baby created within N time
      - AND the board isn't full.
    * There is also a death system, but it was behaving funny so it's disabled.
    * The map is reset once full.
*/

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance, force

start:=3
range:=30
width:=20
height:=20
fill:=100
fillBG1:="0x00A872"
fillBG2:="0x6411FF"
fillC1:="0x7FFFD4"
fillC2:="0xAC80FF"
delay:=100
babyRate:=5000 ; up to 1 baby every 5 seconds

; DO NOT TOUCH THESE
lastBaby:=A_TickCount
disp:=[]
loc:=[]


; make the gui
gui, margin, 6, 6
gui, color, black
gui, -minimizeBox
loop, %range%
{
	disp.push(0)
	gui, add, progress, % "x" (A_Index-1)*(width+2)+6 " ym" 
	. " w" width " h" height 
	. " background" fillBG1 " c" fillC1
	. " vdot" A_Index, 0
}

; place the starting dots, unique locations.
loc:=urng(start, range//2+3, range//2-3)
; msgBox, % "aaa" st_printArr(loc)

gosub, move
gui, show

settimer, move, %delay%
return

; 4 ; my pos
; 3 8 2 ; other people
; 4-1 = 3 = blocked

; j::
move:
	for k,location in loc
	{			
		dir:=rand(1,3)	
				
		; if up against a wall, you cannot go outside the area.
		if (dir=3 && location=range)
			dir:=rand(1,2)
		if (dir=2 && location=1)
			dir:=choose(1,3)
			
		; determine the direction
		; 1=stay still, 2=left, 3=right
		if (dir=2) 
			loc[k]-=clamp(1, 1, range)
		else if (dir=3)
			loc[k]+=clamp(1, 1, range)
	}
	gosub, update
return


update:
	; update the display, clear the values then redraw
	for k in disp
	{
		disp[k]:=0
		guiControl,, dot%k%, 0
		guiControl, +background%fillBG1% +c%fillC1%, dot%k%
	}
	; for k,v in loc
	loop % loc.maxIndex()
	{
		v:=loc[A_Index]
		disp[v]+=1 ; use +=1 so we can determine of dots are overlapping.
		
		if (disp[v]>=1)
		{
			if (disp[v]>1)
			{
				guiControl, +background%fillBG2% +c%fillC2%, dot%v%
				
				if (rand(1,1)=1 
				&& loc.maxIndex()<range
				&& A_TickCount-lastBaby>=babyRate)
				{
					v+=((disp[v+1]=0) ? 1 : (disp[v-1]=0) ? -1 : 0)
					v:=clamp(v, 1, range)
					loc.push(v)
					lastBaby:=A_TickCount
					guiControl, +background%fillBG2% +c%fillC2%, dot%v%
				}
			}
			else
				guiControl, +background%fillBG1% +c%fillC1%, dot%v%
			guiControl,, dot%v%, %fill%
		}
	}

	; a chance to die.
	; if (rand(1, 20)=1)
	; 	loc.removeAt(A_Index)
		
	; reset when full or unable to spread.
	if (loc.maxIndex()=range || loc.maxIndex()<=1)
	{
		loc:=urng(start, range)
		soundBeep
	}
		
	; toolTip, % aaa "`n" st_printArr(loc) "`n---`n" st_printArr(disp), -100, 0
return


Esc::
    critical
    exitapp
return


clamp(var, min=0, max=100)
{
	if (var<min)
		return min
	if (var>max)
		return max
	return var
}


choose(arr*)
{
	return arr[rand(1, arr.maxIndex())]
}


rand(max=1, min=0)
{
	random, r, %min%, %max%
	return r
}


urng(qty=3,max=10,min=1)
{
	if (abs(max-min+1)<qty)
		return ["error"]
	list:=""
	loop, %qty%
	{
		random, r, %min%, %max%
		loop
		{
			if r not in %list%
			{
				list.=r ","
				break
			}
			random, r, %min%, %max%
		}
	}
	return strSplit(rtrim(list, ","), ",")
}
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: AutoHotkey Games.

24 Sep 2017, 04:32

BoBo wrote:I'm impressed :o :thumbup: :clap: - and I've to admit I'm a big fan of your tutorial videos at YT!! <kowtow smiley>
Thanks BoBo.
Delta Pythagorean wrote:God damn. AHK has really grown since GDIP was used.
None of these use GDIP. They are just .png's.
The Space Invaders, Auto Bots, and Pigs use a ActiveX control but the rest are just normal Picture controls.
tidbit wrote:Description:
* Came from an idea for maestrith and he arduino light display.
* Start out with N dots and an N wide display. The dots have a chance to move
left, right or stay still.
* A baby dot may also be created If:
- 2 or more dots overlap
- AND a 1-in-3 chance is rolled
- AND there has been no baby created within N time
- AND the board isn't full.
* There is also a death system, but it was behaving funny so it's disabled.
* The map is reset once full.
That sounds a bit like "The Game Of Life". I was thinking of doing something like that a few months ago, but the other guy I had mentioned (SpawnNova) had just made a Langstons ant program.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: AutoHotkey Games.

24 Sep 2017, 05:00

I have been thinking of creating a sort of Canvas class for some time.
That would allow creators of games to use this class to display their games without having to decide if they want to create a game using gdip or some other API that will be connected to the canvas.
However currently I'm rather busy with other projects.
Recommends AHK Studio
User avatar
Hellbent
Posts: 2102
Joined: 23 Sep 2017, 13:34

Re: AutoHotkey Games.

02 Oct 2017, 10:43

Just started a new project. This time it is making a Flappy Bird game.

These are short videos detailing the progress of the game in steps.









User avatar
Delta Pythagorean
Posts: 627
Joined: 13 Feb 2017, 13:44
Location: Somewhere in the US
Contact:

Re: AutoHotkey Games.

03 Oct 2017, 07:16

I might make a Super Mario Bros (The original) and maybe even add a "multiplayer" option. It'll be quite interesting...

[AHK]......: v2.0.12 | 64-bit
[OS].......: Windows 11 | 23H2 (OS Build: 22621.3296)
[GITHUB]...: github.com/DelPyth
[PAYPAL]...: paypal.me/DelPyth
[DISCORD]..: tophatcat


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 12 guests