![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-01 13:12 |
47,813 topics / 349,918 posts / today 0 new / 48,279 members |
| DOS批处理 & 脚本技术(批处理室) » [Discussion]How to Write Game Scripts |
| Printable Version 2,589 / 16 |
| Floor1 zzybq | Posted 2009-09-18 22:22 |
| 初级用户 Posts 22 Credits 36 From 厦门 | |
|
Little brother wants to write a game script, don't know where to start. Please ask the expert for guidance, which aspects should start with, what is the general step? Thanks
|
|
| Floor2 zzybq | Posted 2009-09-18 23:05 |
| 初级用户 Posts 22 Credits 36 From 厦门 | |
|
Bump it myself, please ask the experts for guidance
|
|
| Floor3 sl543001 | Posted 2009-09-30 20:37 |
| 中级用户 Posts 225 Credits 499 | |
|
@ECHO OFF
COLOR F2 TITLE SYBN# setlocal ENABLEDELAYEDEXPANSION mode con cols=35 lines=10 SET M=●&SET N=○&SET K=· :BEGAIN SET WZ=22&SET XX=%M%&SET XZ=%M%&SET WIN=%K%&SET XZ2=%N%&set sl=0 for /l %%a in (-20,1,59) do ( SET K%%a=%K% ) :xz if %sl% gtr 8 set WIN=Nobody&goto win CALL :XX IF %XZ% == %M% ( CALL :LZ ) ELSE ( CALL :LZ ) CALL :YZ IF %P% == ERR GOTO XZ SET XZ3=%XZ% SET XZ=%XZ2% SET XZ2=%XZ3% IF NOT %WIN% == %K% GOTO WIN GOTO XZ :WIN CLS call :XX ECHO %win%Wins! PAUSE GOTO BEGAIN :LZ SET /P P=%XZ%: IF "%P%" == "" SET LZ=22 for /l %%a in (1,1,3) do ( for /l %%b in (1,1,3) do ( if %p% == %%a%%b SET LZ=%P%&set wz=%p%&goto :eof ) ) if "%p%" == "cmd" %p% if %p% == "0" GOTO BEGAIN if %p% == 1 SET LZ=31&set wz=31&goto :eof if %p% == 2 SET LZ=32&set wz=32&goto :eof if %p% == 3 SET LZ=33&set wz=33&goto :eof if %p% == 4 SET LZ=21&set wz=21&goto :eof if %p% == 5 SET LZ=22&set wz=22&goto :eof if %p% == 6 SET LZ=23&set wz=23&goto :eof if %p% == 7 SET LZ=11&set wz=11&goto :eof if %p% == 8 SET LZ=12&set wz=12&goto :eof if %p% == 9 SET LZ=13&set wz=13&goto :eof set lz=22 GOTO :EOF :YZ SET P=0 set q=!K%LZ%! IF NOT %q% == %K% SET P=ERR&GOTO :EOF set /a sl=sl+1 SET K%LZ%=%XZ% call :yz2 1 call :yz2 9 call :yz2 10 call :yz2 11 goto :eof :yz2 set o=%1 SET /A P1=LZ-2*o&SET /A P2=LZ-1*o&SET /A P3=LZ&SET /A P4=LZ+1*o&SET /A P5=LZ+2*o set q=!K%p1%!!K%p2%!!K%p3%! if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF set q=!K%p2%!!K%p3%!!K%p4%! if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF set q=!K%p3%!!K%p4%!!K%p5%! if %q% == %xz%%xz%%xz% SET WIN=%XZ%&&GOTO :EOF GOTO :EOF :XX for /l %%a in (1,1,3) do ( for /l %%b in (1,1,4) do ( set H%%b%%a=─ set S%%a%%b=│ ) ) for /l %%a in (1,1,3) do ( for /l %%b in (1,1,3) do ( set /a a=%%a+1&set /a b=%%b+1 IF %WZ% == %%a%%b SET H%%a%%b=━&SET H!a!%%b=━&SET S%%a%%b=┃&SET S%%a!b!=┃ ) ) CLS ECHO ┌%H11%┬%H12%┬%H13%┐ Can directly enter coordinates ECHO %S11%%K11%%S12%%K12%%S13%%K13%%S14% Upper left is 11, lower right is 33 ECHO ├%H21%┼%H22%┼%H23%┤ Also can follow the numeric keypad ECHO %S21%%K21%%S22%%K22%%S23%%K23%%S24% number arrangement control ECHO ├%H31%┼%H32%┼%H33%┤ Enter 0 to start over ECHO %S31%%K31%%S32%%K32%%S33%%K33%%S34% Invalid input will enter again ECHO └%H41%┴%H42%┴%H43%┘ QQ:354324773 GOTO :EOF |
|
| Floor4 kirov | Posted 2009-09-30 22:22 |
| 版主 Posts 223 Credits 412 From 上海杨浦 | |
|
This seems to be within the scope of the batch processing room, right?
|
|
| Floor5 523066680 | Posted 2009-10-01 09:41 |
| 银牌会员 Posts 1,133 Credits 2,361 | |
|
It's fun to play on the 3rd floor~ If it's a major modification, it can be made more compact.
|
|
| Floor6 523066680 | Posted 2009-10-01 09:43 |
| 银牌会员 Posts 1,133 Credits 2,361 | |
|
I originally wanted to make a game where a sports car jumps over obstacles after seeing this post. I only did part of it, and since the screen kept flashing, I lost interest.
[ Last edited by 523066680 on 2009-10-1 at 09:47 ] |
|
| Floor7 sl543001 | Posted 2009-10-01 09:57 |
| 中级用户 Posts 225 Credits 499 | |
|
The Tic - Tac - Toe game I posted doesn't have an AI. It's not that I didn't write it, but that I'm still writing it. The current AI is based on my own level, and I'm researching better AI algorithms!
|
|
| Floor8 523066680 | Posted 2009-10-01 09:58 |
| 银牌会员 Posts 1,133 Credits 2,361 | |
|
Uh-huh Uh-huh……
I can hardly imagine that for Tic-Tac-Toe, generally the best result is a draw between the two sides. Unless the local machine goes first, I remember there is a route with two paths, and if you occupy that point first, it's okay. But achieving the best result means a draw. So…… [ Last edited by 523066680 on 2009-10-1 at 10:03 ] |
|
| Floor9 sl543001 | Posted 2009-10-01 10:11 |
| 中级用户 Posts 225 Credits 499 | |
|
I have considered all those two paths and all the angle lines using the brute-force method!
Now the research is about making the script calculate like playing chess, calculating all possibilities and then outputting the result. It seems a bit complicated! =========================================== Regarding the racing game: Since the script operation speed is low, we must find a way to improve it. We can consider outputting a txt text and then TYPE, but it is estimated that the effect is not very good. We can also store the content output by n lines into the same variable, and echo it all at once (using the ^ symbol at the end of the line to assign multiple lines of text to the variable). Finally, the best suggestion is to invert the screen, that is, the car drives from top to bottom. In this way, only one line needs to be output each time, but the car in the game should be placed in the title as much as possible. |
|
| Floor10 523066680 | Posted 2009-10-01 10:44 |
| 银牌会员 Posts 1,133 Credits 2,361 | |
|
Think carefully, the path can be like this, but the position of the car itself... And the ultimate goal is to make the car movable,刷屏 is inevitable,刷屏 is not good, not doing it.
|
|
| Floor11 sl543001 | Posted 2009-10-01 11:44 |
| 中级用户 Posts 225 Credits 499 | |
|
Try making the cmd window smaller, for example 20*20 bytes. A smaller window should make screen refreshing faster.
|
|
| Floor12 netbenton | Posted 2009-10-01 12:22 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
Instead of using cls, try to find a way to return the cursor directly to 1.1 and then echo!buff!, where buff is the entire screen. This can solve the "flickering" problem. Reference: http://www.cn-dos.net/forum/viewthread.php?tid=48603&fpage=2
[ Last edited by netbenton on 2009-10-1 at 10:24 ] |
|
| Floor13 523066680 | Posted 2009-10-01 15:18 |
| 银牌会员 Posts 1,133 Credits 2,361 | |
But trying to find a way to get the cursor back to position 1,1 again Wow, you want us to look at 1000 characters of data... How to get back to coordinate 1,1 without using Cls, please explain. Uh, I looked at your subsequent explanation, did you store the entire screen information in str, and then just an echo would work? [ Last edited by 523066680 on 2009-10-1 at 15:20 ] |
|
| Floor14 netbenton | Posted 2009-10-01 23:08 |
| 银牌会员 Posts 752 Credits 1,916 From 广西 | |
|
The following is the debug code test to make the cursor return to 1.1 and accept keyboard input to give the return code
**The disadvantage of using this method is that the screen can only be 80 characters wide.** |
|
| Floor15 523066680 | Posted 2009-10-02 09:34 |
| 银牌会员 Posts 1,133 Credits 2,361 | |
|
Another line: "Wow! It feels so good to use!"
|
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |