主頁 > 資料庫 > 以java語言為工具的粗糙的飛機大戰游戲的開發與實作

以java語言為工具的粗糙的飛機大戰游戲的開發與實作

2020-09-11 13:41:56 資料庫

以java語言為工具的粗糙的飛機大戰游戲的開發與實作

  • 第一步,匯入外部圖片的素材庫
  • 第二步,構建表單和面板
  • 第三步,在GamePanel上面構建背景圖畫
  • 第四步,構建英雄機和敵人的機器,支援機器之類(包括順便把子彈類也構建完畢了吧(因為英雄機里面是用的上的)),順便做了一個充滿了惡意的不能被打掉的導彈類
  • 第五步,為了游戲看起來更加和諧就加一個bgm吧
  • 第六步,把GamePanel里面我們創建的這些類對應的功能代碼補齊寫好(真的很長)
  • 第七步,把GameFrame里面的主方法寫出來并且補齊剩余部分

第一步,匯入外部圖片的素材庫

將找到的素材庫存放于src目錄下新建的img檔案夾中
在這里插入圖片描述

第二步,構建表單和面板

這是java制作游戲老生常談的第一步了,先制作一個合適大小的表單GameFrame(這里弄個APP類專門保存Frame的大小資料),作為游戲畫面盛放的底座(玻璃窗的木制窗沿),然后做一個GamePanel,作為游戲畫面盛放的最底層背景,所有的游戲畫面都將在這個背景上面得以展現(玻璃窗的玻璃),

package ui;

public class APP {
    public static int WIDTH = 512;
    public static int HEIGHT = 802;

    public APP() {
    }
}
package ui;

import java.awt.Component;
import javax.swing.JFrame;

public class GameFrame extends JFrame {
    GamePanel panel = new GamePanel();

    public GameFrame() {
        this.add(this.panel);
        this.setTitle("全民飛機大戰 by MT");
        this.setSize(APP.WIDTH, APP.HEIGHT);
        this.setLocationRelativeTo((Component)null);
        this.setDefaultCloseOperation(3);
        this.setResizable(false);
    }
package ui;
public class GamePanel extends JPanel {
	public GamePanel() {
	}
}	

第三步,在GamePanel上面構建背景圖畫

創建一個背景圖片bg物件用于管理GamePanel上面的背景圖片,包括利用集合等方法讓每次呼叫畫背景圖的時候使背景圖順序播放等,

package ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;

public class bg {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;
    List<BufferedImage> bgs = new ArrayList();
    int index = 0;

    public bg() {
        for(int i = 1; i <= 5; ++i) {
            try {
                this.bgs.add(ImageIO.read(this.getClass().getResource("/img/bg" + i + ".jpg")));
            } catch (IOException var3) {
                var3.printStackTrace();
            }

            this.img = (BufferedImage)this.bgs.get(0);
            this.w = this.img.getWidth();
            this.h = this.img.getHeight();
            this.x = 0;
            this.y = 0;
        }

    }

    public void changeImg() {
        ++this.index;
        if (this.index >= 5) {
            this.index = 0;
        }

        this.img = (BufferedImage)this.bgs.get(this.index);
    }
}

package ui;
public class GamePanel extends JPanel {
 	bg bg = new bg();
	public GamePanel() {
	 	public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(this.bg.img, this.bg.x, this.bg.y, this.bg.w, this.bg.h, (ImageObserver)null);
		}
	}	
}

第四步,構建英雄機和敵人的機器,支援機器之類(包括順便把子彈類也構建完畢了吧(因為英雄機里面是用的上的)),順便做了一個充滿了惡意的不能被打掉的導彈類

package ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;

public class Bullet {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;

    public Bullet(int hx, int hy) {
        try {
            this.img = ImageIO.read(this.getClass().getResource("/img/fire.png"));
            this.w = this.img.getWidth() / 3;
            this.h = this.img.getHeight() / 3;
            this.x = hx;
            this.y = hy;
        } catch (IOException var4) {
            var4.printStackTrace();
        }

    }

    public void move() {
        this.y -= 10;
    }
	//這里設定的boss是打一下打不死的,所以得計算擊打的次數
    public boolean hitByBoss1(Boss1 b1) {
        int b1x = b1.x;
        int b1y = b1.y;
        int b1w = b1.w;
        int b1h = b1.h;
        boolean hit = false;
        hit = this.x <= b1x + b1w && this.x >= b1x - this.w && this.y >= b1y - this.h && this.y <= b1y + b1h;
        return hit;
    }
}

package ui;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;

public class Hero {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;
    int level;
    int blood;

    public Hero() {
        try {
            this.img = ImageIO.read(this.getClass().getResource("/img/ep14.png"));
            this.w = this.img.getWidth() / 2;
            this.h = this.img.getHeight() / 2;
            this.x = 300;
            this.y = 700;
            this.level = 1;
            this.blood = 3;
        } catch (IOException var2) {
            var2.printStackTrace();
        }

    }

    public void moveTO(int x2, int y2) {
        this.x = x2 - this.w / 2;
        this.y = y2 - this.h / 2;
    }
//等級不同的話射出來的子彈也是不同的
    public List<Bullet> shoot() {
        List<Bullet> bs = new ArrayList();
        Bullet b;
        if (this.level == 1) {
            b = new Bullet(this.x + 26, this.y - 30);
            bs.add(b);
        } else {
            Bullet b1;
            if (this.level == 2) {
                b = new Bullet(this.x + 10, this.y);
                b1 = new Bullet(this.x + 40, this.y);
                bs.add(b);
                bs.add(b1);
            } else {
                Bullet b2;
                if (this.level == 3) {
                    b = new Bullet(this.x, this.y);
                    b1 = new Bullet(this.x + 26, this.y - 10);
                    b2 = new Bullet(this.x + 50, this.y);
                    bs.add(b);
                    bs.add(b1);
                    bs.add(b2);
                } else {
                    Bullet b3;
                    if (this.level == 4) {
                        b = new Bullet(this.x - 20, this.y - 10);
                        b1 = new Bullet(this.x + 10, this.y - 10);
                        b2 = new Bullet(this.x + 40, this.y - 10);
                        b3 = new Bullet(this.x + 70, this.y - 10);
                        bs.add(b);
                        bs.add(b1);
                        bs.add(b2);
                        bs.add(b3);
                    } else if (this.level == 5) {
                        b = new Bullet(this.x - 5, this.y);
                        b1 = new Bullet(this.x + 25, this.y - 10);
                        b2 = new Bullet(this.x + 55, this.y);
                        b3 = new Bullet(this.x + 85, this.y + 15);
                        Bullet b4 = new Bullet(this.x - 35, this.y + 15);
                        bs.add(b);
                        bs.add(b1);
                        bs.add(b2);
                        bs.add(b3);
                        bs.add(b4);
                    }
                }
            }
        }

        return bs;
    }
}
package ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;

public class Enmey {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;
    int sp;
    int ds;
    int boold;

    public Enmey() {
        Random rd = new Random();
        int id = rd.nextInt(11) + 1;
        String path = "/img/ep" + (id < 10 ? "0" : "") + id + ".png";

        try {
            this.img = ImageIO.read(this.getClass().getResource(path));
            this.w = this.img.getWidth();
            this.h = this.img.getHeight();
            this.x = rd.nextInt(APP.WIDTH - this.w);
            this.y = -this.h;
            this.sp = rd.nextInt(8) + 1;
            this.ds = rd.nextInt(3);
            this.boold = rd.nextInt(3) + 1;
        } catch (IOException var5) {
            var5.printStackTrace();
        }

    }

    public void move() {
        if (this.ds == 0) {
            this.y += this.sp;
        } else if (this.ds == 1) {
            this.y += this.sp;
            ++this.x;
        } else {
            this.y += this.sp;
            --this.x;
        }

    }

    public boolean hitByHero(Hero hero) {
        int hx = hero.x;
        int hy = hero.y;
        int hw = hero.w;
        int hh = hero.h;
        boolean hit = false;
        hit = this.x <= hx + hw && this.x >= hx - this.w && this.y >= hy - this.h && this.y <= hy + hh;
        return hit;
    }

