当前位置: 首页 > article >正文

Flappy Bird开发学习记录

概述

为了了解一下Unity的开发过程,或者说感受?先搞简单的练练手。

工具

Unity:2022.3.51f1c1

visual studio 2022

开发过程

项目基本设置

新建2d项目,游戏画面设置为1080*1920(9:16)。

图片素材设置为sprite

游戏画面搭建

Camera Size:相机画面高度的一半

Pixels Per Unit:每个单元格的像素长度

地面

新建地面GameObject,拖到相机底部,或者通过图片像素大小和相机高度来计算位置。
在这里插入图片描述在这里插入图片描述

以Ground素材为例:其图片大小为37*128,Pixels Per Unit 为100。

相机高度(Camera Size)为8,在没有移动过相机的情况下,相机中心点为(0,0),相机底部位置为(0,-8),若要让Ground图片刚好在相机最底部,那么其Y轴为 − 8 + ( 128 100 ∗ 1 2 = − 7.36 ) -8+(\frac{128}{100} * \frac{1}{2} = -7.36) 8+(10012821=7.36),Unity中可以直接输入算式然后Enter即可。

要将Ground平铺在底部,修改Draw Mode为Tiled,同时确保Ground素材的Sprite Mode为Single或者Multyple,以及MeshType为FullRect,避免报警告。

然后需要平铺几个Ground就把Ground的Width乘几,或者不在意也行,我没管。

在这里插入图片描述

背景

添加背景画面,将其DrawMode改为Sliced,同样MeshType设置为FullRect,然后点击Sprite Editor处理,切成九宫格(九宫格不同位置受拉伸影响不同),然后就可以拉伸了。

其实图片右侧还有一两个像素宽的灰色阴影,当采用两张背景平移轮播的方式时会有一条灰色的线在画面中移动,以AB的形式移动时候会有,A移出画面后挪到B后边时没有,很怪,于是我把图片右边黑色阴影涂成了旁边的颜色。

实现背景素材的连续滚动
public class BgMovement : MonoBehaviour
{private float BG_WIDTH = 9.8f;public Transform ground_1;public Transform ground_2;public Transform backGround_1;public Transform backGround_2;[Range(0,10)]public float moveSpeed = 3f;void Update(){if (GameStateManager.Instance.isFinish || GameStateManager.Instance.isPaused ) return;MoveBackground(ground_1, ground_2);MoveBackground(backGround_1, backGround_2);}private void MoveBackground(Transform obj1, Transform obj2){obj1.position -= new Vector3(moveSpeed * Time.deltaTime, 0, 0);obj2.position -= new Vector3(moveSpeed * Time.deltaTime, 0, 0);if (obj1.position.x < -BG_WIDTH){obj1.position = obj2.position + new Vector3(BG_WIDTH, 0, 0);}if (obj2.position.x < -BG_WIDTH){obj2.position = obj1.position + new Vector3(BG_WIDTH, 0, 0);}}
}
开始拼各种静态图片

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

其中的ReadyToStart是覆盖在画面上的一个按钮,目的是检测到点击之后正式开始游戏。

背景中的PieObj只是背景的一部分,所以checkpoint关闭,以防bug。

默认开启(活动?)的游戏对象,第一张图中亮着的以及GameOverUI下的全部,

默认关闭的游戏对象,GamingUI下的全部以及GameOverUI本身。

字体

别用TextMeshPro,不然这里边的字体可能没法用,反正我不会用,分数字体用Text组件就能用这里的字体了。

鸟的待机效果实现

待机动画制作

在这里插入图片描述

将鸟按三列一行的方式切分。

创建BirdAnimation,给动画添加关键帧,可以将图片直接拖到对应的时间点上。

在这里插入图片描述

注意,要先把Animation放在游戏对象上,然后确保选中的是目标游戏对象,才能把图片拖到它的Animation上作为关键帧。

待机动画控制
    private void Idle(){Radian += R * Time.deltaTime;var height = Mathf.Sin(Radian) * IdleHeight;transform.position = orgPosition + new Vector3(0, height, 0);}

游戏的状态管理

因为在点击Start之后有一个引导等待画面,所以状态分为:

