Python in the game world

  • 725 views
Uploaded on

Used in SKY presentation …

Used in SKY presentation

http://www.sky.is/index.php?option=com_content&view=article&id=1780:2012-vinnuumhverfi-forritarans&catid=25&Itemid=100074

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
725
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
4
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Python í leikjaheiminum Guðmundur Jón Halldórsson Tölvunarfræðingur frá HR CCP Games 2012
  • 2. Python• Höfundur málsins er Guido van Rossum• Málið er skýrt eftir „Monty Python‘s Flying Circus“• Python kóðinn er „Open Source“• Dæmi um mismunandi útfærslur: – CPython – PyPy ( 5x hraðara en CPython ) – IronPython (Microsoft útgáfa af Python) – Stackless ( CCP Games ) – ...
  • 3. Nokkrir kostir við Python• Stórt standard library• Gagnvirk skel• Víðtæka grafískan pakka• Mjög færanlegt, með túlk fyrir flest stýrikerfi• Styður hlutbundna högun, fjöl erfðir, klasa, namespaces, módúla, hluti, villur og late (runtime) binding• Styður functional og structured programming methods ásamt hlutbundinni höfun• Very high-level dynamic data types• Dynamic type checking• Sjálfvirk rusla söfnun• Run type checking• Auðveldlega samþætt við C, C++, …, Java og .NET
  • 4. Stackless• Microthreads – „Tasklets“ Hjúpar föll til að leyfi þeim að vera keyrð sem „microthreads“• Channels – Tví átta samskipti milli „tasklets“• Scheduling – „Round robin scheduler“. Schedule tasklets• Serialization – Tasklets má serialize á disk til að halda áfram með framkvæmd síðar
  • 5. Python/Ruby/Lua Family Tree
  • 6. Dæmi um leiki skrifaða í Python• Battle Field 2 og 2142 • Snakeworlds• Battlefield Heroes • SolarWolf • Umbra• BalazarBrothers • Interstate Outlaws• EVE Online • Evil Greg Vs. Eight Year Olds• Freedom Force • Toontown• Mount&Blade • Pirate of the Caribbena• OpenRTS Online• pydance • Code3D• PySol • Termal Enforcer• Slune • Traitors Gate 2
  • 7. Áhugaverð leikjavéla/söfn• PyGame• PySoy• Pyglet• Python-Orge• Panda3d• Blender3d• Horde3d (Mjög áhugaverð)• ...og svo má lengi telja
  • 8. VídeóDÆMI PANDA3D
  • 9. VídeóDÆMI BLENDER3D
  • 10. Panda3d dæmiProcedure CubeVídeóDÆMI PYTHON
  • 11. Skref• Teikna tening• Snúa tening• Hjálparföll (event) – toogleLightsUp – toogleLightsSide – toogleTex – makeSquare• Tengja event-a fyrir [1, 2, 3]• Hlaða inn texture (mynd)
  • 12. Teikna tening UpVinstri Fram Hægri Bak Niður
  • 13. Teikna teningsquare0 = makeSquare(-1,-1,-1, 1,-1, 1)square1 = makeSquare(-1, 1,-1, 1, 1, 1)square2 = makeSquare(-1, 1, 1, 1,-1, 1)square3 = makeSquare(-1, 1,-1, 1,-1,-1)square4 = makeSquare(-1,-1,-1,-1, 1, 1)square5 = makeSquare( 1,-1,-1, 1, 1, 1)snode = GeomNode(square)snode.addGeom(square0)snode.addGeom(square1)snode.addGeom(square2)snode.addGeom(square3)snode.addGeom(square4)snode.addGeom(square5)cube = render.attachNewNode(snode)
  • 14. Snúa, tengja og hlaða# snúacube.hprInterval(5.5, Point3(360,360,360)).loop()# tengjaself.accept("1", self.toggleTex)self.accept("2", self.toggleLightsSide)self.accept("3", self.toggleLightsUp)# hlaða texture sem er myndself.testTexture=loader.loadTexture("maps/photo.png")
  • 15. Spurning• Netfang gudmundurjon@hotmail.com• Twitter @gudmundurjon• LinkedIn gudmundurjon@hotmail.com
  • 16. Áhugaverðir hlekkirPython• http://www.python.org• http://www.stackless.com• http://www.ironpython.net/• http://pypy.org/• http://wiki.python.org/moin/PythonGames• http://www.python.org/about/success/3D• http://www.panda3d.org• http://www.blender.org• http://www.horde3d.orgYoutube• http://www.youtube.com/watch?v=WwMHnJC08vo&feature=related• http://www.youtube.com/watch?v=mQ4qr5bEP6U&feature=mfu_in_order&list=ULKóða dæmi• C:Panda3D-1.7.2samplesProcedural-CubeTut-Procedural-Cube.py