    public boolean hitByBullet(Bullet b) {
        int bx = b.x;
        int by = b.y;
        int bh = b.h;
        int bw = b.w;
        boolean hit = false;
        hit = this.x <= bx + bw && this.x >= bx - this.w && this.y >= by - this.h && this.y <= by + bh;
        return hit;
    }
}

package ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;

public class Boss1 {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;
    int ds;
    int sp;
    int boold = 100;
    Random rd = new Random();

    public Boss1() {
        try {
            this.img = ImageIO.read(this.getClass().getResource("/img/ep13.png"));
            this.w = this.img.getWidth() * 2;
            this.h = this.img.getHeight() * 2;
            this.x = 100;
            this.y = -this.h;
            this.sp = this.rd.nextInt(5);
        } catch (IOException var2) {
            var2.printStackTrace();
        }

    }

    public void move() {
        if (this.ds == 0) {
            this.x -= this.sp;
        } else if (this.ds == 1) {
            this.x -= this.sp;
            this.y += this.sp;
        } else if (this.ds == 2) {
            this.y += this.sp;
        } else if (this.ds == 3) {
            this.x += this.sp;
            this.y += this.sp;
        } else if (this.ds == 4) {
            this.x += this.sp;
        } else if (this.ds == 5) {
            this.x += this.sp;
            this.y -= this.sp;
        } else if (this.ds == 6) {
            this.y -= this.sp;
        } else if (this.ds == 7) {
            this.x -= this.sp;
            this.y -= this.sp;
        }

        if (this.x > APP.WIDTH * 3 / 4) {
            this.ds = this.rd.nextInt(3);
        } else if (this.x < 0) {
            this.ds = this.rd.nextInt(5) + 2;
        } else if (this.y < 0) {
            this.ds = this.rd.nextInt(5);
        } else if (this.y > 300) {
            this.ds = this.rd.nextInt(4) + 4;
        }

    }

    public boolean hitByHero(Hero hero) {
        int hx = hero.x;
        int hy = hero.y;
        int hh = hero.h;
        int hw = hero.w;
        boolean hit = false;
        hit = this.x <= hx + hw && this.x >= hx - this.w && this.y >= hy - this.h && this.y <= hy + hh;
        return hit;
    }
}
package ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;

public class HelpPlane {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;
    int sp;
    int boold = 5;

    public HelpPlane() {
        try {
            this.img = ImageIO.read(this.getClass().getResource("/img/ep12.png"));
            this.w = this.img.getWidth();
            this.h = this.img.getHeight();
            Random rd = new Random();
            this.x = rd.nextInt(APP.WIDTH - this.w);
            this.y = -this.h;
            this.sp = rd.nextInt(8) + 1;
        } catch (IOException var2) {
            var2.printStackTrace();
        }

    }

    public void move() {
        this.y += this.sp;
    }

    public boolean hitByBullet(Bullet b) {
        int bx = b.x;
        int by = b.y;
        int bh = b.h;
        int bw = b.w;
        boolean hit = false;
        hit = this.x <= bx + bw && this.x >= bx - this.w && this.y >= by - this.h && this.y <= by + bh;
        return hit;
    }
}

package ui;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;

public class Missile {
    BufferedImage img;
    int x;
    int y;
    int w;
    int h;

    public Missile() {
        try {
            this.img = ImageIO.read(this.getClass().getResource("/img/ep15.png"));
            this.w = this.img.getWidth();
            this.h = this.img.getHeight() / 3;
            Random rd = new Random();
            this.x = rd.nextInt(APP.WIDTH - this.w);
            this.y = -this.h;
        } catch (IOException var2) {
            var2.printStackTrace();
        }

    }

    public void move() {
        this.y += 15;
    }

    public boolean hitByMissile(Hero hero) {
        int hx = hero.x;
        int hy = hero.y;
        int hh = hero.h;
        int hw = hero.w;
        boolean hit = false;
        hit = this.x <= hx + hw && this.x >= hx - this.w && this.y >= hy - this.h && this.y <= hy + hh;
        return hit;
    }
}

第五步,為了游戲看起來更加和諧就加一個bgm吧

還是在ui包下面創建一個Music類,然后在檔案里面匯入MP3

package ui;
import java.io.File;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;

public class Music {
    public Music() {
    }