Start(主界面)->Ready(显示引导等待点击)->Playing(游戏中,真的开始游戏)->Finish(游戏结束),以及Paused(暂停状态)。

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;// 主界面,点击start但是在游戏开始前的准备状态(此时显示游戏引导),游戏中状态,游戏结束状态,暂停
public enum GameState {Start, Ready, Playing, Finished, Paused }public class GameStateManager
{private static readonly Lazy<GameStateManager> instance = new Lazy<GameStateManager>(() => new GameStateManager());public static GameStateManager Instance => instance.Value;GameStateManager() { }public bool isStart;public bool isReady;public bool isPlaying;public bool isFinish;public bool isPaused;private MainPanel mainPanel;public void Setup(MainPanel panel){mainPanel = panel;}public void SetState(GameState state){switch (state){case GameState.Start:isStart = true; isReady = false; isPlaying = false; isFinish = false; isPaused = false; break;case GameState.Ready:isStart = false ; isReady = true; isPlaying = false; isFinish = false; isPaused = false; break;case GameState.Playing:isStart = false; isReady = false; isPlaying = true; isFinish = false; isPaused = false; break;case GameState.Finished:isStart = false; isReady = false; isPlaying = false; isFinish = true; isPaused = false;mainPanel.ShowGameOverUI();break;case GameState.Paused:isPaused = true;Time.timeScale = 0;break;}}// 游戏恢复public void Resume(){SetState(GameState.Playing);  // 恢复游戏状态Time.timeScale = 1;  // 恢复游戏速度}// 重启游戏public void Restart(){SetState(GameState.Start);  // 设置为开始状态Time.timeScale = 1;  // 恢复时间缩放}// 获取并更新分数public void GetScore(){int currentScore;if (int.TryParse(mainPanel.CurrentScore.text, out currentScore)){mainPanel.CurrentScore.text = (currentScore + 1).ToString();}}
}

游戏的控制

由于有一个暂停按钮在游戏中,当点击暂停按钮时同样会触发一次跳跃,所以对点击的位置进行判断。

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;public class BirdController : MonoBehaviour
{[Range(1, 10)]public float R = 5f; // 控制小鸟上下浮动的速度[Range(0, 1)]public float IdleHeight = 0.5f; // 小鸟在待机状态时的浮动高度private float Radian = 0; // 当前浮动的角度(弧度)private Vector3 orgPosition; // 初始位置public float Gravity = -9.81f; // 重力加速度public float JumpHeight = 1.3f; // 跳跃高度public Vector3 Velocity = Vector3.zero; // 当前速度public float MaxVelocity = -15f; // 最大下落速度private float RotationZ = 0; // 小鸟的旋转角度public float RotateSpeed = 8; // 旋转速度(弧度)private float JumpVelocity; // 跳跃的初始速度private Collider2D preCollieder; // 上次碰撞的物体void Start(){orgPosition = transform.position; // 记录小鸟的初始位置preCollieder = null; // 初始化碰撞器}// Update is called once per framevoid Update(){if (GameStateManager.Instance.isPaused) return;if (GameStateManager.Instance.isStart || GameStateManager.Instance.isReady){Idle();}else if (GameStateManager.Instance.isPlaying){CustomGravity();}else if(GameStateManager.Instance.isFinish){HandleBirdDie();}}// 控制小鸟在待机状态时的上下浮动private void Idle(){Radian += R * Time.deltaTime; var height = Mathf.Sin(Radian) * IdleHeight; // 根据角度计算当前浮动高度transform.position = orgPosition + new Vector3(0, height, 0); }// 控制小鸟的重力和跳跃private void CustomGravity(){if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) || Input.GetMouseButtonDown(0) ){Vector2 clickPosition;// 获取点击位置if (Input.touchCount > 0){clickPosition = Input.GetTouch(0).position; // 触摸位置}else{clickPosition = Input.mousePosition; // 鼠标位置}if (!InitSceenSize.ClickPause(clickPosition)){// 如果点击位置不在暂停按钮区域内,触发跳跃Jump();}//if (GameStateManager.Instance.isPlaying) Jump();}Velocity.y += Gravity * Time.deltaTime; // 受重力影响更新垂直速度if (Velocity.y < MaxVelocity) Velocity.y = MaxVelocity; // 限制最大下落速度transform.position += Velocity * Time.deltaTime; // 更新小鸟的位置// 控制小鸟的旋转角度,使其根据下落速度旋转if (Velocity.y < -JumpVelocity * 0.1f){RotationZ -= RotateSpeed * Time.deltaTime * 1000 * Mathf.Deg2Rad; // 放大1000倍才显得正常,帧率太高导致deltaTime过低?RotationZ = Mathf.Max(-90, RotationZ);// 限制旋转角度不超过-90°}transform.eulerAngles = new Vector3(0, 0, RotationZ);}// 鸟作为触发器去接触其他物体,要么是其他物体都设置为触发器检测是否碰到鸟,那么需要给每个会碰到鸟的物体写脚本。// 如果碰到后那些物体需要各种处理的话,也许其他作为触发器好点,毕竟还要给它们写其他东西。// 如果东西多的话,鸟要接触的东西太多了,集中在这里看起来也许不如分散到各自身上处理private void OnTriggerEnter2D(Collider2D collision){//Debug.Log(collision.tag);if(collision.CompareTag("ground") || collision.CompareTag("pipe")){//GameStateManager.Instance.Finish();GameStateManager.Instance.SetState(GameState.Finished);}if (collision.CompareTag("sky")){Velocity = new Vector3(0, -2, 0);}// 避免刚好接触时死亡,触发两次加分的情况if (collision.CompareTag("checkPoint") && ((preCollieder==null)|| preCollieder.GetComponent<Transform>().position != collision.GetComponent<Transform>().position)){GameStateManager.Instance.GetScore();preCollieder = collision;}}// 防止卡进去然后穿过去private void OnTriggerStay2D(Collider2D collision){if (collision.CompareTag("sky")){Velocity = new Vector3(0, -2, 0);}}private void HandleBirdDie(){float distance = -Camera.main.orthographicSize + 1.28f + 0.64f * 0.5f; // 通过手动计算得到的地面高度if(transform.position.y > distance){CustomGravity();}}// 重启游戏时重置小鸟的位置和状态public void Restart(){transform.position = orgPosition; // 恢复初始位置transform.eulerAngles = Vector3.zero; // 恢复旋转角度RotationZ = 0; // 恢复旋转值Velocity = Vector3.zero; // 恢复速度}// 使小鸟跳跃public void Jump(){Velocity.y = MathF.Sqrt(JumpHeight * -2 * Gravity); // 计算跳跃的初始速度JumpVelocity = Velocity.y; // 记录跳跃速度RotationZ = 30; // 跳跃时调整旋转角度}
}

