SlideShare a Scribd company logo
1 of 29
Download to read offline
Flash GAMM Kyiv 2011. 10 декабря
                 Flash GAMM Kyiv 2011. December, 10




AlternativaPhysics: физическая симуляция на Flash – это просто

     AlternativaPhysics: physics simulation on Flash is easy



          Дмитрий Сергеев, Программист, AlternativaPlatform
         Dmitriy Sergeev, Software Engineer, AlternativaPlatform
План доклада
                      Plan

●   Введение                 ●   Introduction
●   Обзор функциональности   ●   Functionality review
●   Обзор API                ●   API review
●   Демо движка              ●   Engine demos
Цель доклада
                         Goal

    Показать, что:                  The goal is to show that:
●   AlternativaPhysics – это    ●   AlternativaPhysics is a
    мощный и                        powerful and universal
    универсальный движок            engine
●   Использовать                ●   The usage of
    AlternativaPhysics просто       AlternativaPhysics is easy
Что такое физический движок?
            What is the physics engine?

Физический движок
Physics engine
                                                       Объекты
                                                       Objects
                    Физическая сцена
                    Physics scene
  Конфигурация                                         События
   Configuration                                        Events


   Геометрия                           Солвер Solver
   Geometry
                            Силы                   Ограничения
                            Forces                  Constraints
  Определение
  столкновений
     Collision        Позиции, скорости       Столкновения, контакты
    detection         Positions, velocities     Collisions, contacts
История AlternativaPhysics
 The history of AlternativaPhysics

http://tankionline.com
Место физики в платформе
           Physics in the platform


                   AlternativaPlatform


Alternativa3D                                     AlternativaCore


        AlternativaEditor                AlternativaPhysics

                        AlternativaGUI
Функциональность
                      Functionality




●   Солвер      ●   Solver
●   Геометрия   ●   Geometry
Солвер
                     Solver
●   Улучшенная            ●   Improved stability
    стабильность          ●   Plausible simulation of
●   Реалистичная              elastic and resting
    симуляция упругих и       contacts
    неупругих контактов   ●   Physic materials
●   Физический материал       ●   elasticity (restitution)
    ●   упругость             ●   friction
    ●   трение
Солвер. Стеки, материалы. Демо
Solver. Stacks and materials. Demo
Солвер. Ограничения
            Solver. Constraints
●   Максимальное           ●   Max distance
    расстояние             ●   Fixed distance
●   Фиксированное          ●   Ball-in-socket
    расстояние
                           ●   Rotational (hinge)
●   Шаровое соединение
    (ball-in-socket)
●   Вращательное (hinge)
Солвер. Ограничения. Демо
 Solver. Constraints. Demo
Геометрия. Примитивы
            Geometry. Primitives
●   Плоские примитивы         ●   Flat primitives (triangle,
    (треугольник, квадрат)        square)
●   Объемные примитивы        ●   3D primitives (ball, box,
    (шар, бокс, цилиндр,          cylinder, cone, frustum)
    конус, усеченный конус)
Геометрия. Сложные объекты
       Geometry. Complex Objects

    Произвольные тела:            Arbitrary bodies:
●   Выпуклый многогранник     ●   Convex polyhedron
●   Треугольный меш           ●   Triangle mesh
●   Иерархический контейнер   ●   Hierarchical container
Геометрия. Демо
 Geometry demo
Геометрия. Другие особенности
              Geometry. Another Features
●   Алгоритм GJK/EPA          ●   GJK/EPA algorithm
●   Оптимизации               ●   Optimization
    ●   широкая фаза              ●   broad phase
    ●   статические объекты       ●   static objects
●   Пересечение с лучом       ●   Ray casts
Ограничения на число объектов
    Limitations on the Number of Objects
●   Количество объектов –    ●   The number of objects –
    до 500 при большом           up to 500 in case of a
    числе взаимодействий         large amount of contacts
●   Количество примитивов    ●   The number of primitives
    в статических объектах       in static objects –
    – неограниченно              unlimited
API

●   Сцена               ●   Physics scene
●   Конфигурация        ●   Engine configuration
    движка              ●   Event handling
●   Обработка событий
Сцена. Иерархия объектов
                          Scene. Hierarchy of Objects
Сцена Scene

                   Тело                         Нефизический объект
                   Body                          Non-physical object



          Физический примитив
            Physical primitive


         Нефизический примитив                  Нефизический примитив
          Non-physical primitive                 Non-physical primitive

     •Материал             •Material
     •Подвижность          •Movability

     •Позиция              •Position
                                            •Позиция             •Position
     •Скорость             •Velocity
                                            •События             •Events
     •Масса                •Mass

     •События              •Events
Сцена. Иерархия объектов
     Scene. Hierarchy of Objects
private function PhysicsTest() {
   physicsScene = PhysicsConfiguration.DEFAULT.getPhysicsScene();

    var body:Body = new Body();
    var box:CollisionBox = new CollisionBox(new Vector3(1, 1, 1),
      CollisionType.DYNAMIC);
    body.addPhysicsPrimitive(new PhysicsPrimitive(box, 10,
      new PhysicsMaterial(0.5, 0.5)));

    body.calculateInertiaTensor();
    physicsScene.add(body);

    body.setVelocity(new Vector3(1, 0, 0));

    stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}

private function onEnterFrame(event:Event):void {
   while (physicsScene.time < getTimer())
       physicsScene.update(PHYSICS_STEP);
   ...
}
Сцена. Ограничения
          Scene. Constraints

var boxCount:int = 3;
var boxes:Vector.<Body> = new Vector.<Body>(boxCount);

for (var i:int = 0; i < boxCount; i++)   {
   boxes[i] = createBox(i);
   physicsScene.add(boxes[i]);
}

for (i = 0; i < boxCount - 1; i++) {
   var c:ImpulseConstraint = new HingeImpulseConstraint(
     boxes[i], boxes[i + 1],
     new Vector3(INTERVAL, 0, 0), Vector3.ZERO,
     new Vector3(0, 0, 1), new Vector3(0, 0, 1)))
   physicsScene.addConstraint(c);
}
Демо c 3 кубами
 3 cubes demo
Конфигурация движка
            Engine Configuration
●   Конфигурация               ●   Geometry configuration
    геометрии                  ●   Solver configuration
●   Конфигурация солвера

      var physicsConfig:PhysicsConfiguration =
        new PhysicsConfiguration();

      physicsConfig.geometryConfiguration =
        new GeometryConfiguration();

      var solverConfig:ImpulseSolverConfiguration =
        ImpulseSolverConfiguration.DEFAULT.clone();
      solverConfig.contactIterations = 4;
      physicsConfig.solverConfiguration = solverConfig;

      var physicsScene:PhysicsScene =
        physicsConfig.getPhysicsScene();
События
                        Events
●   Предобработка сцены      ●   Before update
    (onBeforeUpdate)         ●   After update
●   Постобработка сцены      ●   Contact
    (onAfterUpdate)
                                 ●   With body
●   Возникновение контакта
                                 ●   WIth primitive
    ●   С телом
    ●   С примитивом
События
                             Events
public class SimFlag extends SimObject {
    public function SimFlag(position:Position, onContact:Function) {
        ...
        cylinder = new CollisionCylinder(r, 3, CollisionType.TRIGGER);
        cylinder.addEventListener(ContactEvent.OnContact, onContact, this);
        ...
    }
    ...
}

public class BallDemo {
    public function BallDemo() {
        ...
        add(new SimFlag(Position.createXYZ(-4, -4, 0), takeFlag));
        ...
    }

    private function takeFlag(event:ContactEvent):void {
        ...
        flag = (event.userData as SimFlag);
        flag.visible = false;
    }
    ...
}
Демо Ball and flags
Ball and Flags Demo
В разработке
                     In Development
●   Новые типы ограничений (slider,   ●   New constraints (slider, hinge-2,
    hinge-2, универсальный)               universal joint)
●   Параметризация ограничений        ●   Constraints' parameterization
●   Новые примитивы (капсула,         ●   New primitives (capsule, ellipsoid)
    эллипсоид)
                                      ●   New events (enter contact, leave
●   Новые события (появление,             contact)
    окончание контакта)
                                      ●   Stabilization improvement
●   Улучшение стабилизации
                                      ●   Performance improvement
●   Улучшение быстродействия
                                      ●   Intergration with Alternativa3D
●   Интеграция с Alternativa3D
Демо Cannon stage
Cannon Stage Demo
Спасибо за внимание
Thanks for your attention

   пожалуйста, задавайте вопросы,
             пишите на
   sergeev@alternativaplatform.com


      please ask your questions,
        feel free to contact me:
   sergeev@alternativaplatform.com

More Related Content

Similar to Alternativa Platform: Flash-игры: переходим в третье измерение

2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность
2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность 2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность
2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность Омские ИТ-субботники
 
Построение мультисервисного стартапа в реалиях full-stack javascript
Построение мультисервисного стартапа в реалиях full-stack javascriptПостроение мультисервисного стартапа в реалиях full-stack javascript
Построение мультисервисного стартапа в реалиях full-stack javascriptFDConf
 
Spock - the next stage of unit testing
Spock - the next stage of unit testingSpock - the next stage of unit testing
Spock - the next stage of unit testingjugkaraganda
 
2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк
2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк
2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворкОмские ИТ-субботники
 
CV2011 Lecture 8. Detection
CV2011 Lecture 8. DetectionCV2011 Lecture 8. Detection
CV2011 Lecture 8. DetectionAnton Konushin
 
20120415 videorecognition konushin_lecture06
20120415 videorecognition konushin_lecture0620120415 videorecognition konushin_lecture06
20120415 videorecognition konushin_lecture06Computer Science Club
 

Similar to Alternativa Platform: Flash-игры: переходим в третье измерение (9)

Workshop: Game-design as Lego
Workshop: Game-design as LegoWorkshop: Game-design as Lego
Workshop: Game-design as Lego
 
2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность
2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность 2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность
2016-11-12 01 Егор Непомнящих. Агрегация и осведомленность
 
Построение мультисервисного стартапа в реалиях full-stack javascript
Построение мультисервисного стартапа в реалиях full-stack javascriptПостроение мультисервисного стартапа в реалиях full-stack javascript
Построение мультисервисного стартапа в реалиях full-stack javascript
 
Build your own multistack JS startup
Build your own multistack JS startupBuild your own multistack JS startup
Build your own multistack JS startup
 
Spock - the next stage of unit testing
Spock - the next stage of unit testingSpock - the next stage of unit testing
Spock - the next stage of unit testing
 
2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк
2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк
2014-08-02 01 Егор Непомнящих. jWidget - очередной MV*-фреймворк
 
CV2011 Lecture 8. Detection
CV2011 Lecture 8. DetectionCV2011 Lecture 8. Detection
CV2011 Lecture 8. Detection
 
20120415 videorecognition konushin_lecture06
20120415 videorecognition konushin_lecture0620120415 videorecognition konushin_lecture06
20120415 videorecognition konushin_lecture06
 
UA Mobile 2012
UA Mobile 2012UA Mobile 2012
UA Mobile 2012
 

More from DevGAMM Conference

The art of small steps, or how to make sound for games in conditions of war /...
The art of small steps, or how to make sound for games in conditions of war /...The art of small steps, or how to make sound for games in conditions of war /...
The art of small steps, or how to make sound for games in conditions of war /...DevGAMM Conference
 
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...DevGAMM Conference
 
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...DevGAMM Conference
 
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...DevGAMM Conference
 