    public void run() {
        try {
            Sequencer sequencer = MidiSystem.getSequencer();
            sequencer.open();
            File my = new File("1.mp3");
            Sequence mySeq = MidiSystem.getSequence(my);
            sequencer.setSequence(mySeq);
            sequencer.setLoopCount(-1);
            sequencer.start();
        } catch (Exception var4) {
            var4.printStackTrace();
        }

    }
}

第六步,把GamePanel里面我們創建的這些類對應的功能代碼補齊寫好(真的很長)

// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package ui;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.ImageObserver;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JPanel;

public class GamePanel extends JPanel {
    Hero hero = new Hero();
    Boss1 b1 = new Boss1();
    List<Enmey> es = new ArrayList();
    List<HelpPlane> hps = new ArrayList();
    List<Bullet> bs = new ArrayList();
    List<Missile> ms = new ArrayList();
    int score = 0;
    boolean isGameOver = false;
    bg bg = new bg();
    int z = 0;
    int y = 0;
    int index = 0;
    int x = 0;

    public GamePanel() {
        this.setBackground(new Color(80, 60, 30));
        MouseAdapter adapter = new MouseAdapter() {
            public void mouseMoved(MouseEvent e) {
                int x = e.getX();
                int y = e.getY();
                if (!GamePanel.this.isGameOver) {
                    GamePanel.this.hero.moveTO(x, y);
                }

                GamePanel.this.repaint();
            }

            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                if (GamePanel.this.isGameOver) {
                    GamePanel.this.isGameOver = false;
                    GamePanel.this.hero = new Hero();
                    GamePanel.this.es.clear();
                    GamePanel.this.bs.clear();
                    GamePanel.this.hps.clear();
                    GamePanel.this.score = 0;
                    GamePanel.this.ms.clear();
                    GamePanel.this.b1 = new Boss1();
                }

            }
        };
        this.addMouseListener(adapter);
        this.addMouseMotionListener(adapter);
    }

    public void action() {
        (new Thread() {
            public void run() {
                while(true) {
                    if (!GamePanel.this.isGameOver) {
                        GamePanel.this.enmeyEnter();

                        int i;
                        Enmey e;
                        for(i = 0; i < GamePanel.this.es.size(); ++i) {
                            e = (Enmey)GamePanel.this.es.get(i);
                            e.move();
                        }

                        GamePanel.this.helpEnter();

                        for(i = 0; i < GamePanel.this.hps.size(); ++i) {
                            HelpPlane h = (HelpPlane)GamePanel.this.hps.get(i);
                            h.move();
                        }

                        GamePanel.this.missileEnter();

                        for(i = 0; i < GamePanel.this.ms.size(); ++i) {
                            Missile m = (Missile)GamePanel.this.ms.get(i);
                            m.move();
                        }

                        GamePanel.this.shootAction();

                        Bullet b;
                        for(i = 0; i < GamePanel.this.bs.size(); ++i) {
                            b = (Bullet)GamePanel.this.bs.get(i);
                            b.move();
                        }

                        if (GamePanel.this.score > 10000) {
                            GamePanel.this.boss1Enter();
                            GamePanel.this.b1hAction();
                            GamePanel.this.b1Action();
                            GamePanel.this.b1.move();
                            GamePanel.this.es.clear();
                        }

                        GamePanel.this.boomAction();
                        GamePanel.this.bangAction();
                        GamePanel.this.hpAction();
                        GamePanel.this.miAction();

                        for(i = 0; i < GamePanel.this.es.size(); ++i) {
                            e = (Enmey)GamePanel.this.es.get(i);
                            if (e.y > APP.HEIGHT) {
                                GamePanel.this.es.remove(e);
                            }

                            if (e.x > APP.WIDTH) {
                                GamePanel.this.es.remove(e);
                            }

                            if (e.x + e.w < 0) {
                                GamePanel.this.es.remove(e);
                            }
                        }

                        for(i = 0; i < GamePanel.this.bs.size(); ++i) {
                            b = (Bullet)GamePanel.this.bs.get(i);
                            if (b.y + b.h < 0) {
                                GamePanel.this.bs.remove(b);
                            }
                        }

                        try {
                            Thread.sleep(20L);
                            GamePanel.this.repaint();
                        } catch (InterruptedException var3) {
                            var3.printStackTrace();
                        }
                    }
                }
            }
        }).start();
    }

    protected void b1hAction() {
        if (this.b1.hitByHero(this.hero)) {
            this.hero.blood = 0;
            this.isGameOver = true;
        }

    }

    protected void b1Action() {
        for(int i = 0; i < this.bs.size(); ++i) {
            Bullet b = (Bullet)this.bs.get(i);
            if (b.hitByBoss1(this.b1)) {
                --this.b1.boold;
                this.bs.remove(i);
                this.score += 10;
                if (this.b1.boold <= 0) {
                    this.b1.boold = 0;
                    this.isGameOver = true;
                }
                break;
            }
        }

    }

    protected void miAction() {
        for(int i = 0; i < this.ms.size(); ++i) {
            Missile m = (Missile)this.ms.get(i);
            if (m.hitByMissile(this.hero)) {
                Hero var10000 = this.hero;
                var10000.blood -= 3;
                if (this.hero.blood <= 0) {
                    this.hero.blood = 0;
                    this.isGameOver = true;
                }
                break;
            }
        }

    }

    protected void missileEnter() {
        ++this.z;
        if (this.z % 500 == 0) {
            Missile m = new Missile();
            this.ms.add(m);
        }

    }

    protected void hpAction() {
        for(int i = 0; i < this.bs.size(); ++i) {
            Bullet b = (Bullet)this.bs.get(i);

            for(int j = 0; j < this.hps.size(); ++j) {
                HelpPlane h = (HelpPlane)this.hps.get(j);
                if (h.hitByBullet(b)) {
                    --h.boold;
                    if (h.boold <= 0) {
                        this.hps.remove(h);
                        if (this.hero.level <= 4) {
                            ++this.hero.level;
                        }

                        if (this.hero.level > 2 && this.hero.blood <= 2) {
                            ++this.hero.blood;
                        }
                    }

                    this.bs.remove(i);
                    this.score += 10;
                    break;
                }
            }
        }

    }

    protected void bangAction() {
        for(int i = 0; i < this.bs.size(); ++i) {
            Bullet b = (Bullet)this.bs.get(i);

            for(int j = 0; j < this.es.size(); ++j) {
                Enmey e = (Enmey)this.es.get(j);
                if (e.hitByBullet(b)) {
                    --e.boold;
                    if (e.boold <= 0) {
                        this.es.remove(e);
                    }

                    this.bs.remove(i);
                    this.score += 10;
                    if (this.score % 1000 == 0 && this.score > 1000) {
                        this.bg.changeImg();
                    }
                    break;
                }
            }
        }

    }

    protected void boomAction() {
        for(int i = 0; i < this.es.size(); ++i) {
            Enmey e = (Enmey)this.es.get(i);
            if (e.hitByHero(this.hero)) {
                this.es.remove(i);
                if (this.hero.level >= 2) {
                    --this.hero.level;
                }

                this.score += 1024;
                --this.hero.blood;
                if (this.hero.blood <= 0) {
                    this.hero.blood = 0;
                    this.isGameOver = true;
                }
                break;
            }
        }

    }

    protected void boss1Enter() {
    }

    protected void shootAction() {
        ++this.y;
        if (this.y % 15 == 0) {
            List<Bullet> b = this.hero.shoot();
            this.bs.addAll(b);
        }

    }

    protected void enmeyEnter() {
        ++this.index;
        if (this.index % 25 == 0) {
            Enmey e = new Enmey();
            this.es.add(e);
        }

    }

    protected void helpEnter() {
        ++this.x;
        if (this.x % 500 == 0) {
            HelpPlane h = new HelpPlane();
            this.hps.add(h);
        }

    }

    public void paint(Graphics g) {
        super.paint(g);
        g.drawImage(this.bg.img, this.bg.x, this.bg.y, this.bg.w, this.bg.h, (ImageObserver)null);
        g.drawImage(this.hero.img, this.hero.x, this.hero.y, this.hero.w, this.hero.h, (ImageObserver)null);

        int i;
        for(i = 0; i < this.es.size(); ++i) {
            Enmey e = (Enmey)this.es.get(i);
            g.drawImage(e.img, e.x, e.y, e.w, e.h, (ImageObserver)null);
        }

        for(i = 0; i < this.hps.size(); ++i) {
            HelpPlane h = (HelpPlane)this.hps.get(i);
            g.drawImage(h.img, h.x, h.y, h.w, h.h, (ImageObserver)null);
        }

        for(i = 0; i < this.bs.size(); ++i) {
            Bullet b = (Bullet)this.bs.get(i);
            g.drawImage(b.img, b.x, b.y, b.w, b.h, (ImageObserver)null);
        }

        for(i = 0; i < this.ms.size(); ++i) {
            Missile m = (Missile)this.ms.get(i);
            g.drawImage(m.img, m.x, m.y, m.h, m.w, (ImageObserver)null);
        }

        g.drawImage(this.b1.img, this.b1.x, this.b1.y, this.b1.w, this.b1.h, (ImageObserver)null);
        g.setColor(Color.white);
        Font font = new Font("楷體", 1, 24);
        g.setFont(font);
        g.drawString("血量:" + this.hero.blood, 20, 30);
        g.drawString("分數:" + this.score, 330, 30);
        g.setColor(Color.red);
        Font f = new Font("楷體", 1, 40);
        g.setFont(f);
        if (this.isGameOver) {
            g.drawString("Game Over!", 166, 360);
        }

    }
}

