Jungle engine

DUDE! NICE WORK!
too bad about the fps i get 35 <_<

just optimize it(alot)

and add some guns and enemies :smiling_imp:

I’ve been working on the jungle engine again. I think i could improve the fps a bit… dont know exactly why, but one of the models seemed to be quite bad. I have currently set a much larger area to be filled with plants and still get 50% more frames then before. If somebody could confirm this i would be glad.

Sourcecode:
http://public.nouser.org/~rspoerri/Development/python/panda3d/projects/the-days-after/jungle-engine-0.8.0.zip

Data:
http://public.nouser.org/~rspoerri/Development/python/panda3d/projects/the-days-after/jungle-engine-data-0.8.0.zip
once extracted the data folder must be at the same level like src.

In my opinion i quite successfully separated the components like camera movement etc so a lot of the classes should be reusable.

The interactiveconsole is also updated to the latest version and can be activated using “f10”

esc: quit
i: render.analyze
l: show wireframe
o: out of body experience (base.oobe)

w,a,s,d: move around
space: release the mouse / bind the mouse
mouseclick: pickup the box at pos 0,0

Greetings every1,
I’ got panda3d yesterday and installed it, I’m a ultra begginner in coding(in whichever language) I’m really willing to learn (of course need more time), so could you help me. By the way I’m a blender user, my current dream is consolidate Panda With blender. Enough introduction for now.

Pliz show me how to visualize the jungle, for I get this error :
…syntaxError> Non-ASCII character ‘\xe4’ in file C:\Panda3D-1.5\tora\source\cameraControl.py on line 108, but no encoding declared ; see…
I started to learn coding long ago but could never advance coz my previous pcs would not run not even an Hello world, well it ran so fast I couldn’t see it. Anyways…

can you post the whole error, the one you mention is not really the error causing the script not to run.

also include how you start the script.

wow that was fast…
How do you include an image in the post? I’llsend you the pic.
I downloaded the file, extracted to a folder I created inside panda and called the command prompt and typed ppython main.py… :unamused: [/img]

i got the same error as him, until i removed the oumlouts (spelt wrong i think) on that line and another one a few lines below.

im now getting a different error,

C:\Panda3D-1.5.2\samples\procedural forest>ppython main.py
Warning: DirectNotify: category 'Interval' already exists
DirectStart: Starting the game.
Known pipe types:
  wglGraphicsPipe
(all display modules loaded.)
:util(warning): Adjusting global clock's real time by 1.32382e-005 seconds.
ERROR: no clipboard module found for platform win32
  -  using dummy clipboard ( no interaction with os )
max number of characters on a length: 85
D: interactiveConsole.consoleKeyreaderClass.__init__

customConsoleClass {'self': <__main__.the_days_after instance at 0x0692CEE0>}
*  ------ Panda3dConsole ------
* - press F10 to toggle it on/off
* - use the usual copy, cut & paste keys
* - page_up    : scrolls up
* - page_down  : scrolls down
* - arrow_up   : previous command
* - arrow_down : next command
* - BUGS       : if you paste a to long text, the entry blocks
*          FIX : use cut to remove the whole line
*  ------ commandlineConsole ------
* - enter the text to execute
* - backspace kind of works
*  ------ InteractiveConsole ------
* - direct entry enabled- BUGS   : do not try to call something like 'while True
:'
*     you will not be able to break it, you must at least include 'Task.step()'
* TAB      : autocomplete commands
* F1       : help
*  ------ IRC ------
* - use '!' in front of a line to send it to the irc component
* - example: !/connect irc.freenode.net 6667 username real name
* - example: !yourmessage to the connected channel
* TAB      : autocomplete commands
*  ------ Credits ------
* By Reto Spoerri
* rspoerri AT nouser.org
* http://www.nouser.org/
* free to use and change by anyone
*  ------ HELP ------
* enter help to view this message again
*  ------ have fun ------
:movies(error): Could not open sounds/walking.mp3
:audio(error): Cannot open file: sounds/walking.mp3
:audio(error): Could not open audio sounds/walking.mp3
C:\Panda3D-1.5.2\samples\procedural forest\src\heightfield.py:52: DeprecationWar
ning: integer argument expected, got float
  self.mHeightFieldTesselator.setFocalPoint( posX, posY )
--- small sized plants ---
--- medium sized plants ---
--- large sized plants ---
--- large sized plants ---
planning to create 9 plants
C:\Panda3D-1.5.2\samples\procedural forest\src\plants.py:273: DeprecationWarning
: integer argument expected, got float
  for plantId in xrange(plantCount):
planted 1 plants
planning to create 12 plants
planted 4 plants
<lots of lines about planting>
planning to create 87 plants
planted 39 plants
planning to create 1 plants
planted 0 plants
Assertion failed: Shader input sky2 is not present.
 at line 323 of c:\temp\mkpr\panda\src\pgraph\shaderAttrib.cxx
Traceback (most recent call last):
  File "main.py", line 119, in <module>
    a.step()
  File "main.py", line 114, in step
    taskMgr.step()
  File "C:\Panda3D-1.5.2\direct\src\task\Task.py", line 877, in step
    self.__stepThroughList(taskPriList)
  File "C:\Panda3D-1.5.2\direct\src\task\Task.py", line 776, in __stepThroughList
    ret = self.__executeTask(task)
  File "C:\Panda3D-1.5.2\direct\src\task\Task.py", line 696, in __executeTask
    ret = task(*task.extraArgs)
  File "C:\Panda3D-1.5.2\direct\src\showbase\ShowBase.py", line 1522, in __igLoop
    self.graphicsEngine.renderFrame()
AssertionError: Shader input sky2 is not present.
 at line 323 of c:\temp\mkpr\panda\src\pgraph\shaderAttrib.cxx

any ideas?

For the 1st error, it’s a new change in Python 2.5 :

So you have to use explicit encoding in the 1st line of that file :

Yeah…right…

Too much information, could you cut it in a few simple line? (remembering that I’m an ultra begginer and slow learner)…Pliz?

Hypnos is in Switzerland, and I don’t know its character set. That’s why I didn’t even try, and I don’t have the latest code here, that file doesn’t exist in the old releases.

Well, if you want to try anyway, insert this line to the #1 line

# -*- coding: <encoding-name> -*-

replace with one of these : utf, utf-8, or Panda’s default : iso8859
and be sure that line stands alone.

I usually only write comments using umlauts. So removing them should not affect the code at all.

The above problem

Assertion failed: Shader input sky2 is not present.
 at line 323 of c:\temp\mkpr\panda\src\pgraph\shaderAttrib.cxx
Traceback (most recent call last):
  File "main.py", line 119, in <module>
    a.step()
  File "main.py", line 114, in step
    taskMgr.step()
  File "C:\Panda3D-1.5.2\direct\src\task\Task.py", line 877, in step
    self.__stepThroughList(taskPriList)
  File "C:\Panda3D-1.5.2\direct\src\task\Task.py", line 776, in __stepThroughList
    ret = self.__executeTask(task)
  File "C:\Panda3D-1.5.2\direct\src\task\Task.py", line 696, in __executeTask
    ret = task(*task.extraArgs)
  File "C:\Panda3D-1.5.2\direct\src\showbase\ShowBase.py", line 1522, in __igLoop
    self.graphicsEngine.renderFrame()
AssertionError: Shader input sky2 is not present.
 at line 323 of c:\temp\mkpr\panda\src\pgraph\shaderAttrib.cxx

comes from a missing shader attribute. Check if the line “self.skyNP.setShaderInput( ‘sky2’, sky2 )” in "p3f/src/environment/environment.py is executed (by adding a print “hello world” before that line), check the console output if it’s printed.

I will update the jungleEngine in a few weeks if you remind me (from the 2nd week of june i should have time).

maybe reordering of this code part (in the same file) will help.

      self.skyNP.setShaderInput( 'sky', sky )
      self.skyNP.setShaderInput( 'sky2', sky2 )
      self.skyNP.setShaderInput( 'clouds', clouds )
      
      self.skyNP.setShader( loader.loadShader( 'data/environment/shaders/sky.sha' ) )

new code:

      self.skyNP.setShader( loader.loadShader( 'data/environment/shaders/sky.sha' ) )

      self.skyNP.setShaderInput( 'sky', sky )
      self.skyNP.setShaderInput( 'sky2', sky2 )
      self.skyNP.setShaderInput( 'clouds', clouds )

and btw. my server is currently (21.5.08) offline (so keep the a original of the source around if you change to much). it will probably take a week to get everything back to work.

got it working,

self.skyNP.setShaderInput( 'sky2', sky2 )

was missing,