AI / ML for Indies / Tyler Coleman (Retora Games)
AI / ML for Indies / Tyler Coleman (Retora Games)AI / ML for Indies / Tyler Coleman (Retora Games)
AI / ML for Indies / Tyler Coleman (Retora Games)DevGAMM Conference
 
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...DevGAMM Conference
 
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...DevGAMM Conference
 
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...DevGAMM Conference
 
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...DevGAMM Conference
 
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)DevGAMM Conference
 
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)DevGAMM Conference
 
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...DevGAMM Conference
 
How to increase wishlists & game sales from China? Growth marketing tactics &...
How to increase wishlists & game sales from China? Growth marketing tactics &...How to increase wishlists & game sales from China? Growth marketing tactics &...
How to increase wishlists & game sales from China? Growth marketing tactics &...DevGAMM Conference
 
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)DevGAMM Conference
 
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...DevGAMM Conference
 
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...DevGAMM Conference
 
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...DevGAMM Conference
 
Branded Content: How to overcome players' immunity to advertising / Alex Brod...
Branded Content: How to overcome players' immunity to advertising / Alex Brod...Branded Content: How to overcome players' immunity to advertising / Alex Brod...
Branded Content: How to overcome players' immunity to advertising / Alex Brod...DevGAMM Conference
 
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...DevGAMM Conference
 
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...DevGAMM Conference
 

More from DevGAMM Conference (20)