第七步,把GameFrame里面的主方法寫出來并且補齊剩余部分

package ui;

import java.awt.Component;
import javax.swing.JFrame;

public class GameFrame extends JFrame {
    GamePanel panel = new GamePanel();

    public GameFrame() {
        this.add(this.panel);
        this.setTitle("全民飛機大戰 by MT");
        this.setSize(APP.WIDTH, APP.HEIGHT);
        this.setLocationRelativeTo((Component)null);
        this.setDefaultCloseOperation(3);
        this.setResizable(false);
    }

    public static void main(String[] args) {
        GameFrame frame = new GameFrame();
        frame.panel.action();
        frame.setVisible(true);
    }
}

剩下的就是享受游戲了??,
這次整個專案給我的識訓就是還是堅持貫徹面向物件的思想,把能夠多余的抽離出來的部分都抽離出來做成物件,然后讓程式呼叫我們創建的一個一個物件和里面包含的方法來執行功能,這樣可以使思路清晰代碼簡潔且易于修復和復用,
一個不足之處就是在實作添加bgm的功能時我一直搞不懂這玩意究竟是怎么運作的,最后這段代碼是直接在網上找了copy過來的,
第一次寫博客語言顛倒混亂,望諸君見諒,
感謝看到此處,希望我們的java水平都能越來越高,

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/5835.html

