Game Development 5 min read

Introduction and Basic Usage of the Vizard Virtual‑Reality Development Platform

This article introduces Vizard, a C/C++‑based virtual‑reality development platform with Python support, and demonstrates how to load avatars and objects, create random‑walk behavior, implement dialogue actions, control character movement via keyboard, capture mouse input, and combine these techniques into a complete interactive 3D scene.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Introduction and Basic Usage of the Vizard Virtual‑Reality Development Platform

Vizard is a virtual‑reality development platform that has been evolving for ten years; it is built on C/C++ and a high‑performance OpenGL‑based graphics engine, and when Python is used it automatically compiles scripts to a byte‑code abstraction layer (LAXMI) that drives the rendering core.

Vizard basics – loading avatars, objects and background

avatar = viz.addAvatar('xxx.cfg', pos=(0,0,0), euler=(0,0,0))
viz.add('xxx.osgb', pos=(0,0,0), euler=(0,0,0))
viz.addChild('xxx.obj', pos=(-4,0,7.5))

Random pigeon walk

pigeon = viz.addAvatar('pigeon.cfg', pos=(2,0,5))
random_walk = vizact.walkTo(pos=[vizact.randfloat(1.5,2.5),0,vizact.randfloat(4.5,5.5)])
random_animation = vizact.method.state(vizact.choice([1,3], vizact.RANDOM))
random_wait = vizact.waittime(vizact.randfloat(2.0,8.0))
pigeon_idle = vizact.sequence(random_walk, random_animation, random_wait, viz.FOREVER)
pigeon.runAction(pigeon_idle)

Dialogue between two characters

def PersonTalk():
    female = viz.addAvatar('vcc_female.cfg', pos=(1,0,8), euler=(-90,0,0))
    male   = viz.addAvatar('vcc_male2.cfg',  pos=(0,0,8), euler=(90,0,0))
    female.state(14)
    male.state(4)

Keyboard‑controlled character movement

def roleMove():
    m1 = viz.Matrix.euler(0,0,0)
    dm = viz.getFrameElapsed() * speed
    temp = avatar.getEuler()[0] * math.pi/180
    if viz.key.isDown('w'):
        m1.preTrans([dm*math.sin(temp),0,dm*math.cos(temp)])
        avatar.state(2)
    elif viz.key.isDown('s'):
        m1.preTrans([-dm*math.sin(temp),0,-dm*math.cos(temp)])
        avatar.state(2)
    elif viz.key.isDown('a'):
        m1.preTrans([-dm*0.3*math.cos(temp),0,dm*0.3*math.sin(temp)])
        avatar.state(12)
    elif viz.key.isDown('d'):
        m1.preTrans([dm*0.3*math.cos(temp),0,-dm*0.3*math.sin(temp)])
        avatar.state(13)
    else:
        avatar.state(1)
    avatar.setPosition(m1.getPosition(), viz.REL_PARENT)

Mouse movement capture

def onMouseMove(e):
    global mp_x, mp_y
    mp_x = e.dx
    mp_y = e.dy

viz.callback(viz.MOUSE_MOVE_EVENT, onMouseMove)

The final demo combines a clock that shows the system time, two animated talking figures, a third‑person roaming camera, random‑walking pigeons, decorative objects such as a vase, and sky and grass backgrounds; all interactions are driven by keyboard (W/A/S/D for movement, mouse for rotation and pitch) and mouse callbacks.

PythonGame developmentTutorialVirtual RealityVR3DVizard
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.