download powerpoint presentation
TRANSCRIPT
Taking Tiger Woods Java Golf OnlineTaking Tiger Woods Java Golf Online
Phil Sorger
Robert Burnett
GAMEDevelopers Conference 2000
What We’ll CoverWhat We’ll Cover
EA San DiegoJava Perceptions and RealitiesCyberViewerPGA TOUR Golf OnlinePorting C++ to Java
It takes an InternetIt takes an Internet… the new platform!… the new platform!
It takes an InternetIt takes an Internet… the new platform!… the new platform!
• Old Audience – GamersQuake, Wing Commander, Command & Conquer, Ultima, Madden Football, MS Flight Simulator
• New Audience – EveryoneBass Fishing, Barbie, Bargain Product, Millionaire
• The BrowserExplorer 3, 4, 5Netscape 3, 4, 5AOL 4, 5
• The LanguageJava – SunJava - Microsoft
It takes an InternetIt takes an Internet… the new platform!… the new platform!
• The client machinewide variety of architectures
- Macintosh- PC- Unix ...
200 to 1000 megahertzvideo accelerationconnection speed
- AOL users - 28.8 (56k connected at 14.4)- Cable, DSL - heavy users, influencers
• Our Audience "Golf Fans“Men and WomenMultiplayer, chat orientedlots of disposable income, well educated
Java as a PlatformJava as a Platform
PerceptionsSurprises ProblemsRealitiesPortingRecommendations & Alternatives
Java PerceptionsJava Perceptions
Multi-platform – PC, Mac, Unix … Portable Easy to Code and Port from C++ Secure Supported Efficient
Java SurprisesJava Surprises
Builds even a big project *very* fast Easy to publish patches Generates reasonably small code Hard to crash a machine, leak memory or
scribble on the screen Hugely scaleable Language very flexible
Java ProblemsJava Problems
Slow execution speedNo hardware access (acceleration)
– 2D/3D video, audio, inputLimited Multimedia APIsBuilt-in support stops at 1.1.xMemory Management and Garbage
Collection
Java – Perceptions vs. RealityJava – Perceptions vs. Reality
Multi-platform not even Multi-Browser Portable VJ++ vs VisualCafe vs Sun Easy to port from C++ No enum
no primitive pointersno implicit constructionno right click
Secure Code validation causes slow startup
Supported Microsoft vs Sun Efficient The Internet Sucks
The ChallengeThe Challenge
Objective: allow users to follow (view) golfers in official EA Golf tournaments.
Maximize audience Browser based
Simplify development 100% Pure Java
The Solution - CyberViewerThe Solution - CyberViewer
Showcase EA SPORTSTiger Woods 99PGA TOUR Golf
Anyone with the retail game can compete
Multi-roundprofessional format
Cash prizes“$65,000 purse”
Archive winning performances
CyberViewer ComponentsCyberViewer Components
ShotHunter and ShotServer ServersJava Shotlist Replay Engine Website (previous screen)
ShotHunter and ShotServerShotHunter and ShotServer
Responsible for creating shot assetsHunter waits for new shotsServer replays shot and posts:
– Tee and Snap background jpegs– ReplayBuffer– Z Buffer– Shotlists
Java Engine ComponentsJava Engine Components
DASH Library/API– Display Animation Sprite Handler
Ported EA Code– Golf specific classes and routines
Main Game Control– User Interface
DASH and DARTDASH and DART
DART Animation Editor– DASH Animation Render Tool
Double-buffered Display– built-in Restore(), Blit() and Flip()
Generic Handlers– File I/O, Audio, Security, Version
Management, Animation, Debugging, Network I/O, 3D Cameras, etc.
Ported EA CodePorted EA Code
GolferGolfBall and GOLF_BALL_STATETGame, TPlayer, and ShotOverhead, Scoreboard, LiemeterReplay and ReplayBufferZBuffer, Camera and TGolfView
Sneak Preview Sneak Preview PGA TOUR OnlinePGA TOUR Online
Fully interactive Multi-player Golfers Courses Physics Web / Chat
Porting C++ to JavaPorting C++ to Java
I. Array of Objects or References?
II. Stack Object or just a Reference?
… watch out for “=“
III. The stdio and WINAPI Class
IV. Callbacks
V. Globals
Array of Objects or References?Array of Objects or References?
class BrainCell extends Point { }
class Brain {
public static final int kBrainCells = 100;
private BrainCell[] brainCells;
public Brain(){
brainCells = new BrainCell[kBrainCells];
brainCells[0].x = 0; // !NULL POINTER EXCEPTION!
brainCells[0] = new BrainCell();
brainCells[0].x = 0; // now it’s ok!
boolean[] bInUse = new boolean[kBrainCells];
bInUse[0] = true; // OK, primitive type!
}
Stack Object or just a Reference?Stack Object or just a Reference?
Point WorldToScreen(Vector3 ballV)
{
Point screenPt; //! Just makes a pointer (ref)
Vector3 v; //! same thing, just a pointer!
v.x = ballV.x; //!NULL POINTER!
v = new Vector3();
v.x = ballV.x // now it’s ok!
v = ballV; // not a Copy constructor!
// what happened to old v.x???
}
The stdio classThe stdio class
public static char[] strcpy(char[] dest, char[] src){
System.arraycopy(src, 0, dest, 0, src.length);
return dest;
}
public static String strcpy(char[] dest, String src){
src.getChars(0, src.length(), dest, 0);
return src;
}
public static String strcpy(String dest, char[] src){
dest = new String(src);
return dest;
}
//etc, etc, etc…
The WINAPI classThe WINAPI class
public static long time() {
return new Date().getTime();
}
public static MSG PeekMessage(int wRemoveMsg) {
if(messageQ.size()==0) return null;
MSG lpMsg = (MSG)messageQ.firstElement();
if(wRemoveMsg==PM_REMOVE)
messageQ.removeElement(lpMsg);
return lpMsg;
}
// etc, etc, etc...
CallbacksCallbacks
interface AcceptorCallback {
public void OnAccept(Socket s);
}
class CSock extends Socket implements AcceptorCallback{
void OnAccept (Socket s) { }
}
CSock cs = new CSock();
ServerSocket ss = new ServerSocket();
Socket acceptSocket = ss.accept();
((AcceptorCallback)cs).OnAccept(acceptSocket);
GlobalsGlobals
class Game
{
public static int gNumPlayers; // global
public static final int MAX_PLAYERS=4; // const
public static void PrintNumPlayers() { // method
System.out.println(“players=“ + gNumPlayers);
}
}
if(Game.gNumPlayers <= Game.MAX_PLAYERS)
Game.PrintNumPlayers();
// ALL GLOBALS BELONG IN THEIR OBJECT’S CLASS!!
RecommendationsRecommendations
Design the experience appropriately Limit real-time requirements Maintain focus on main applet Port standard C++ routines
– strcpy, memcpy, WININET, Peek/PostMessage, rand, fopen
Consider “dirty” Java– Blend pure and DirectX
Alternatives & ConsiderationsAlternatives & Considerations
ActiveX Execution Speed
Netscape Plug-In Support
Flash vs. Ease of development
C++ Application Size Requirements
Java Script “Time to Play”
HTML / ASP Asset conversion
Design IssuesDesign Issues
Pacing of the experience- Keep the user occupied
readingplayingwatchingchatting
- Keep the user informed load timeswalk away time (advertising)
Design IssuesDesign Issues Single or Multiplayer
Manage wait - Turn based multi-player can get very slow
Group players based on …experienceinterestperformanceregion
Audience
Simplicity of operation
Information on JavaInformation on Java
Presentation materials available at www.easandiego.com
CyberViewer at tiger99.easports.net/viewer
Java information from Sun java.sun.com
Sun - JavaOne Moscone Center, SF. June 6-9, 2000.
Java programming tech shops developer.com
QuestionsQuestions