標籤:其他

上一篇:C. Chocolate Bunny(思維+規律)

下一篇:題目 1443: [藍橋杯][歷屆試題]數字游戲

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • GPU虛擬機創建時間深度優化

    **?桔妹導讀:**GPU虛擬機實體創建速度慢是公有云面臨的普遍問題,由于通常情況下創建虛擬機屬于低頻操作而未引起業界的重視,實際生產中還是存在對GPU實體創建時間有苛刻要求的業務場景。本文將介紹滴滴云在解決該問題時的思路、方法、并展示最終的優化成果。 從公有云服務商那里購買過虛擬主機的資深用戶,一 ......

    uj5u.com 2020-09-10 06:09:13 more
  • 可編程網卡芯片在滴滴云網路的應用實踐

    **?桔妹導讀:**隨著云規模不斷擴大以及業務層面對延遲、帶寬的要求越來越高,采用DPDK 加速網路報文處理的方式在橫向縱向擴展都出現了局限性。可編程芯片成為業界熱點。本文主要講述了可編程網卡芯片在滴滴云網路中的應用實踐,遇到的問題、帶來的收益以及開源社區貢獻。 #1. 資料中心面臨的問題 隨著滴滴 ......

    uj5u.com 2020-09-10 06:10:21 more
  • 滴滴資料通道服務演進之路

    **?桔妹導讀:**滴滴資料通道引擎承載著全公司的資料同步,為下游實時和離線場景提供了必不可少的源資料。隨著任務量的不斷增加,資料通道的整體架構也隨之發生改變。本文介紹了滴滴資料通道的發展歷程,遇到的問題以及今后的規劃。 #1. 背景 資料,對于任何一家互聯網公司來說都是非常重要的資產,公司的大資料 ......

    uj5u.com 2020-09-10 06:11:05 more
  • 滴滴AI Labs斬獲國際機器翻譯大賽中譯英方向世界第三

    **桔妹導讀:**深耕人工智能領域,致力于探索AI讓出行更美好的滴滴AI Labs再次斬獲國際大獎,這次獲獎的專案是什么呢?一起來看看詳細報道吧! 近日,由國際計算語言學協會ACL(The Association for Computational Linguistics)舉辦的世界最具影響力的機器 ......

    uj5u.com 2020-09-10 06:11:29 more
  • MPP (Massively Parallel Processing)大規模并行處理

    1、什么是mpp? MPP (Massively Parallel Processing),即大規模并行處理,在資料庫非共享集群中,每個節點都有獨立的磁盤存盤系統和記憶體系統,業務資料根據資料庫模型和應用特點劃分到各個節點上,每臺資料節點通過專用網路或者商業通用網路互相連接,彼此協同計算,作為整體提供 ......

    uj5u.com 2020-09-10 06:11:41 more
  • 滴滴資料倉庫指標體系建設實踐

    **桔妹導讀:**指標體系是什么?如何使用OSM模型和AARRR模型搭建指標體系?如何統一流程、規范化、工具化管理指標體系?本文會對建設的方法論結合滴滴資料指標體系建設實踐進行解答分析。 #1. 什么是指標體系 ##1.1 指標體系定義 指標體系是將零散單點的具有相互聯系的指標,系統化的組織起來,通 ......

    uj5u.com 2020-09-10 06:12:52 more
  • 單表千萬行資料庫 LIKE 搜索優化手記

    我們經常在資料庫中使用 LIKE 運算子來完成對資料的模糊搜索,LIKE 運算子用于在 WHERE 子句中搜索列中的指定模式。 如果需要查找客戶表中所有姓氏是“張”的資料,可以使用下面的 SQL 陳述句: SELECT * FROM Customer WHERE Name LIKE '張%' 如果需要 ......

    uj5u.com 2020-09-10 06:13:25 more
  • 滴滴Ceph分布式存盤系統優化之鎖優化

    **桔妹導讀:**Ceph是國際知名的開源分布式存盤系統,在工業界和學術界都有著重要的影響。Ceph的架構和演算法設計發表在國際系統領域頂級會議OSDI、SOSP、SC等上。Ceph社區得到Red Hat、SUSE、Intel等大公司的大力支持。Ceph是國際云計算領域應用最廣泛的開源分布式存盤系統, ......

    uj5u.com 2020-09-10 06:14:51 more
  • es~通過ElasticsearchTemplate進行聚合~嵌套聚合

    之前寫過《es~通過ElasticsearchTemplate進行聚合操作》的文章,這一次主要寫一個嵌套的聚合,例如先對sex集合,再對desc聚合,最后再對age求和,共三層嵌套。 Aggregations的部分特性類似于SQL語言中的group by,avg,sum等函式,Aggregation ......

    uj5u.com 2020-09-10 06:14:59 more
  • 爬蟲日志監控 -- Elastc Stack(ELK)部署

    傻瓜式部署,只需替換IP與用戶 導讀: 現ELK四大組件分別為:Elasticsearch(核心)、logstash(處理)、filebeat(采集)、kibana(可視化) 下載均在https://www.elastic.co/cn/downloads/下tar包,各組件版本最好一致,配合fdm會 ......

    uj5u.com 2020-09-10 06:15:05 more
