(https://playbasic.com/gfx/PBLOGO%20-%20Two%20Colours%20With%20Shadow.png) (https://playbasic.com)
How To Make Games In PlayBASIC (https://playbasic.com)
Game Making can be a
vast topic, as such, this thread can't possibly answer all of your questions. So rather than try, here you'll find a collection lof inks to common questions / discussions of problems / examples & tutorials buried deep within the bowels of the forum.
Hopefully this will help unlock some of the
How To Make Games in PlayBasic Mystery.
Document Revision: V0.21
[plink] Submit Topic Ideas Here (https://www.underwaredesign.com/forums/index.php?topic=1872.0)[/plink]
What Have I Got Myself Into ?
You'll no doubt be horrified to discover that
PlayBasic is a
Programming Language! Therefore in order to use it effectively, you'll need to learn some (dare it say it) programming skills. OK, once you've pick yourself up off the floor, this is not as difficult as people seem to make out.
Programming is simply the ability to make the computer (through a language like PlayBASIC) perform a set of tasks in order. Which are made up of simple logic (comparisons / decisions), arithmetic (basic math) & looping mechanisms. Believe it or not, from these simple controls, we can make the computer do virtually anything we want. It's our slave :)
If you're never programmed before, then make sure you pick over the various tutorials that come with PlayBASIC (See
About section in the PlayBasic Help files ! Moreover read & experiment with the tutorial projects that in the Projects/Tutorials folder.
What Type of Video Games Can PlayBasic Create
Since this is such a frequently asked question, We've split this off into it's own FAQ. See FAQ (http://www.underwaredesign.com/forums/index.php?topic=1925.0)
Programming Principals
This section is a mishmash of useful programming questions, examples, rambles & tutorials that can be found upon the forum. Happy digging!
Misc Beginner Tutorials
- PlayBasic Tutorial Index (http://www.underwaredesign.com/forums/index.php?topic=2552.0)(PlayBasic Tutorial Forum)
- TDK's Game Programming For Beginners (http://www.underwaredesign.com/forums/index.php?topic=2395.0) (10 part tutorial series for beginners)
- Coming To Grips With Commands (http://www.underwaredesign.com/forums/index.php?topic=966.0) (Beginners Tutorial)
- The very basics: Vol 1 (http://www.underwaredesign.com/forums/index.php?topic=644.0)
Control Statements: Threads discussing If/Then, Selects/Case, For/Next Loops, Do/Loops, Goto, Gosub etc
- Should I Use Goto In My Programs ? (http://www.underwaredesign.com/forums/index.php?topic=1763.0)
- How can I EXIT from nested loop structure ?? ? (http://www.underwaredesign.com/forums/index.php?topic=1763.msg12700#msg12700)
- How NOT to use GOTO (http://www.underwaredesign.com/forums/index.php?topic=1763.msg12749#msg12749)
- Defining Labels? (code layout) (http://www.underwaredesign.com/forums/index.php?topic=1788.0)
- Block Comments (http://www.underwaredesign.com/forums/index.php?topic=442.0)
Variables:
- Variables FAQ (http://www.underwaredesign.com/forums/index.php?topic=1651.0)
- How Do Variables Work ? (http://www.underwaredesign.com/forums/index.php?topic=704.0)
- Question About Integer & Float Variables. (http://www.underwaredesign.com/forums/index.php?topic=2522.0)
- Learn More About String Variables. (http://www.underwaredesign.com/forums/index.php?topic=2522.msg17099#msg17099)
- Do I always need # symbol after my float variables ? (http://www.underwaredesign.com/forums/index.php?topic=1565.0)
Strings:
- How Do I convert an Integers / Floats to a String? (http://www.underwaredesign.com/forums/index.php?topic=2477.0)
- TrimRightWorld (Cut a word from the right hand side of a string) (http://www.underwaredesign.com/forums/index.php?topic=2326.0)
- PackedBin - Bin$() replacement (http://www.underwaredesign.com/forums/index.php?topic=2325.0)
- Split String To Array On Word (http://www.underwaredesign.com/forums/index.php?topic=2320.0)
Arrays:
- Array Commands (http://www.underwaredesign.com/forums/index.php?topic=260.0)
While old, it's still well worth the read if you want a deeper understanding of PB Array Commands. - How Can I Remove an array cell completely? (http://www.underwaredesign.com/forums/index.php?topic=1854.0)
- How Can I Clear Array Elements within multiple dimension arrays? (http://www.underwaredesign.com/forums/index.php?topic=1903.0)
- What faster Variables or Arrays ? (http://www.underwaredesign.com/forums/index.php?topic=1865.0)
- Load & save Integer Arrays (http://www.underwaredesign.com/forums/index.php?topic=483.0)
- UNDim all arrays (http://www.underwaredesign.com/forums/index.php?topic=321.0) Code that can manually undim a series of arrays
- Get Array Pointer (http://www.underwaredesign.com/forums/index.php?topic=668.0)
- Array Element Increasing (http://www.underwaredesign.com/forums/index.php?topic=820.0)
- Shifting Array Elements Down (http://www.underwaredesign.com/forums/index.php?topic=712.0)
- Array maximum dimensions and size (http://www.underwaredesign.com/forums/index.php?topic=1970.0)
- How to make Arrays GLOBAL (http://www.underwaredesign.com/forums/index.php?topic=2369.0)
- Using Reference Arrays to store Animation frames (http://www.underwaredesign.com/forums/index.php?topic=1062.msg8525#msg8525)
Types
- Linked List Type Collection Lists (Pointers & Variable Lists ) (http://www.underwaredesign.com/forums/index.php?topic=2052.msg14430#msg14430)
- Type linked List Example (http://www.underwaredesign.com/forums/index.php?topic=1730.0)
- Type Inheritance (http://www.underwaredesign.com/forums/index.php?topic=328.0)
- Type Collections (http://www.underwaredesign.com/forums/index.php?topic=1640.0)
Functions & PSubs:
- Can I call a Function from within a Function? (http://www.underwaredesign.com/forums/index.php?topic=2112.0)
Managing Arrays The following are some useful techniques for managing information in Arrays & Types
- Stacks (http://www.underwaredesign.com/forums/index.php?topic=1019.0) Storing Information in a Heap using an Array
- Ques (http://www.underwaredesign.com/forums/index.php?topic=1021.0)
- Linear Searching (http://www.underwaredesign.com/forums/index.php?topic=1022.0) Finding information within an array.
- Link Lists (http://www.underwaredesign.com/forums/index.php?topic=1021.0) (very old example on how to manually create a link list. )
- Dictionary Searching (http://www.underwaredesign.com/forums/index.php?topic=2130.0) (Binary Chop Searching a words in a sorted list)
Data Statements
- Using Restore To Search For String Labels in Data Statements (http://www.underwaredesign.com/forums/index.php?topic=980.0)
- Storing Images in data statements (http://www.underwaredesign.com/forums/index.php?topic=2245.0)
Screen
Discussions
- Double Buffering (http://www.underwaredesign.com/forums/index.php?topic=1567.0)
- Do I Need RenderToScreen ? (http://www.underwaredesign.com/forums/index.php?topic=1744.0)
- Changing Screen Styles (in windowed mode) (http://www.underwaredesign.com/forums/index.php?topic=1779.0)
- Maximize Window (http://www.underwaredesign.com/forums/index.php?topic=1900.0)
- Detecting (x) Close Window (http://www.underwaredesign.com/forums/index.php?topic=436.0)
- Restoring after System interruptions (like Alt Tab). (http://www.underwaredesign.com/forums/index.php?topic=1767.0)
- Differences Between Screenmodes? (Window/Full Screen) (http://www.underwaredesign.com/forums/index.php?topic=1798.0)
- How can I Maximize the Playbasic window ? (http://www.underwaredesign.com/forums/index.php?topic=1958.0)
Examples
- Retrieving a list of all supported screen modes (http://www.underwaredesign.com/forums/index.php?topic=2046.0)
- Direct (BackBuffer) Access (http://www.underwaredesign.com/forums/index.php?topic=1825.0)
- TV Static / Black & White Random Noise (http://www.underwaredesign.com/forums/index.php?topic=2331.0)
- detecting the RGB pixel format mask (http://www.underwaredesign.com/forums/index.php?topic=1996.0)
Tools
Images
Discussions
- How Does LoadImage Find The File ? (http://www.underwaredesign.com/forums/index.php?topic=1244.0)(in the project examples)
- Sprite Collision Class (SpriteHit) (http://www.underwaredesign.com/forums/index.php?topic=793.0)
- Economizing Image Blitting (http://www.underwaredesign.com/forums/index.php?topic=1799.0) (Getting the best speed out of image drawing)
- A crash course in Image & Sprites Draw Modes (http://www.underwaredesign.com/forums/index.php?topic=1799.msg12982#msg12982)
- Copying/Drawing Between Images Types (http://www.underwaredesign.com/forums/index.php?topic=1799.msg12983#msg12983)
- Help Managing Animation Frames (http://www.underwaredesign.com/forums/index.php?topic=1056.0)
Examples
- Frame Sheet Animationsl (http://www.underwaredesign.com/forums/index.php?topic=2542.0)
- Loading Images With Alpha Channel (http://www.underwaredesign.com/forums/index.php?topic=2031.0)
- SyncImage (http://www.underwaredesign.com/forums/index.php?topic=1831.0)
- Convert Image To Data Statements (http://www.underwaredesign.com/forums/index.php?topic=461.0)
- BlitImage (http://www.underwaredesign.com/forums/index.php?topic=998.0)
- Spot Lights Using Blit Image (http://www.underwaredesign.com/forums/index.php?topic=1072.0)
- Create Mip Map Version of Image (http://www.underwaredesign.com/forums/index.php?topic=1924.0)
- Fade Screen/Image to Black (http://www.underwaredesign.com/forums/index.php?topic=1096.0)
- BlitImageAlphaMultImage (http://www.underwaredesign.com/forums/index.php?topic=1986.0)
- BlitImageAlphaMultColour (Real Time Image Colouring) (http://www.underwaredesign.com/forums/index.php?topic=1980.0)
- Drawing a Grid (graph paper) (http://www.underwaredesign.com/forums/index.php?topic=2343.0)
- Message Box /Bubble tip (http://www.underwaredesign.com/forums/index.php?topic=2366.0)
- Safe Images (http://www.underwaredesign.com/forums/index.php?topic=2388.0) (Example showing how to survive OS interruptions)
- Scrolling Tile Fade (http://www.underwaredesign.com/forums/index.php?topic=2266.0)
- Display a Loading Screen while loading image media (http://www.underwaredesign.com/forums/index.php?topic=2508.0)
- ScaleImage Replacement (http://www.underwaredesign.com/forums/index.php?topic=2505.0)
- Draw Mirrored Image Section (http://www.underwaredesign.com/forums/index.php?topic=2502.0)
- How can I calculate how much image memory my program is using ? (http://www.underwaredesign.com/forums/index.php?topic=2501.0) (CalcUsedImageMemory)
Tools
- Play Shape (http://www.underwaredesign.com/forums/index.php?topic=1532.0) Vector Shape Editor tool for polygon sprite collision
Sprites
Discussions
- How can I Animate my Sprite ? (http://www.underwaredesign.com/forums/index.php?topic=744.0)
- Another way for Sprite Animation (http://www.underwaredesign.com/forums/index.php?topic=710)
- Pixel Perfect (rotated/scaled) Collision (http://www.underwaredesign.com/forums/index.php?topic=1374.0) Sprite to Sprite, Sprite To Lines/Boxes/Circles/polygons and more
Examples
- Intoduction to Dynamic Sprite & Image Creation (http://www.underwaredesign.com/forums/index.php?topic=923.0) (beginner friendly)
- Frame Sheet Animationsl (http://www.underwaredesign.com/forums/index.php?topic=2542.0)
- Sprite Alpha + Circle Alpha Addition effects. (http://www.underwaredesign.com/forums/index.php?topic=997.0)
- Sprite Collision (Pixel Perfect) using Shapes (http://www.underwaredesign.com/forums/index.php?topic=617.0)
- Sprite Collision Mode (Pixel Perfect)Rect/Shape & Pixel (http://www.underwaredesign.com/forums/index.php?topic=618.0)
- Sprite Collision Classes (http://www.underwaredesign.com/forums/index.php?topic=757.0)
- Circle To Sprite Intersection (http://www.underwaredesign.com/forums/index.php?topic=684.0)
- Quad (poly) hit sprite (http://www.underwaredesign.com/forums/index.php?topic=695.0)
- Sinus Bob Chain (http://www.underwaredesign.com/forums/index.php?topic=1976.0)
- 2D Particles Example (http://www.underwaredesign.com/forums/index.php?topic=2117.0)
- 3D Terrain (Using Perspective Sprites) (http://www.underwaredesign.com/forums/index.php?topic=2110.0)
- Drag Sprites With Mouse (http://www.underwaredesign.com/forums/index.php?topic=2355.0)
- CenterSpriteHandle on X and Y axis separately (http://www.underwaredesign.com/forums/index.php?topic=2517.0)
- Particle Candle (http://www.underwaredesign.com/forums/index.php?topic=2454.0)
Tools
- Play Shape (http://www.underwaredesign.com/forums/index.php?topic=1532.0) Vector Shape Editor tool for polygon sprite collision
- Play Anim (http://www.underwaredesign.com/forums/index.php?topic=1316.0)
Mapping / Worlds
In PlayBasic you can create environments in a number ways. Form the obvious mapping & world combinations, to sprites or even roll your own custom solution. So here are some threads about.
Discussions
- Tile/Tilemap Tutorial for Beginners (http://www.underwaredesign.com/pbct/pbct_dataview.php?key=12)
- Detection Collisions between Maps & Sprites question (http://www.underwaredesign.com/forums/index.php?topic=2121.msg14730#msg14730)
- Advanced Platform Game Collision (http://www.underwaredesign.com/forums/index.php?topic=1364.0) (uses worlds for slopes/sliding etc)
Source Codes
- Universal TileLoader (http://www.underwaredesign.com/forums/index.php?topic=1424.0)
- Copying Tile Data With Wrapping (http://www.underwaredesign.com/forums/index.php?topic=1778.0)
- Convert Map To Collision Worlds (http://www.underwaredesign.com/forums/index.php?topic=748.0)
- QueryWorldRegion (http://www.underwaredesign.com/forums/index.php?topic=963.0)
Tools
- Play Mapper Mini (http://www.underwaredesign.com/forums/index.php?topic=2301.0) New (Feb 2008) mapping tool for PlayBasic.
- Play Mapper Classic (http://www.underwaredesign.com/forums/index.php?topic=1503.0) The Original PlayBasic Mapping tool.
- Basic Map Editor (http://www.underwaredesign.com/pbct/pbct_dataview.php?key=54)
Cameras & Scene Buffers
Discussions Examples
- Smoothly Scroll my Camera (http://www.underwaredesign.com/forums/index.php?topic=2357.0)
- Wrap Scrolling (http://www.underwaredesign.com/forums/index.php?topic=1780.0)(infinite mirrored scrolling via cameras)
- Using Cameras to Follow Players (http://www.underwaredesign.com/forums/index.php?topic=385.0)
User Input - KeyBoard , Mouse, JoyStick
Discussions Examples
- Infinite Mouse Control (http://www.underwaredesign.com/forums/index.php?topic=491.0)
- Overriding the break key (http://www.underwaredesign.com/forums/index.php?topic=2062.0)
- Get Key Name from Scancode (http://www.underwaredesign.com/forums/index.php?topic=858.0)
- Various MouseWheel Examples (http://www.underwaredesign.com/forums/index.php?topic=969.0)
- Mouse key pad (http://www.underwaredesign.com/forums/index.php?topic=477.0)
- Inputbox for PlayBasic (http://www.underwaredesign.com/forums/index.php?topic=1682.0)(custom input dialog)
- Extended Custom Input (http://www.underwaredesign.com/forums/index.php?topic=455.0)
- Custom KeyBoard Input (http://www.underwaredesign.com/forums/index.php?topic=407.0)
- Capture/Record Mouse Movements (http://www.underwaredesign.com/forums/index.php?topic=655.0)
- Mouse Buster (http://www.underwaredesign.com/forums/index.php?topic=629.0) (mini game - how fast can you click the mouse ?
Shapes
Discussions Examples
- Particle Effects Using Shapes (http://www.underwaredesign.com/forums/index.php?topic=1830.0)
- Partition (inter object) Shape Collision (http://www.underwaredesign.com/forums/index.php?topic=1237.0)
- ImportShape - RasterToVector (http://www.underwaredesign.com/forums/index.php?topic=1007.0)
- Shape Clock (http://www.underwaredesign.com/forums/index.php?topic=517.0)
- Draw Vector Shapes (http://www.underwaredesign.com/forums/index.php?topic=114.0)
- Anti Aliased Shape Rendering Effects (line mode) (http://www.underwaredesign.com/forums/index.php?topic=2131.0)
Tools
- Play Shape (http://www.underwaredesign.com/forums/index.php?topic=1532.0) Vector Shape Editor tool for polygon sprite collision
Files / File System
Discussions
- How Can i rename a file ? (http://www.underwaredesign.com/forums/index.php?topic=2028.0)
Examples
- GetAllFilesInDir (http://www.underwaredesign.com/forums/index.php?topic=1462.0)
- Load/Saving String Data Via Banks (http://www.underwaredesign.com/forums/index.php?topic=1928.0)
- File And System Dates (http://www.underwaredesign.com/forums/index.php?topic=2300.0)
- Make Relative Path (http://www.underwaredesign.com/forums/index.php?topic=346.0)
Tools
- A mapping tool designed in PB. (http://[/url)
Misc Tutorials
- How To Make Space Invaders (http://www.underwaredesign.com/forums/index.php?topic=1275.0)
- Simple Encryption Tutorial (http://www.underwaredesign.com/forums/index.php?topic=818.0)
- Code profiling and high resolution timers (http://www.underwaredesign.com/forums/index.php?topic=2057.0)
Game Timing
- Timer Based Movement (http://www.underwaredesign.com/forums/index.php?topic=1909.0)(Tutorial With Src)
- Timer Based Movement (http://www.underwaredesign.com/forums/index.php?topic=2211.0)(Src Only)
- Consistent Game Timing (Timer Based Movement) (http://www.underwaredesign.com/forums/index.php?topic=1988.0)(Src Only)
Game AI
- Line Of Sight (LOS) (http://www.underwaredesign.com/forums/index.php?topic=2235.0)
- Field Of Vision \ Field Of View (FOV) (http://www.underwaredesign.com/forums/index.php?topic=2236.0)
- Homing Missiles (Game AI) (http://www.underwaredesign.com/forums/index.php?topic=1745.0)
- Character Path Controller (http://www.underwaredesign.com/forums/index.php?topic=1999.0)
- Movement Path Library Example (http://www.underwaredesign.com/forums/index.php?topic=2253.0)
- Character Avoid Player (http://www.underwaredesign.com/forums/index.php?topic=2432.0)
- Astar Path Finding (http://www.underwaredesign.com/forums/index.php?topic=1134.0) (Advanced)
Game Marketing/Promotion
- Using PAD files to get your game noticed on the web (http://www.underwaredesign.com/forums/index.php?topic=2360.0)
Game Examples
The following are some example games/demos (including full source code) that be found upon the forums. Ranging from simple to a little more complex..
Beginners
- Mouse Buster (http://www.underwaredesign.com/forums/index.php?topic=629.0)
- Click the Circle (http://www.underwaredesign.com/forums/index.php?topic=670.0)
- Simple Game Frame Work (http://www.underwaredesign.com/forums/index.php?topic=1789.0)
- Linked List/SpriteHit Game Frame Work Example (http://www.underwaredesign.com/forums/index.php?topic=2259.0)
- YA Pong Game (http://www.underwaredesign.com/forums/index.php?topic=822.0)
- A simple game 1: Pong (http://www.underwaredesign.com/forums/index.php?topic=732.0)
- Jigsaw Puzzler (http://www.underwaredesign.com/forums/index.php?topic=1627.0)
- Isometric Example (http://www.underwaredesign.com/forums/index.php?topic=1529.0)
- TicTacToe (http://www.underwaredesign.com/forums/index.php?topic=1466.0)
- Shadow Of The Beast demo (http://www.underwaredesign.com/forums/index.php?topic=1438.0)
- Text Adventure (Basic framework) (http://www.underwaredesign.com/forums/index.php?topic=2106.0)
- Duck Shoot (Shooting Gallery) (http://www.underwaredesign.com/forums/index.php?topic=2347.0)
- Ball Down (http://www.underwaredesign.com/forums/index.php?topic=2740.0)
- Frogger (http://www.underwaredesign.com/forums/index.php?topic=2743.0)
Intermediate
- Tracy's Blaster (Shoot-em up/Platform) Thread (http://www.underwaredesign.com/forums/index.php?topic=1210.0) - Download Source + Media (http://www.underwaredesign.com/files/pub/PlayBasic/Examples/Tracy/TracyBlasterProtoType.zip)
- Street Fighter Tech Demo Download Source + Demo (http://www.underwaredesign.com/forums/index.php?topic=595.0)
- Thesius XIII - Forest Blast Demo (Source) (http://www.underwaredesign.com/forums/index.php?topic=1896.0)
- Xenon 2000 Multi Camera Tech Demo (source +exe) (http://www.underwaredesign.com/forums/index.php?topic=499.0)
- PB Blaster Demo (Source+exe (http://www.underwaredesign.com/forums/index.php?topic=615.0)
- Perspective 2D Platformer Demo(Using Perspective Sprites) (http://www.underwaredesign.com/forums/index.php?topic=2126.0)
Advanced
- PB Racer Tech Demo (mode7 racing) (demo & src) (http://www.underwaredesign.com/forums/index.php?topic=1534.0)
- 2D Platformer in 3D World Tech Demo + Src! (http://www.underwaredesign.com/forums/index.php?topic=1080.0)