Book Image

Panda3D 1.7 Game Developer's Cookbook

Book Image

Panda3D 1.7 Game Developer's Cookbook

Overview of this book

Table of Contents (20 chapters)
Panda3D 1.7 Game Developer's Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Downloading a file from a server


It is a very common property of today's games—even those that are strictly single player—to connect to a server at some point in time to retrieve data such as the latest headlines from the game's official website, leaderboards, patches or the latest bonus content package. By the end of this recipe you will be able to do so as well.

Hosting files on a web server is very simple to set up and reasonably priced these days. Additionally, this makes it easy to use Panda3D's built in networking features. The engine comes with a class called HTTPClient that hides the complexities of communicating with a web server.

In this sample you will learn how to connect to a server, download some data and display it on the screen.

Getting ready

This recipe will use the framework presented in Setting up the game structure found in Chapter 1, Setting Up Panda3D and Configuring Development Tools. Please set up your project prior to going on with the following tasks.

How to do it.....