最新发布
  • day02-2-商鋪查詢快取

    功能02-商鋪查詢快取 3.商鋪詳情快取查詢 3.1什么是快取? 快取就是資料交換的緩沖區(稱作Cache),是存盤資料的臨時地方,一般讀寫性能較高。 快取的作用: 降低后端負載 提高讀寫效率,降低回應時間 快取的成本: 資料一致性成本 代碼維護成本 運維成本 3.2需求說明 如下,當我們點擊商店詳 ......

    uj5u.com 2023-04-20 08:33:24 more
  • MySQL中binlog備份腳本分享

    關于MySQL的二進制日志(binlog),我們都知道二進制日志(binlog)非常重要,尤其當你需要point to point災難恢復的時侯,所以我們要對其進行備份。關于二進制日志(binlog)的備份,可以基于flush logs方式先切換binlog,然后拷貝&壓縮到到遠程服務器或本地服務器 ......

    uj5u.com 2023-04-20 08:28:06 more
  • day02-短信登錄

    功能實作02 2.功能01-短信登錄 2.1基于Session實作登錄 2.1.1思路分析 2.1.2代碼實作 2.1.2.1發送短信驗證碼 發送短信驗證碼: 發送驗證碼的介面為:http://127.0.0.1:8080/api/user/code?phone=xxxxx<手機號> 請求方式:PO ......

    uj5u.com 2023-04-20 08:27:27 more
  • 快取與資料庫雙寫一致性幾種策略分析

    本文將對幾種快取與資料庫保證資料一致性的使用方式進行分析。為保證高并發性能,以下分析場景不考慮執行的原子性及加鎖等強一致性要求的場景,僅追求最終一致性。 ......

    uj5u.com 2023-04-20 08:26:48 more
  • sql陳述句優化

    問題查找及措施 問題查找 需要找到具體的代碼,對其進行一對一優化,而非一直把關注點放在服務器和sql平臺 降低簡化每個事務中處理的問題,盡量不要讓一個事務拖太長的時間 例如檔案上傳時,應將檔案上傳這一步放在事務外面 微軟建議 4.啟動sql定時執行計劃 怎么啟動sqlserver代理服務-百度經驗 ......

    uj5u.com 2023-04-20 08:26:35 more
  • 云時代,MySQL到ClickHouse資料同步產品對比推薦

    ClickHouse 在執行分析查詢時的速度優勢很好的彌補了MySQL的不足,但是對于很多開發者和DBA來說,如何將MySQL穩定、高效、簡單的同步到 ClickHouse 卻很困難。本文對比了 NineData、MaterializeMySQL(ClickHouse自帶)、Bifrost 三款產品... ......

    uj5u.com 2023-04-20 08:26:29 more
  • sql陳述句優化

    問題查找及措施 問題查找 需要找到具體的代碼,對其進行一對一優化,而非一直把關注點放在服務器和sql平臺 降低簡化每個事務中處理的問題,盡量不要讓一個事務拖太長的時間 例如檔案上傳時,應將檔案上傳這一步放在事務外面 微軟建議 4.啟動sql定時執行計劃 怎么啟動sqlserver代理服務-百度經驗 ......

    uj5u.com 2023-04-20 08:25:13 more
  • Redis 報”OutOfDirectMemoryError“(堆外記憶體溢位)

    Redis 報錯“OutOfDirectMemoryError(堆外記憶體溢位) ”問題如下: 一、報錯資訊: 使用 Redis 的業務介面 ,產生 OutOfDirectMemoryError(堆外記憶體溢位),如圖: 格式化后的報錯資訊: { "timestamp": "2023-04-17 22: ......

    uj5u.com 2023-04-20 08:24:54 more
  • day02-2-商鋪查詢快取

    功能02-商鋪查詢快取 3.商鋪詳情快取查詢 3.1什么是快取? 快取就是資料交換的緩沖區(稱作Cache),是存盤資料的臨時地方,一般讀寫性能較高。 快取的作用: 降低后端負載 提高讀寫效率,降低回應時間 快取的成本: 資料一致性成本 代碼維護成本 運維成本 3.2需求說明 如下,當我們點擊商店詳 ......

    uj5u.com 2023-04-20 08:24:03 more
  • day02-短信登錄

    功能實作02 2.功能01-短信登錄 2.1基于Session實作登錄 2.1.1思路分析 2.1.2代碼實作 2.1.2.1發送短信驗證碼 發送短信驗證碼: 發送驗證碼的介面為:http://127.0.0.1:8080/api/user/code?phone=xxxxx<手機號> 請求方式:PO ......

    uj5u.com 2023-04-20 08:23:11 more