Panda3D Code Collection

Return to Code Snippets

Panda3D Code Collection

Postby wolf » Fri Sep 19, 2014 9:02 am

Hi everyone,

over all those years I'm working with panda3d now, I've collected many snippets and code used in my projects. And now it's time to share them all with the community.

Therefor I've created this Launchpad project:
https://launchpad.net/panda3dcodecollection

I'd highly recomend to use bazaar to check out the repository to always get the most recent revision of the source, but for anyone who can't use bazaar, here's a download link to get the, as of this writing, current revision of the code collection:
https://bazaar.launchpad.net/~fireclawthefox/panda3dcodecollection/trunk/tarball/67?start_revid=67

All snippets are sorted, documented and hopefully useful and easy to understand for anyone who want to use them.

Here is a quick overview of what's currently in it:
  • Core functionality snippets like asynchronous loading of models, handling multifiles, etc..
  • DirectGUI snippets for loading screens and simple HUD setups
  • Input handling via panda3d and pygame (for joystick support)
  • Internationalization snippet with gettext
  • Pandas DistributedNetwork sample codes
  • Snippet for loading shader files
  • "Special" snippets like taking screenshots and fullscreen toggle

This project will grow over time as I and maybe others will put snippets in it. Everyone is welcome to contribute to this collection.

Fireclaw
Last edited by wolf on Wed Feb 08, 2017 10:24 am, edited 1 time in total.
User avatar
wolf
 
Posts: 53
Joined: Sat Jun 27, 2009 2:07 am
Location: Germany

Re: Panda3D Code Collection

Postby wolf » Fri Sep 30, 2016 6:52 am

Hello everyone,
as there is quite a lot of new stuff in the collection and to make it simpler to find this post if someone is searching for something specific that may be covered in this project, here is an updated and exhaustive list of all the samples that are currently readily available and well documented in the Collection.

The collection comes with all necessary models (aside of those shipped by default with Panda3D) so you should be able to open any of the scripts and just run them to see how they work and what they do.
Most if not all of the scripts should work with Panda3D 1.9.x and up.

Camera Systems
  • FPS
  • Fixed
  • Follow
  • Follow extended (even more extended version can be found in the extended character controller)
  • Top-down

Character Systems
  • Simple Character Controller Featuring:
    • Basic walking
    • Basic 3rd person camera handler
    • PyGame Gamepad support
  • Extended Character Controller Featuring:
    • Extended Movements
      • Walking
      • Running
      • Jumping
      • Wall runs
    • Smooth animation transitions
    • Prevent from slipping off of slopes of arbitrary angles
    • Extended 3rd person camera handler
      • Keep camera out of walls and out of the character
      • Move camera with mouse and/or keyboard
      • Center camera behind player
      • Lazy camera positioning
    • Using Panda3D internal Physic engine (support for bullet engine is planned)
    • Simply and highly configurable
    • Demo script showing it's usage

Core Features and basics
  • A rather complex main.py template to start a new Panda3D project from
    • Contains various graphic enhancements
    • Game configuration loading and saving
    • Basic window setup
  • Asynchronous model loading snippet
  • Selection box drawing
  • Multifile extraction to temp directory
  • Show a X/Y/Z Axis on the windows edge
  • Using PRC files to simply store and load game configurations
  • Snippets that show of Panda3D basics
    • Simple event handling
    • Simple (Finite State Machine) FSM usage
    • Load multifiles in Virtual File System
    • On Screen Debug (OSD)
    • Panda3D's Tasks system

DirectGUI and other UI related things
  • Automatically scrolling Text Frame
  • Countdown
  • Drag and drop
  • Fade in/out
  • Loading screen
  • Simple Mouse Cursor changing with distiction between linux/unix and windows based systems
  • A simple HUD example
  • Automatic text writer pannel (for example for story elements in a game)

Input handling features
  • PyGame gamepad input
  • Basic mouse and keyboard input