The art of small steps, or how to make sound for games in conditions of war /...
The art of small steps, or how to make sound for games in conditions of war /...The art of small steps, or how to make sound for games in conditions of war /...
The art of small steps, or how to make sound for games in conditions of war /...
 
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
Breaking up with FMOD - Why we ended things and embraced Metasounds / Daniel ...
 
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
How Audio Objects Improve Spatial Accuracy / Mads Maretty Sønderup (Audiokine...
 
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
Why indie developers should consider hyper-casual right now / Igor Gurenyov (...
 
AI / ML for Indies / Tyler Coleman (Retora Games)
AI / ML for Indies / Tyler Coleman (Retora Games)AI / ML for Indies / Tyler Coleman (Retora Games)
AI / ML for Indies / Tyler Coleman (Retora Games)
 
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
Agility is the Key: Power Up Your GameDev Project Management with Agile Pract...
 
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
New PR Tech and AI Tools for 2023: A Game Changer for Outreach / Kirill Perev...
 
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
Playable Ads - Revolutionizing mobile games advertising / Jakub Kukuryk (Popc...
 
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
Creative Collaboration: Managing an Art Team / Nastassia Radzivonava (Glera G...
 
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
From Local to Global: Unleashing the Power of Payments / Jan Kuhlmannn (Xsolla)
 
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
Strategies and case studies to grow LTV in 2023 / Julia Iljuk (Balancy)
 
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
Why is ASO not working in 2023 and how to change it? / Olena Vedmedenko (Keya...
 
How to increase wishlists & game sales from China? Growth marketing tactics &...
How to increase wishlists & game sales from China? Growth marketing tactics &...How to increase wishlists & game sales from China? Growth marketing tactics &...
How to increase wishlists & game sales from China? Growth marketing tactics &...
 
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
Turkish Gaming Industry and HR Insights / Mustafa Mert EFE (Zindhu)
 
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
Building an Awesome Creative Team from Scratch, Capable of Scaling Up / Sasha...
 
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
Seven Reasons Why Your LiveOps Is Not Performing / Alexander Devyaterikov (Be...
 
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
The Power of Game and Music Collaborations: Reaching and Engaging the Masses ...
 
Branded Content: How to overcome players' immunity to advertising / Alex Brod...
Branded Content: How to overcome players' immunity to advertising / Alex Brod...Branded Content: How to overcome players' immunity to advertising / Alex Brod...
Branded Content: How to overcome players' immunity to advertising / Alex Brod...
 
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
Resurrecting Chasm: The Rift - A Source-less Remastering Journey / Gennadii P...
 
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
How NOT to do showcase events: Behind the scenes of Midnight Show / Andrew Ko...
 

Alternativa Platform: Flash-игры: переходим в третье измерение

  • 1. Flash GAMM Kyiv 2011. 10 декабря Flash GAMM Kyiv 2011. December, 10 AlternativaPhysics: физическая симуляция на Flash – это просто AlternativaPhysics: physics simulation on Flash is easy Дмитрий Сергеев, Программист, AlternativaPlatform Dmitriy Sergeev, Software Engineer, AlternativaPlatform
  • 2. План доклада Plan ● Введение ● Introduction ● Обзор функциональности ● Functionality review ● Обзор API ● API review ● Демо движка ● Engine demos
  • 3. Цель доклада Goal Показать, что: The goal is to show that: ● AlternativaPhysics – это ● AlternativaPhysics is a мощный и powerful and universal универсальный движок engine ● Использовать ● The usage of AlternativaPhysics просто AlternativaPhysics is easy
  • 4. Что такое физический движок? What is the physics engine? Физический движок Physics engine Объекты Objects Физическая сцена Physics scene Конфигурация События Configuration Events Геометрия Солвер Solver Geometry Силы Ограничения Forces Constraints Определение столкновений Collision Позиции, скорости Столкновения, контакты detection Positions, velocities Collisions, contacts
  • 5. История AlternativaPhysics The history of AlternativaPhysics http://tankionline.com
  • 6. Место физики в платформе Physics in the platform AlternativaPlatform Alternativa3D AlternativaCore AlternativaEditor AlternativaPhysics AlternativaGUI
  • 7.
  • 8. Функциональность Functionality ● Солвер ● Solver ● Геометрия ● Geometry
  • 9. Солвер Solver ● Улучшенная ● Improved stability стабильность ● Plausible simulation of ● Реалистичная elastic and resting симуляция упругих и contacts неупругих контактов ● Physic materials ● Физический материал ● elasticity (restitution) ● упругость ● friction ● трение
  • 10. Солвер. Стеки, материалы. Демо Solver. Stacks and materials. Demo
  • 11. Солвер. Ограничения Solver. Constraints ● Максимальное ● Max distance расстояние ● Fixed distance ● Фиксированное ● Ball-in-socket расстояние ● Rotational (hinge) ● Шаровое соединение (ball-in-socket) ● Вращательное (hinge)
  • 13. Геометрия. Примитивы Geometry. Primitives ● Плоские примитивы ● Flat primitives (triangle, (треугольник, квадрат) square) ● Объемные примитивы ● 3D primitives (ball, box, (шар, бокс, цилиндр, cylinder, cone, frustum) конус, усеченный конус)
  • 14. Геометрия. Сложные объекты Geometry. Complex Objects Произвольные тела: Arbitrary bodies: ● Выпуклый многогранник ● Convex polyhedron ● Треугольный меш ● Triangle mesh ● Иерархический контейнер ● Hierarchical container
  • 16. Геометрия. Другие особенности Geometry. Another Features ● Алгоритм GJK/EPA ● GJK/EPA algorithm ● Оптимизации ● Optimization ● широкая фаза ● broad phase ● статические объекты ● static objects ● Пересечение с лучом ● Ray casts
  • 17. Ограничения на число объектов Limitations on the Number of Objects ● Количество объектов – ● The number of objects – до 500 при большом up to 500 in case of a числе взаимодействий large amount of contacts ● Количество примитивов ● The number of primitives в статических объектах in static objects – – неограниченно unlimited
  • 18. API ● Сцена ● Physics scene ● Конфигурация ● Engine configuration движка ● Event handling ● Обработка событий
  • 19. Сцена. Иерархия объектов Scene. Hierarchy of Objects Сцена Scene Тело Нефизический объект Body Non-physical object Физический примитив Physical primitive Нефизический примитив Нефизический примитив Non-physical primitive Non-physical primitive •Материал •Material •Подвижность •Movability •Позиция •Position •Позиция •Position •Скорость •Velocity •События •Events •Масса •Mass •События •Events
  • 20. Сцена. Иерархия объектов Scene. Hierarchy of Objects private function PhysicsTest() { physicsScene = PhysicsConfiguration.DEFAULT.getPhysicsScene(); var body:Body = new Body(); var box:CollisionBox = new CollisionBox(new Vector3(1, 1, 1), CollisionType.DYNAMIC); body.addPhysicsPrimitive(new PhysicsPrimitive(box, 10, new PhysicsMaterial(0.5, 0.5))); body.calculateInertiaTensor(); physicsScene.add(body); body.setVelocity(new Vector3(1, 0, 0)); stage.addEventListener(Event.ENTER_FRAME, onEnterFrame); } private function onEnterFrame(event:Event):void { while (physicsScene.time < getTimer()) physicsScene.update(PHYSICS_STEP); ... }
  • 21. Сцена. Ограничения Scene. Constraints var boxCount:int = 3; var boxes:Vector.<Body> = new Vector.<Body>(boxCount); for (var i:int = 0; i < boxCount; i++) { boxes[i] = createBox(i); physicsScene.add(boxes[i]); } for (i = 0; i < boxCount - 1; i++) { var c:ImpulseConstraint = new HingeImpulseConstraint( boxes[i], boxes[i + 1], new Vector3(INTERVAL, 0, 0), Vector3.ZERO, new Vector3(0, 0, 1), new Vector3(0, 0, 1))) physicsScene.addConstraint(c); }
  • 22. Демо c 3 кубами 3 cubes demo
  • 23. Конфигурация движка Engine Configuration ● Конфигурация ● Geometry configuration геометрии ● Solver configuration ● Конфигурация солвера var physicsConfig:PhysicsConfiguration = new PhysicsConfiguration(); physicsConfig.geometryConfiguration = new GeometryConfiguration(); var solverConfig:ImpulseSolverConfiguration = ImpulseSolverConfiguration.DEFAULT.clone(); solverConfig.contactIterations = 4; physicsConfig.solverConfiguration = solverConfig; var physicsScene:PhysicsScene = physicsConfig.getPhysicsScene();
  • 24. События Events ● Предобработка сцены ● Before update (onBeforeUpdate) ● After update ● Постобработка сцены ● Contact (onAfterUpdate) ● With body ● Возникновение контакта ● WIth primitive ● С телом ● С примитивом
  • 25. События Events public class SimFlag extends SimObject { public function SimFlag(position:Position, onContact:Function) { ... cylinder = new CollisionCylinder(r, 3, CollisionType.TRIGGER); cylinder.addEventListener(ContactEvent.OnContact, onContact, this); ... } ... } public class BallDemo { public function BallDemo() { ... add(new SimFlag(Position.createXYZ(-4, -4, 0), takeFlag)); ... } private function takeFlag(event:ContactEvent):void { ... flag = (event.userData as SimFlag); flag.visible = false; } ... }
  • 26. Демо Ball and flags Ball and Flags Demo
  • 27. В разработке In Development ● Новые типы ограничений (slider, ● New constraints (slider, hinge-2, hinge-2, универсальный) universal joint) ● Параметризация ограничений ● Constraints' parameterization ● Новые примитивы (капсула, ● New primitives (capsule, ellipsoid) эллипсоид) ● New events (enter contact, leave ● Новые события (появление, contact) окончание контакта) ● Stabilization improvement ● Улучшение стабилизации ● Performance improvement ● Улучшение быстродействия ● Intergration with Alternativa3D ● Интеграция с Alternativa3D
  • 29. Спасибо за внимание Thanks for your attention пожалуйста, задавайте вопросы, пишите на sergeev@alternativaplatform.com please ask your questions, feel free to contact me: sergeev@alternativaplatform.com