sky2   = Vec4( 1.0, 1.0, 1.0, 0.0 )

was gone too, but i worked it out.

in dayNightCycle it had

self.skyNP.setShader( loader.loadShader( 'data/environment/shaders/sky.sha' ) ) 

instead of
self.skyNP.setShader( loader.loadShader( ‘data/sky.sha’ ) )

also, i didn’t have a /src/environment folder, it was just in /src
im guessing it was changing a fair bit and some parts were updated and others weren’t.

really nice. i was impressed. from what others said i was expecting it to run badly on my fx5200 but most of the overhead is cpu i guess, so actually i got 15 fps dropping to 7 fps, which i consider pretty good nowadays :slight_smile:

definatly going to look over this and find out how it works.

hi Hypnos
I’m just coming to see and try your source code and I’d to say it’s really good and useful stuff to start a new project with or just learn a lot from, so tankyou so much for share.
I downloaded the TDA stuff in your server @ this link and found little glitches, such as the previously mentioned sky2 shader issue and clunky mouse movement but nothing terribly hard to fix. Since I mean to dig and clean further your code for myself I would share with you my job in return, if you like, so make me know if you’re interested, anyway if and when it will come out something nice from my work I’ll share to people as well as you did.
bye and thanks again!

I am absolutely fine with that. I’d actually appreciate if you would release your changes on this forums as well. It would also be nice if you’d mention that part of it, is based on my work.

Otherwise, i released it with the purpose that the work might be continued by someone.

by the way, if im not mistaken (it’s quite some time ago) tda is the same as the jungle engine, i just continued the numbering. So jungle-engine-data-v0.8.1.zip and jungle-engine-v0.8.1.zip are the latest versions.

i updated and fixed some errors that came with panda3d 1.5.

use these:
http://public.nouser.org/~rspoerri/Development/python/panda3d/projects/the-days-after/jungle-engine-v0.8.2.zip
http://public.nouser.org/~rspoerri/Development/python/panda3d/projects/the-days-after/jungle-engine-data-v0.8.1.zip

still can not run, mine on Windows XP, panda3d 1.5.4
here is the console message:

DirectStart: Starting the game.
Known pipe types:
wglGraphicsPipe
(all display modules loaded.)
:util(warning): Adjusting global clock’s real time by 1.17196e-005 seconds.
Traceback (most recent call last):
File “main.py”, line 25, in
from src.interactiveConsole.interactiveConsole import pandaConsole, INPUT_CO
NSOLE, INPUT_GUI, OUTPUT_PYTHON, OUTPUT_IRC
File “D:\PandaMystuff\download\jungle-engine-v0.8.2\src\interactiveConsole\int
eractiveConsole.py”, line 16, in
from panda3d import panda3dIOClass
File “D:\PandaMystuff\download\jungle-engine-v0.8.2\src\interactiveConsole\pan
da3d.py”, line 25, in
from clipboard import clipboard
File “D:\PandaMystuff\download\jungle-engine-v0.8.2\src\interactiveConsole\cli
pboard.py”, line 34, in
applicationFinder = applicationFinderClass()
File “D:\PandaMystuff\download\jungle-engine-v0.8.2\src\interactiveConsole\cli
pboard.py”, line 24, in init
dirFiles = os.listdir(rootPath)
WindowsError: [Error 3] : ‘C:\Program Files\Intel\DMIX/.

I get the same errors…

I see for some reason this demo is picking through your environment variable paths. I had some missing folders in there, which stopped the demo. I cleaned those up by removing them from the PATH string at Control Panel, System, Advanced, Environment Variables, Path.

Then I got errors about heightfield stuff, and noticed it was a 2 part download. I downloaded the plants as well, and installed it, and now I have a working demo.

I’ve checked the demo again and setup a page for it (and hopefully fixed that crash on windows):
http://www.nouser.org/DW/doku.php?id=projects:sparetime:jungleengine

there is a visual problem with 1.6.1 on linux, which might be solved by 1.6.2

PS: the demo was picking trough the envionment-variables, because of the console (which is disabled in the latest version), the console (depending on the platform) requires tools for copy/pasting, which it searches trough the path env-vars.

A really nice demo, thanks.
I’m hoping to use panda to make a Western (ie american cowboy) freeroaming sandbox type RPG, and this is just the sort of thing to give me ideas of how to get it started, once I swap the jungle plants for more forest-like ones.