Localisation
  • gettext example
      Contains how-to for creating gettext files
      Shows how to select language manually as well as using the systems default language
Level design features
  • Sky Cube around camera

Multimedia snippets
  • Very simple espeak snippet

Networking
  • Distributed Networking example with documentation

Physics
  • Bullet physics ball shooting example

Special effects (SFX)
  • Very basic shader loading and sample glsl shader

Specials snippets
  • Fullscreen toggle
  • Various graphic quality settings that can be set by Panda3D Like:
    • Multisampling
    • Anistropic texture filtering
    • The automatic shader generator (Per pixel lighting and Shadow mapping)
    • Antialiasing
    • Screen resolution
  • Taking Screenshots
  • Window title changing

If you want to see something specific in this collection, I may be able to come up with a new snippet or example code. Other than that, every kind of contribution to it is still very welcome, especially reviewing and testing.
User avatar
wolf
 
Posts: 53
Joined: Sat Jun 27, 2009 2:07 am
Location: Germany

Re: Panda3D Code Collection

Postby consultit » Sat Oct 01, 2016 1:05 pm

I looked at the code and I think you did a good job.
Good
User avatar
consultit
 
Posts: 93
Joined: Wed Nov 30, 2011 7:41 am

Re: Panda3D Code Collection

Postby flavio » Tue Oct 04, 2016 3:15 pm

Thank you very much! :)
flavio
 
Posts: 605
Joined: Fri Apr 16, 2010 12:45 pm
Location: Rome, Italy

Re: Panda3D Code Collection

Postby Spark-001 » Thu Oct 13, 2016 1:50 pm

I've only just started with Panda3d but wow, thank you! I have bookmarked this.
User avatar
Spark-001
 
Posts: 3
Joined: Wed Oct 12, 2016 1:02 pm

Re: Panda3D Code Collection

Postby wolf » Mon Nov 21, 2016 2:02 pm

As there are again quite some new features and snippets in the collection, here's a change log of what has been added since my last post.

Camera Systems
  • Added strategy game like topdown camera system snippet
  • Added Blender like trackball camera system snippet

Character Systems
  • Added ledge grab mode to extended character controller
  • Added first person camera mode to extended character controller

Core Features and basics
  • Added simple savegame snippet

DirectGUI and other UI related things
  • Added snippet showing all the various DirectGUI elements
  • Textwriter now will scroll automatically or at button press instead of write lines out of the frame
  • Enhanced Textwriter sample by showing the differences between auto scroll and manual scrolling
  • Added Side scrolling text snippet

Input handling features
  • Added Joystick usage example using pyglet

Level design features
  • Added sample showing objects following a path
User avatar
wolf
 
Posts: 53
Joined: Sat Jun 27, 2009 2:07 am
Location: Germany

Re: Panda3D Code Collection

Postby jayman38 » Sat Dec 31, 2016 2:41 pm

I downloaded most of the code manually, without using Bazaar.

Here is a link to my zip file with the code, for other users who may not want to use Bazaar. (Some of the folders are different, but I think I got all the important stuff.)

http://dropcanvas.com/#61dI327E46c7Q0
User avatar
jayman38
 
Posts: 1
Joined: Sat Dec 31, 2016 1:52 pm

Re: Panda3D Code Collection

Postby croxis » Sat Dec 31, 2016 8:51 pm

You can also download a tarball directly: http://bazaar.launchpad.net/~fireclawth ... t_revid=62
David - Proud to be saving the world since 1984
croxis
 
Posts: 586
Joined: Thu Feb 12, 2009 4:13 pm
Location: Portland, OR

Re: Panda3D Code Collection

Postby wolf » Wed Feb 08, 2017 10:19 am

Hey everyone,

as of revision 67, some nice and big new features just landed in the collection. So I wanted to update you with them.

general
  • Added instructions in the readme.txt on how to generally use the samples

