F1 Racer

Post gaming related scripts
User avatar
dangerdogL2121
Posts: 173
Joined: 01 Oct 2013, 23:11

F1 Racer

18 Aug 2014, 18:43

I made an f1 racing game with OpenGL.

After spending forever trying to get my stuff uploaded to GitHub and failing, I used dropbox.

Credit to:
nnnik for great help and reference making this
Uberi for example OpenGL scripts
Chris for AutoHotkey

Game: https://www.dropbox.com/sh/01ucst7jeybn ... 7T0P_DJFia

Instructions to download:
1. Open link above
2. In dropbox, click the button in the upper right with the three dots
3. Click download as .zip
4. Extract zip folder


Game Instructions:
In this game, you try to drive around the track faster than the other players. The game ends when all but one player has finished. (1 or 3 players)

Controls:
  • 2-Player
    • Up, Down, Right Left
      W, A, S D
    4-Player
    • Up, Down, Right Left
      W, A, S D
      T, G, H, F
      I, K, J, L (kind of crowded I know)
The difference between the draw and not draw editions is being able to see the border along the track at which the cars stop.

And most importantly have fun!
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: F1 Racer

18 Aug 2014, 20:44

Impressive work! Good job!
Interesting to see the openGL DLLCalls.

I have some small suggestions:
  • I'd like to see more comments explaining what each part of the script does in detail. I recently read that the pinball game that was included with Windows was scrapped because it was made by an independent contractor that did not comment the code. Instead of taking the time to figure out what everything did to fix a bug, Microsoft just decided to abandon the whole thing.
    I would be interested to read the documentation for the DLLCalls you use. If you have the links, including them in the comments would be a nice touch. I know I can just do a search for them, but I'm lazy :P
  • You may want to mention that this script should be run with a 32 bit version of AHK.
  • It would be easier to read if the indenting was consistent and the commented-out code was removed.
  • I wouldn't have put this script in the gaming forum. I think the gaming forum is for scripts that alter or augment an existing game (usually cheating). Since you created your own game the regular Scripts forum may be more appropriate. I believe other games created in AHK have done this in the past.
Hope you find those suggestions helpful, whether you decide to use them or not.
User avatar
dangerdogL2121
Posts: 173
Joined: 01 Oct 2013, 23:11

Re: F1 Racer

18 Aug 2014, 23:49

Impressive work! Good job!
Interesting to see the openGL DLLCalls.
Thank you
I'd like to see more comments explaining what each part of the script does in detail. I recently read that the pinball game that was included with Windows was scrapped because it was made by an independent contractor that did not comment the code. Instead of taking the time to figure out what everything did to fix a bug, Microsoft just decided to abandon the whole thing.
I would be interested to read the documentation for the DLLCalls you use. If you have the links, including them in the comments would be a nice touch. I know I can just do a search for them, but I'm lazy :P
I just commented and indented the no-draw-4-player edition and have uploaded it to dropbox, though there is a little part of the script at the end I did not get to.
Anyway, here is a list of OpenGL functions: http://msdn.microsoft.com/en-us/library ... s.85).aspx
Just put "opengl32\" before the function name in the DllCall.
If you're looking for enumerations of the values in the opengl functions from link above, I think they are here:https://cvs.khronos.org/svn/repos/ogl/t ... ic/api/GL/
You may want to mention that this script should be run with a 32 bit version of AHK.
I didn't know that. Why should it be run with a 32 bit version?
It would be easier to read if the indenting was consistent and the commented-out code was removed.
I fixed up the no draw 4 player script.
I wouldn't have put this script in the gaming forum. I think the gaming forum is for scripts that alter or augment an existing game (usually cheating). Since you created your own game the regular Scripts forum may be more appropriate. I believe other games created in AHK have done this in the past.
Ok, I didn't know that. A forum administrator can move this topic if they want.

I only commented and indented the no draw 4 player script, but I hope that's enough. Next time, I'm using 2 spaces to indent and not four. :lol:

Hope it helps
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: F1 Racer

19 Aug 2014, 00:20

Wow, thanks for the quick response. That gives me a lot to look over. :)
I didn't know that. Why should it be run with a 32 bit version?
For me at least, it didn't work with 64 bit AHK. I think this is probably because you used one or more a 32 bit Dll's. (ie opengl32)
User avatar
nnnik
Posts: 4272
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: F1 Racer

19 Aug 2014, 01:37

Nice work ;)
@kon
You will barely understand anything even with massive comments, if you do not try to learn basic
OpenGL ;).

BTW:
You can't load 32-bit DLLs in a 64-bit process, so whatever you read about x64 apps using the 32-bit OpenGL DLL was incorrect. There is definitely a 64-bit OpenGL DLL, but it has "32" in its name, presumably to make porting easier.
Recommends AHK Studio
User avatar
nnnik
Posts: 4272
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: F1 Racer

19 Aug 2014, 01:52

BTW I have found the error.
It's in Uberís Load Texture function.
It only supports 32 bit Versions.
Recommends AHK Studio
User avatar
dangerdogL2121
Posts: 173
Joined: 01 Oct 2013, 23:11

Re: F1 Racer

19 Aug 2014, 20:45

For me at least, it didn't work with 64 bit AHK. I think this is probably because you used one or more a 32 bit Dll's. (ie opengl32)
Duh! I didn't notice the 32 in opengl32.

BTW I have found the error.
It's in Uberís Load Texture function.
It only supports 32 bit Versions.
So its not opengl32.dll? Is the error in using gdiplus.dll calls? If so, I can scrap the gdiplus dll calls and call gdi functions from tic's library and use GdipAll.ahk for all AHK versions.

thanks
User avatar
nnnik
Posts: 4272
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: F1 Racer

19 Aug 2014, 23:33

So its not opengl32.dll? Is the error in using gdiplus.dll calls? If so, I can scrap the gdiplus dll calls and call gdi functions from tic's library and use GdipAll.ahk for all AHK versions.
It's not only the GDIPlus calls where he uses UInt instead of pointers.
Recommends AHK Studio

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 7 guests