障碍物的创建与控制

障碍物的创建

在这里插入图片描述

用两个管道图片拼接而成,给图片添加碰撞体,添加空游戏对象最为检查点,添加碰撞体,设置合适的位置和大小,注意设置tag。创建为预制体

障碍物的控制

using System.Collections.Generic;
using UnityEngine;public class PipeCreate : MonoBehaviour
{public BgMovement bgMove;private List<GameObject> pipeList;private float Distance = 5f;private float CameraHalfWidth;private GameObject pipePrefab;// Start is called before the first frame updatevoid Start(){pipePrefab = Resources.Load<GameObject>("Prefab/PipeObj"); // 只加载一次CameraHalfWidth = Screen.width * 1f / Screen.height * Camera.main.orthographicSize;//Debug.Log(CameraHalfWidth);pipeList = new List<GameObject>();// 也能通过协程的方式不断生成for(int i =0; i< 5;i++){var go = GameObject.Instantiate(pipePrefab);go.transform.position = new Vector3(i * Distance, Random.Range(-3f,4.5f), 0) + new Vector3(8,0,0);go.transform.SetParent(this.transform,true);pipeList.Add(go);}}public void Restart(){for (int i = 0; i < 5; i++){var go = pipeList[i];go.transform.position = new Vector3(i * Distance, Random.Range(-3f, 4.5f), 0) + new Vector3(8, 0, 0);}}// Update is called once per framevoid Update(){if(GameStateManager.Instance.isPlaying){foreach (var item in pipeList){item.transform.position += new Vector3(-Time.deltaTime * bgMove.moveSpeed, 0, 0);if (item.transform.position.x < -CameraHalfWidth - 1){var lastPipe = pipeList[pipeList.Count - 1];item.transform.position = lastPipe.transform.position + new Vector3(Distance, 0, 0);item.transform.position = new Vector3(lastPipe.transform.position.x + Distance, Random.Range(-3f, 4.5f), 0);pipeList.Remove(item);pipeList.Add(item);return;}}}}}

画面的控制与管理:开始,准备,游戏中,结束,暂停

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
using Unity.VisualScripting;public class MainPanel : MonoBehaviour
{// 开始界面public Button StartButton;public Button RestartButton;public Image Title;public GameObject UIPipe;public CanvasGroup StartUI;// 准备界面public Button ReadyToStart;  public CanvasGroup Tutorial;// 游戏界面public Text CurrentScore;public Button PauseButton;public Button ResumeButton;// 结束界面public GameObject GameOverUI;public Text FinalScore;public Text BestScore;public Image Medal;public List<Sprite> Medals;public Image NewIcon;public BirdController birdController;public PipeCreate pipeCreate;private float FadeTime = 0.4f;private bool isClickStart;// Start is called before the first frame updatevoid Start(){StartButton.onClick.AddListener(OnClickStart);RestartButton.onClick.AddListener(OnClickRestart);ReadyToStart.onClick.AddListener(GameStart);PauseButton.onClick.AddListener(OnClickPause);ResumeButton.onClick.AddListener(OnClickResume);GameOverUI.gameObject.SetActive(false);ReadyToStart.gameObject.SetActive(false);NewIcon.gameObject.SetActive(false);isClickStart = false;CurrentScore.text = "0";GameStateManager.Instance.Setup(this);GameStateManager.Instance.SetState(GameState.Start);}private void OnClickStart(){// 点击过快会触发两次点击,从而出现鸟跳跃被打断重新回到ready状态,在Restart恢复if (isClickStart) return;isClickStart = true;//GameStateManager.Instance.Ready();GameStateManager.Instance.SetState(GameState.Ready);// 恢复初始UI状态NewIcon.gameObject.SetActive(false);Medal.gameObject.SetActive(true);ShowReadyUI();}private void OnClickRestart(){GameStateManager.Instance.Restart();GameOverUI.gameObject.SetActive(false);ShowStartUI();}private void OnClickPause(){GameStateManager.Instance.SetState(GameState.Paused);ResumeButton.gameObject.SetActive(true);}private void OnClickResume(){GameStateManager.Instance.Resume();ResumeButton.gameObject.SetActive(false);}public void ShowStartUI(){// 已被隐藏且关闭,先启用,再渐显Title.gameObject.SetActive(true);StartButton.gameObject.SetActive(true);isClickStart = false;StartUI.DOFade(1, FadeTime);UIPipe.gameObject.SetActive(true);CurrentScore.gameObject.SetActive(false);PauseButton.gameObject.SetActive(false);ResumeButton.gameObject.SetActive(false);birdController.Restart();pipeCreate.Restart();}public void ShowReadyUI(){// 隐藏UI,然后关闭UIStartUI.DOFade(0, FadeTime).onComplete = () =>{StartButton.gameObject.SetActive(false);Title.gameObject.SetActive(false);};UIPipe.gameObject.SetActive(false);CurrentScore.gameObject.SetActive(true);CurrentScore.text = "0";Tutorial.gameObject.SetActive(true);Tutorial.DOFade(1, FadeTime);ReadyToStart.gameObject.SetActive(true);}private void GameStart(){GameStateManager.Instance.SetState(GameState.Playing);birdController.Jump();Tutorial.DOFade(0, FadeTime).onComplete = () =>{Tutorial.gameObject.SetActive(false);};ReadyToStart.gameObject.SetActive(false);PauseButton.gameObject.SetActive(true);ResumeButton.gameObject.SetActive(false);}public void ShowGameOverUI(){int score = int.Parse(CurrentScore.text);CurrentScore.gameObject.SetActive(false);GameOverUI.gameObject.SetActive(true);PauseButton.gameObject.SetActive(false);ResumeButton.gameObject.SetActive(false);// 最高分处理if (score > PlayerPrefs.GetInt("BestScore")){PlayerPrefs.SetInt("BestScore", score);NewIcon.gameObject.SetActive(true);}if(score <10){Medal.gameObject.SetActive(false);}else if(score <20 && score >=10){Medal.sprite = Medals[0];}else if(score < 50&& score >= 20){Medal.sprite = Medals[1];}else if(score < 100 && score >=50){Medal.sprite = Medals[2];}else{Medal.sprite = Medals[3];}FinalScore.text = score.ToString();BestScore.text = PlayerPrefs.GetInt("BestScore").ToString();}}

屏幕设置

在手机上测试时,图片和按钮位置发生了偏移和拉伸,发现是因为我是按照1080*1920做的UI,但是我的手机是2400*1080,甚至用screensize获取手机的宽还是2400而不是1080,不知道其他手机是不是这样。所以通过比大小,把手机屏幕上小的边作为宽,大的作为高。

//int screen_min = Mathf.Min(screenHeight, screenWidth);
//int screen_max = Mathf.Max(screenWidth, screenHeight);//GetComponent<CanvasScaler>().scaleFactor = screen_min / (float)1080;

然后屏幕的宽来缩放,但是实际效果不太好,于是调整了UI的这个我也不知道叫啥的东西,修改他们的参考点。在不考虑会有更宽的手机的情况下,只对高度进行调整。

在这里插入图片描述

然后由于Start的先后顺序不一。忘了使用Awake了,不过问题不大,毕竟Awake虽然在Start之前调用,但是不同脚本之间,Awake是否真的能在Start之前我就不确定了。

所以一开始在InitScreenSize.cs中修改屏幕大小,然后在BirdControoller计算暂停按钮的位置,但是由于脚本先后顺序原因,画面虽然调整了,但是Bird中获取到的暂停按钮的坐标是一开始调整之前的坐标,导致点击暂停按钮的计算出现错误,又不希望每次点击都反复计算暂停按钮所在的边框,所以将暂停按钮的坐标计算放在了InitScreenSize脚本中。

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;public class InitSceenSize : MonoBehaviour
{public RectTransform StartUI;public RectTransform GamingUI;public RectTransform FinishUI;private int screenWidth;private int screenHeight;public RectTransform pauseButtonRectTransform;private static float left;private static float right;private static float top;private static float bottom;void Start(){screenHeight = UnityEngine.Screen.height;screenWidth = UnityEngine.Screen.width;//int screen_min = Mathf.Min(screenHeight, screenWidth);//int screen_max = Mathf.Max(screenWidth, screenHeight);//GetComponent<CanvasScaler>().scaleFactor = screen_min / (float)1080;StartUI.sizeDelta = new Vector2(screenWidth, screenHeight);GamingUI.sizeDelta = new Vector2 (screenWidth, screenHeight);FinishUI.sizeDelta = new Vector2 (screenWidth, screenHeight);// 获取暂停按钮的世界坐标Vector3 buttonWorldPosition = pauseButtonRectTransform.position;// 获取暂停按钮的尺寸(宽度和高度)Vector2 buttonSize = pauseButtonRectTransform.rect.size;// 计算暂停按钮的四个边界位置left = buttonWorldPosition.x - buttonSize.x / 2;right = buttonWorldPosition.x + buttonSize.x / 2;top = buttonWorldPosition.y + buttonSize.y / 2;bottom = buttonWorldPosition.y - buttonSize.y / 2;//Debug.Log(pauseButtonRectTransform.position.y + "+" + pauseButtonRectTransform.rect.size.y / 2 + "=" + top);}public static bool ClickPause(Vector3 position){if (position.x >= left && position.x <= right && position.y >= bottom && position.y <= top){return true;}return false;}
}

参考链接

【Unity游戏开发:Flappy Bird (01)】

这是全B站最还原的2025-02-12-FlappyBird飞翔的小鸟!2025-02-12-FlappyBird开发教学合集!

素材资源

https://github.com/GameDevStation/2025-02-12-FlappyBirdDemo/blob/main/2025-02-12-FlappyBirdTexture.rar

https://pan.baidu.com/s/1Mo8wZoTr9jjelMK-28b1Cw

素材我也放项目的Asset下备份了,以防两位的链接失效。

仓库链接

MapleInori/2025-02-12-FlappyBird (github.com)

闲话

梳理这种东西好累啊,感觉要考虑的东西好多,我还是太菜了呜呜,什么时候能成为大佬呢。

素材里还有菜单按钮和排行榜按钮和分享按钮,但是我没去补充这些东西,有点超过我这个菜鸟的能力。

应该没把什么搞错。

相关文章:

Flappy Bird开发学习记录

概述 为了了解一下Unity的开发过程&#xff0c;或者说感受&#xff1f;先搞简单的练练手。 工具 Unity:2022.3.51f1c1 visual studio 2022 开发过程 项目基本设置 新建2d项目&#xff0c;游戏画面设置为1080*1920&#xff08;9&#xff1a;16&#xff09;。 图片素材设…...

SDKMAN! 的英文全称是 Software Development Kit Manager(软件开发工具包管理器)

文章目录 SDKMAN! 的核心功能SDKMAN! 的常用命令SDKMAN! 的优势总结 SDKMAN! 的英文全称是 Software Development Kit Manager。它是一个用于管理多个软件开发工具&#xff08;如 Java、Groovy、Scala、Kotlin 等&#xff09;版本的工具。SDKMAN! 提供了一个简单的方式来安装、…...

?.、??、||分别是什么,又有哪些区别???

在 JavaScript 中&#xff0c;?.、?? 和 || 是三种不同的操作符。 1、?.&#xff1a;可选链操作符 ?. 是一个可选链操作符&#xff0c;用于安全地访问嵌套属性&#xff0c;而不用担心中间的某个属性可能为 null 或 undefined&#xff0c;从而避免运行时错误。 const use…...

7个国内能打开的AI绘画网站!新手福音!

以下是我收集的国内能打开的AI绘画网站。 1、6pen 网址&#xff1a;https://6pen.art/ 2、文心大模型 网址&#xff1a;https://wenxin.baidu.com/moduleApi/ernieVilg 3、Draft 网址&#xff1a;https://draft.art/ai- art/drawing 4、nightcafe 网址&#xff1a;https:/…...

JavaWeb学习-Mybatis(增删改查)

(一)Mybatis入门程序 1.创建springboot工程,并导入 mybatis的起步依赖、mysql的驱动包。(项目工程创建完成后,自动在pom.xml文件中,导入Mybatis依赖和MySQL驱动依赖) <dependencies> <!-- mybatis起步依赖 --> <dependency> …...

C/C++面试高频题解析与解题思路(附答案)

一、基础语法与核心概念 指针与引用的区别&#xff1f; 问题&#xff1a;指针和引用在初始化、空值、操作方式上的差异是什么&#xff1f; 解析&#xff1a; 引用必须初始化且不能指向空值&#xff0c;而指针可初始化为空&#xff08;nullptr&#xff09;。 引用是变量的别名…...

使用Java爬虫获取京东商品评论API接口(JD.item_review)数据

一、引言 在电商领域&#xff0c;商品评论是用户决策的重要参考依据&#xff0c;也是商家优化产品和服务的重要数据来源。京东作为国内领先的电商平台&#xff0c;提供了丰富的API接口供开发者使用&#xff0c;其中JD.item_review接口可以获取商品的评论数据。通过这些数据&am…...

vscode插件Remote - SSH使用教程

Remote - SSH 是一款非常实用的 Visual Studio Code (VSCode) 扩展插件,它允许开发者通过SSH连接到远程服务器,并像在本地一样进行代码编辑和调试。这意味着你可以直接在VS Code中打开位于远程机器上的文件夹,并利用本地安装的VS Code功能,如语法高亮、智能感知、Git集成等…...

【通俗易懂说模型】一篇弄懂几个经典CNN图像模型(AlexNet、VGGNet、ResNet)

&#x1f308; 个人主页&#xff1a;十二月的猫-CSDN博客 &#x1f525; 系列专栏&#xff1a; &#x1f3c0;深度学习_十二月的猫的博客-CSDN博客 &#x1f4aa;&#x1f3fb; 十二月的寒冬阻挡不了春天的脚步&#xff0c;十二点的黑夜遮蔽不住黎明的曙光 目录 1. 前言 2. …...

deepseek的CoT优势、两阶段训练的有效性学习笔记

文章目录 1 DeepSeek的CoT思维链的优势1.2 open-r1的CoT训练数据1.3 ReAct任务与CoT任务适用场景 2 AI推理方向&#xff1a;deepseek与deepmind的两条路线的差异2.1 PRM与ORM的两大学派分支的差异2.2 DeepSeek-R1的两阶段训练概述 1 DeepSeek的CoT思维链的优势 DeepSeek跟之前…...

MobaXterm的图形化界面支持:原理与分辨率问题解决

1. 概述 MobaXterm 是一款功能强大的远程访问工具&#xff0c;支持SSH、RDP、X11、VNC等多种协议&#xff0c;并内置了强大的图形界面支持&#xff0c;让用户能够在远程操作Linux/Unix系统时&#xff0c;享受到类似本地桌面的流畅体验。 与传统的SSH客户端不同&#xff0c;Mo…...

算法很美笔记(Java)——树

性质 树 上面的性质因为两个结点由一条边连成 结点数目越多&#xff0c;算法复杂度越高 二叉树 结构 层次遍历 利用队列&#xff0c;弹一个&#xff0c;加N个&#xff08;队列里弹出一个元素&#xff0c;就把这个元素的所有孩子加进去&#xff09; 具体来说&#xff1a;指…...

百度 API 教程 001:显示地图并添加控件

目录 01、基本使用 前期准备 显示地图 开启鼠标滚轮缩放地图 02、添加地图控件 添加标准地图控件 添加多个控件 网址&#xff1a;地图 JS API | 百度地图API SDK 01、基本使用 前期准备 注册百度账号 申请成为开发者 获取密钥&#xff1a;控制台 | 百度地图开放平台…...

OSCP - Other Machines - Loly

主要知识点 路径枚举内核漏洞提权 具体步骤 继续nmap一下先 Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-11-01 07:12 CST Nmap scan report for loly.lc (172.16.33.25) Host is up (0.022s latency). Not shown: 65534 closed tcp ports (conn-refused) PORT …...

使用瑞芯微RK3588的NPU进行模型转换和推理

使用边缘设备进行算法落地时&#xff0c;通常要考虑模型推理速度&#xff0c;NVIDA系列平台可以使用TensorRT和CUDA加速&#xff0c;瑞芯微RK3588的板子上都是Arm的手机GPU&#xff0c;虽然没有类似CUDA的加速计算方式&#xff0c;但是提供了NPU进行加速推理&#xff0c;本文说…...

我用AI做数据分析之四种堆叠聚合模型的比较

我用AI做数据分析之四种堆叠聚合模型的比较 这里AI数据分析不仅仅是指AI生成代码的能力&#xff0c;我想是测试AI数据分析方面的四个能力&#xff0c;理解人类指令的能力、撰写代码的能力、执行代码的能力和解释结果的能力。如果这四个能力都达到了相当的水准&#xff0c;才可…...

AcWing 5166:对称山脉 ← 动态规划

【题目来源】 https://www.luogu.com.cn/problem/P9325 https://www.acwing.com/problem/content/5169/ 【题目描述】 有 N 座山排成一排&#xff0c;从左到右依次编号为 1∼N。 其中&#xff0c;第 i 座山的高度为 hi。 对于一段连续的山脉&#xff0c;我们使用如下方法定义该…...

DeepSeek 从入门到精通学习指南,2025清华大学《DeepSeek从入门到精通》正式发布104页pdf版超全解析

DeepSeek 是一款强大的 AI 搜索引擎&#xff0c;广泛应用于企业级数据检索和分析。无论您是初学者还是有经验的用户&#xff0c;掌握 DeepSeek 的使用都能为您的工作带来极大的便利。本文将从入门到精通&#xff0c;详细介绍如何学习和使用 DeepSeek。 链接: https://pan.baid…...

KEPServerEX 的接口类型与连接方式的详细说明

目录 一、KEPServerEX 核心架构 二、KEPServerEX 支持的接口类型 三、KEPServerEX 支持的连接类型 1. 通用工业协议 2. 品牌专属协议 3. 行业专用协议 4. 数据库与文件接口 四、配置示例 1. 接口配置&#xff08;以OPC UA为例&#xff09; 2. 连接配置&#xff08;以…...

HTML之JavaScript使用JSON

HTML之JavaScript使用JSON JSON(JavaScript Object Notation)是一种轻量级的数据交换格式&#xff0c;易于人阅读和编写&#xff0c;同时也易于机器解析和生成。JSON是JavaScript对象的字符串表示法&#xff0c;它使用文本表示一个js对象的信息&#xff0c;可以将json字符串转换…...

云原生AI Agent应用安全防护方案最佳实践(上)

当下&#xff0c;AI Agent代理是一种全新的构建动态和复杂业务场景工作流的方式&#xff0c;利用大语言模型&#xff08;LLM&#xff09;作为推理引擎。这些Agent代理应用能够将复杂的自然语言查询任务分解为多个可执行步骤&#xff0c;并结合迭代反馈循环和自省机制&#xff0…...

物联网软件开发与应用方向应该怎样学习,学习哪些内容,就业方向是怎样?(文末领取整套学习视频,课件)物联网硬件开发与嵌入式系统

随着物联网技术的飞速发展&#xff0c;物联网软件开发与应用方向成为了众多开发者关注的焦点。那么&#xff0c;如何在这个领域中脱颖而出呢&#xff1f;本文将为你提供一份详细的学习指南&#xff0c;帮助你从零开始&#xff0c;逐步掌握物联网软件开发与应用的核心技能。 一…...

计算机网络-八股-学习摘要

一&#xff1a;HTTP的基本概念 全称&#xff1a; 超文本传输协议 从三个方面介绍HTTP协议 1&#xff0c;超文本&#xff1a;我们先来理解「文本」&#xff0c;在互联网早期的时候只是简单的字符文字&#xff0c;但现在「文本」的涵义已经可以扩展为图片、视频、压缩包等&am…...

【天梯赛】L2-001紧急救援(用迪杰斯特拉找出权重和最小的最短路径)

解题反思 尝试DFS&#xff1a;开始使用DFS来遍历求解&#xff0c;但 DFS 存在大量重复计算&#xff0c;像同一节点会被多次访问并重复计算路径信息&#xff0c;导致时间复杂度高&#xff0c;部分测试点未通过 改用迪杰斯特拉&#xff1a;为了求解&#xff0c;设置了很多的辅助…...

PortSwigger——WebSockets vulnerabilities

文章目录 一、WebSockets二、Lab: Manipulating WebSocket messages to exploit vulnerabilities三、Lab: Manipulating the WebSocket handshake to exploit vulnerabilities四、Using cross-site WebSockets to exploit vulnerabilities4.1 跨站WebSocket劫持&#xff08;cro…...

八、OSG学习笔记-

前一章节&#xff1a; 七、OSG学习笔记-碰撞检测-CSDN博客https://blog.csdn.net/weixin_36323170/article/details/145558132?spm1001.2014.3001.5501 一、了解OSG图元加载显示流程 本章节代码&#xff1a; OsgStudy/wids CuiQingCheng/OsgStudy - 码云 - 开源中国https:…...

自己动手实现一个简单的Linux AI Agent

大模型带我们来到了自然语言人机交互的时代 1、安装本地大模型进行推理 下载地址&#xff1a; https://ollama.com/download 部署本地deepseek和嵌入模型 ollama run deepseek-r1:7b2、制定Linux操作接口指令规范 3、编写大模型对话工具 #!/usr/bin/python3 #coding: utf-8…...

常见的数据仓库有哪些?

数据仓库(Data Warehouse,简称数仓)是企业用于存储、管理和分析大量数据的重要工具,其核心目标是通过整合和处理数据,为决策提供高质量、一致性和可信度的数据支持。在构建和使用数仓时,选择合适的工具和技术至关重要。以下是常见的数仓工具及其特点的详细介绍: 1. Hiv…...

LSTM 学习笔记 之pytorch调包每个参数的解释

0、 LSTM 原理 整理优秀的文章 LSTM入门例子&#xff1a;根据前9年的数据预测后3年的客流&#xff08;PyTorch实现&#xff09; [干货]深入浅出LSTM及其Python代码实现 整理视频 李毅宏手撕LSTM [双语字幕]吴恩达深度学习deeplearning.ai 1 Pytorch 代码 这里直接调用了nn.l…...

计算机网络,大白话

好嘞&#xff0c;咱就从头到尾&#xff0c;给你好好说道说道计算机网络里这些“门门道道”的概念&#xff1a; 1. 网络&#xff08;Network&#xff09; 啥是网络&#xff1f; 你可以把网络想象成一个“大Party”&#xff0c;大家&#xff08;设备&#xff09;聚在一起&#…...