Character Systems
  • Added gamepad support (preview of Panda3D's own gamepad handling, needs 1.10 input-overhaul build and currently only supports the Wii Remote further gamepad support will be added over time)
  • Added missing textures from the character
  • Some bugfixes and improvements

Multimedia snippets
  • Added 3D Audio sample
  • Added simple Video sample

Special effects (SFX)
  • Added simple but useful glsl shaders. Currently there are:
    • simple per-vertex shader
    • normal mapping
    • lambert (flat and phong shaded)
    • half-lambert
    • velvet (rim-light)
    • gray scale
    • a snippet file with color models (currently WIP)

I'll also add a download link to the current revision in the first post for anyone who may not want to or can't use bazaar.
User avatar
wolf
 
Posts: 53
Joined: Sat Jun 27, 2009 2:07 am
Location: Germany

Re: Panda3D Code Collection

Postby elkav » Sun Aug 27, 2017 12:56 am

Wolf

Is it possible to make this great collection code indexed by google (currently it not, AFAIK)? I believe this will give it best availability to people who search for example how to do something.

With best regards
Yosi
elkav
 
Posts: 7
Joined: Tue Jun 23, 2015 2:36 am

Re: Panda3D Code Collection

Postby wolf » Mon Aug 28, 2017 4:47 pm

Hey everyone,

I'm glad to hear my snippets are a helpful addition for some of you.

The latest revision 71 adds a few more things and enhances existing snippets.

DirectGUI and other UI related things
  • Added snippet for simple tooltip that always stay within the window
  • Enhanced Textwriter sample with Font Kerning, better text speed processing and better performance
  • Added windows cursor file in replacement of the ico format to add cursor hotspot on windows and mac systems

Special effects (SFX)
  • Some work in progress stuff like mirror effect and a test cube for texture scaling shaders

Character Systems

Core Features and basics
  • Added a snippet to show how window events can be handled

@elkav, I'm not aware of any way to specifically index this repository for google search, but I think it already ranks rather high if you search for panda3d code snippets for example (was the 4. entry on my last search). Aside of that, telling newcomers and generally all other panda3d users about this collection would probably help rise it's visibility too. And if rdb or other maintainers would be ok with that, it could be added to this manual section: http://www.panda3d.org/manual/index.php/User_Contributed_Tutorials_and_Examples or somewhere below my already added books on http://www.panda3d.org/manual/index.php/More_Panda3D_Resources.
User avatar
wolf
 
Posts: 53
Joined: Sat Jun 27, 2009 2:07 am
Location: Germany

Re: Panda3D Code Collection

Postby sazearte » Tue Oct 31, 2017 2:17 am

Hello, it's possible to include grass/three terrain example and to add water demonstration ? like this :
https://www.youtube.com/watch?v=1LAIEjmjRic
sazearte
 
Posts: 49
Joined: Wed Feb 03, 2016 11:20 am

Re: Panda3D Code Collection

Postby wolf » Thu Nov 09, 2017 4:59 pm

Hi sazearte, it definitely is possible to add such examples but probably will take some time untill I get to it. In the meantime you could already take them from the demomaster which you see in the linked video. It can be found over at viewtopic.php?f=6&t=5915&hilit=+demomaster Not sure how well it does work for recent versions of P3D though.
As soon as I get time I'll take a look into vegetation, terrain and water as those are things I personally need too.
User avatar
wolf
 
Posts: 53
Joined: Sat Jun 27, 2009 2:07 am
Location: Germany

Re: Panda3D Code Collection

Postby sazearte » Wed Nov 15, 2017 3:47 am

thank you very much wolf, i think is very interesting to have demo of lod grass terrain

thank for your link but i had read this post before post here and the sampler is verry old and not work in modern panda version.
sazearte
 
Posts: 49
Joined: Wed Feb 03, 2016 11:20 am


Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 2 guests