13 RONIN - DevLog #3 - The movie analogy

posted in ERASERHEAD STUDIO for project 13 RONIN
Published June 06, 2018
Advertisement

Banner950x297

Here in Stockholm it's been unusually hot and dry for this season of the year and I'm quite convinced that the pharmacies have broken a new record in anti-histamine sales. Last night we were finally blessed with thunder and rain and today the air is cool and nice and the pollen gone.

I've sneezed quite a lot the last couple of weeks but I've also done some coding. My primary focus has been building an animation framework for use in intro, cutscenes and background movements and coding an editor for animating sprites. Ester (Eraserhead animation editor) will be the subject of an upcoming dev log and this dev log will be about the animation framework.

1076747577_Animationdemo180604.gif.5e60a76a65ad46047cdcf090856ed361.gif

This is an animation demo and not part of the game

Animation framework

The purpose of the animation framework is to ease setting up and running sequences of multiple animations. The need for this arose with my desire to create an animated intro with objects moving in different patterns. But I will also use this framework for pre- and post-fight-animations as well as background animations.

When finished the animation framework will contain:

  • Support for spritesheet-based animations
  • Builders for setting up animations by code
  • Simple script-language for setting up scenes
  • Loader and parser for script-files

In addition to this, I will probably build an editor to use with the script-language for trying out and previewing animations.

The movie analogy

When designing and naming the building blocks of the framework I've taken a "movie scene"-approach and used a nomenclature found in movie scripts. That gave me following main classes:

  • Scene
  • Actor
  • Action
  • Animation

"Animation" might not be a name known from movie scripts, but I kept the name to encourage its use outside of the "animated scene" context. As long as you keep track of calling the update- and draw-methods both actors and animations can be used without a scene.

Animation-Page-1.png.68a449c72c3ba33dd6676e81242cf5b6.png

A simplified diagram describing the relationships between the classes

Scene

Think of a scene just the like a scene in a movie or a theater. It's a "room" where something takes place. A scene can have a name, background image and any number of actors. You draw it on the screen by calling its Draw-method.

Animation_Demo_Background.png.fa866b4c68d9e5ec7fd27ce7d91966c1.png

Background for our demo

Actor

Unlike in a movie or theater, an actor is not only characters but all things living or dead that has it's own image and is separate from the background e.g. character, bullets flying, rising sun.

An actor has a location, it can be visible or hidden, and has a collection of actions to perform that can be looped when done. An actor also has an animation as it's current "gesture".

Action

Just like in the movies, an action is something an actor does, i.e. an actor will act according to its actions.

Some of the available actions are:

  • Show - draw animation
  • Hide - don't draw animation
  • SetPosition - set position of actor
  • BasicMove - move actor to destination with given velocity and acceleration
  • ChangeGesture - change animation

Animation

An animation is based on a spritesheet, start index in the sheet and a frame count. This determines how the actor will appear on the screen.

A note on naming. The property for the animation is named Gesture in the Actor-class, that is a choice I made to keep the movie analogy consistent. I've named the class Animation to encourage use of it outside of the "animated scene"-context.

Idle.gif.91480bbd157d95ee29f9584ef1d978a9.gif

Our famous actor doing one of it's gestures

How to

To create the scene in the demo above following steps have to be made:

  1. Load content
  2. Create an animation sheet configuration
  3. Create an animation factory
  4. Create an actor
  5. Create the scene
  6. Start the scene
  7. Draw scene

Step 1 - 5 can all be done in the Initialize-method of the Game-class.

Step 1 - Load content

As a first step we load background- and spritesheet-images as textures.


var background = Content.Load<Texture2D>("Animation_demo_background");
var texture = Content.Load<Texture2D>("Animation_demo_spritesheet");

Animation_Demo_Spritesheet.thumb.png.9f95467f2b19667dc9edb4ea9a302dea.png

The demo spritesheet

Step 2 - Create animation sheet configuration

Then we create a configuration describing animations found in the spritesheet. This object will later be used as argument to our animation factory.


var sheetConf =
  AnimSheetConfigBuilder
  .Begin()
  .Name("Samurai gestures")
  .GridSize(new Point(13, 4))
  .SpriteSize(new Point(160, 160))
  .DefaultFrameDuration(150)
  .AddAnimation("Idle", new Point(0, 0), 6)
  .AddAnimation("Bow", new Point(0, 3), 11)
  .AddAnimation("Draw", new Point(0, 2), 13)
  .AddAnimation("Walk wo sword", new Point(0, 1), 8)
  .AddAnimation("Walk w sword", new Point(0, 4), 8)
  .Build();

We create a configuration describing a spritesheet with a size of 13 columns and 4 rows where each sprite has a size of 160 x 160 pixels. The spritesheet is called "Samurai gestures" and default frame duration for all animations in this sheet is 150 milliseconds. It contains four different animations. Note that all names must be unique.

Step 3 - Create animation factory

When the sheet config is ready this step is easy. Call the AnimationFactory-constructor passing in the spritesheet texture and the sheet configuration. Our factory is ready.


var animFactory = new AnimationFactory(texture, sheetConf);

Step 4 - Create actor

Just as it takes some time for an actor to prepare for a big movie role, it takes some coding for us to set up the actor for our scene.


var actor =
  ActorBuilder
    .Begin(animFactory)
    .Actions(
      actionBuilder =>
      {
        return
          actionBuilder
            .Hide()
            .SetPosition(new Point(-120, -4))
            .ChangeAnimation("Walk wo sword")
            .LoopAnimation()
            .Show()
            .Move(new Point(-60, -4), 0.1f, 0.0f)
            .ChangeAnimation("Bow")
            .WaitForAnimation()
            .ChangeAnimation("Walk wo sword")
            .LoopAnimation()
            .Move(new Point(110, -4), 0.1f, 0.0f)
            .ChangeAnimation("Draw")
            .WaitForAnimation()
            .ChangeAnimation("Idle")
            .WaitForAnimation()
            .ChangeAnimation("Walk w sword")
            .LoopAnimation()
            .Move(new Point(312, -4), 0.1f, 0.0f)
            .Build();
      })
    .Build();

actor.Loop = true;

Here we use the ActorBuilder in combination with the ActionBuilder to create the actor and the collection of actions to perform. All these actions will be performed in sequence and when done the actions will, thanks to the "actor.Loop = true;" statement, be restarted.

Step 5 - Create scene

As a last building step we tie everything together by creating our scene, and for this, we also have a dedicated builder.


_scene =
  SceneBuilder
    .CreateScene(animFactory)
    .Name("Demo")
    .Background(background)
    .AddActor(actor)
    .Build();

  Our scene is now ready.

Step 6 - Start scene

If you run the project you'll find that nothing happens. That's because we haven't included the scene in the game loop yet.

Add following lines to the Update-method:


if (_scene.State == State.NotStarted)
	_scene.Start();
_scene.Update(gameTime);

Step 7 - Draw scene

Still, nothing happens. It's because we're still not drawing the scene. And following line to the Draw-method:


_scene.Draw(_spriteBatch, Vector2.Zero);

Run the project and enjoy!

The future

You're as always more than welcome to download the code and use it in any way you like, but since it's still early days please regard it more as inspiration than a working framework. I'm sure there are lots of bugs. And changes will come.

If not discouraged, visit my BitBucket-account and get going, or wait for an announcement of a more stable version.

Please visit Eraserhead Studio for more.

 

Happy coding!

/jan.

Avatar_transparent_background.png.f044a47dac917fdb89bbba1949a8207a.png

NOTE. As always, everything I publish here or on any other site is work in progress and subject to change.

 

0 likes 74 comments

Comments

shichibukairai

This is quite interesting. You can also watch your favorite movies at the teatv techbigs app

May 06, 2020 03:19 AM
scarletmichelle

@shichibukairai It's great and you can download the melodies in this game with different genres at Worldringtones.

December 17, 2020 07:30 AM
foxy0

Express VPN Crack Express VPN Crack With Activation Code Read the complete guild on How to activate Express Vpn Free,...

August 21, 2020 02:14 PM
JohnKu

This is a nice, just like the subway surfers game. Interesting!

August 27, 2020 12:55 PM
foxy0

Showbox APK Android
Showbox APK Android Read the complete guild on how to Download Showbox APK Android, a direct link to download Showbox APK Android, How To Download And Install Showbox APK Android and the Best way to Install Showbox APK 2020 On Android, all this information is provided below on this article As at TecroNet Updates. What …

August 30, 2020 07:01 AM
Muzamil123

This is good. See This: WhatsApp plus apk

September 08, 2020 01:23 PM
Muzamil123

This is good. See This: WhatsApp plus apk

September 08, 2020 01:26 PM
olowo

How to Check Each School’s Post UTME / DE Form and Admission Screening Details

Follow the procedure below to check your school’s post-UTME details:

  1. Scroll down on this page to locate your school or choice institution(s).
  2. Click on the link represented by the name of your choice institution(s)).
  3. Follow the procedure in the page that opens thereafter.
September 20, 2020 03:22 AM
singhniraml

The latest version of YoWhatsApp packs some rather interesting quirks and features. Have a look at the newly released change log for its latest update.

September 20, 2020 02:57 PM
harmeen

I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post. https://computerdeskcorner.com/vioc-pos/

September 24, 2020 12:31 AM
hegmannkris

Have you announced this game yet? I was curious about the sound effects of it. I would to make a sonnerie portable gratuite with it.

September 24, 2020 03:39 AM
olowo

How Does Dropshipping Work?

With this basic definition in mind, let’s break down how dropshipping works in a little more detail.

Overall, there are three parties involved in the dropshipping business model of eCommerce—you, the retailer, the customer, and the supplier or manufacturer.

The dropshipping process, therefore, can be summed up like this:

  • A customer buys a product on your e-commerce website.
  • You send the order information to your dropship supplier.
  • The supplier picks, packs, and ships the product directly to the customer.
October 06, 2020 04:40 AM
coolastrology

Loved to read your blog. I like the significant data you give in your articles. I am impressed the manner in which you introduced your perspectives and appreciating the time and exertion you put into your blog.

929 Angel Number

1233 Angel Number

October 08, 2020 04:31 PM
dragondev

Download the latest version of FAUG Game APK The most awaited Android Game in India

October 25, 2020 09:04 PM
iqbal3321

This is Good To See. Thanks For Sharing: NameBio

October 29, 2020 11:30 AM
Gameboy555

GBWhatsapp have stop working, There are many mod version of WhatsApp which includes FM Whatsapp, OGWhastapp, GB Whatsapp and Whatsapp Plus. Download Game of sultans mod APK You can download any of these apps from this website. I will focus on You WhatsApp app, modified WhatsApp version. How to get GTBank loan is very important and will boost your business startups

November 05, 2020 09:09 AM
christopherrrrr

The best part using of using Facebook messenger for receiving money is that Facebook never holds the money, instead, it will be immediately transferred to the debit or PayPal account that was linked to your Facebook messenger app and not forgets, both parties will be notified when the statues of a transaction changes

HOW TO RECEIVE FACEBOOK PAYMENT

November 07, 2020 11:53 PM
LefflerHirthe

I found a few sound files of this game as dzwonek na telefon. Do you like it?

November 13, 2020 06:51 AM
harshith

This is quite interesting. You can also download and watch your favourite movies at 10 Best Free Movie Download Apps these apps

November 19, 2020 04:28 PM
tuikeda003

Thanks for sharing this helpful & wonderful post.

Get Latest Tech News And Reviews Also Get Premium Apps At ModLooters For FREE.

November 22, 2020 04:25 PM
Moroakhanna

I really appreciate your hard work. this is very useful & informative for me.

Get Premium Apps And Games Here.

Moviebox Pro & Watch Premium Movies

MBit Premium Apk

​XEFX Mod

B612 Mod APK

Octopus Mod

FaceApp Pro

IMO Pro Mod

Poweramp Pro

X Vpn Pro

November 22, 2020 04:33 PM
sumenjule

You can download all type of mod APK from this platform for free.

Premium APK Spot said in a blog post

Premium APK Spot quotes

Real Racing 3 in mod APK

November 24, 2020 03:28 PM
EichmannCharity

I am very curious about the sound part of this game. I think we are up to use it as klingeltöne

December 02, 2020 09:04 AM
sagarsinghji

your work is really appreciable. may i know how to download it?

LIC Agent

December 19, 2020 11:48 AM
quadri

You dev are giving android users an opportunity to explore the android world better. Thanks ?Ladmods Mod Apk. Enttechub mod apk

March 26, 2021 03:12 PM
aoifeawen

Thanks ?

There is also a cool Naruto Senki game

https://www.narutosenki.com

March 27, 2021 07:15 AM
9animeshow

Can you recommend a good hosting provider at a honest price?

Many thanks, I appreciate it! For More Please 9anime

March 28, 2021 04:22 PM
9animeshow

I must say this blog loads a lot faster then most. Can you recommend a good hosting provider at a honest price? Many thanks, I appreciate it! Fore More Please

kissasian running man

kickassanime nagatoro

redo of healer chia anime

May 09, 2021 09:25 PM
manobali

watch movies whenever and whereever you want by downloading unlockmytv.

May 15, 2021 05:07 AM
ogbeide

The term “video game developer” is often used interchangeably with “video game programmer,” the person who writes the game code that makes the video game function. Video game development is also sometimes used as an umbrella term for anyone that participates in the dhttps://bestmarket.com.ng/2019/06/payoneer-how-to-add-your-local-bank-account-withdrawal/evelopmhttps://bestmarket.com.ng/2019/06/payoneer-how-to-add-your-local-bank-account-withdrawal/ent process of a video game, including game artists, sound designers, and testers.

May 18, 2021 11:23 PM
ogbeide

Where and How to Get a Small Personal Loan for game vevelopment

May 18, 2021 11:25 PM
ogbeide

game developers may contribute to various stages of video game development, but are mostly charged with building a workable version of the game through computer code. Game coders turn concepts into a tangible form

May 18, 2021 11:27 PM
ogbeide

How to Become a Video Game Developer

A bachelor’s degree in software engineering or computer science can help you stand out to employers

2, full understanding of the game development process from concept to publishing

3.Know your computer languages

4, Build a portfolio. The best way to become a game developer is to develop your own game

May 18, 2021 11:33 PM
itzzadams

Thanks for the good post besthealthtrips

June 14, 2021 06:03 AM
Thisweek

Check out the week 52 Pool Result 2021 if you staked this week and know if your game cut or enter in this week pool result.

Here, we bring the latest news and updates from all the campuses in Nigeria. We publish news from all Nigerian Universities, Polytechnics, Monotechnics, Colleges of Education and other allied educational institutions.

WAEC Timetable 2022/2023 For May/June Examinations: Check & Download Waec Timetable 2022/2023 & New WAEC timetable 2022 PDF: WAEC Timetable 2022 PDF download.

Check WAEC Result for May/June Examination For 2022/2023

July 12, 2021 04:34 AM
9animesafe

I am Very Thanks Full To You For Providing That Best Information

animedao

shin no nakama kickassanime

November 12, 2021 04:05 PM
gochi88

I really appreciate the kind of topics you post here. Thanks for sharing us a piece of great information that is actually helpful. Good day! Mini Militia Mod APK , PicsArt Mod APK, truecaller gold mod.

November 26, 2021 03:22 PM
Typingtestapp

Nice post. I found this is an informative and interesting post, so i think it is very useful and knowledgeable. I am glad to read this post hope your next article is are so useful for me so you are meet in next process for more information click this link below: -

Typing Speed Test Online

Online Typing Test-4

Online Typing Practice Test

Typing Master Online Test English

Chsl Typing Test Online

English Typing Test Practice

Online Typing Test-1 Minutes

Typing Test Online Practice

Online Typing Test-10 Fast Finger

Typing Test Speed Online English

Kannada Typing Test

Raavi Font Typing Test

Typing Test-30- Minutes

Typing Test For-10 Minutes

Typing Test App

Sweta…………

December 24, 2021 06:37 AM
scholarshipsform

I have never seen such blogs ever before that have completed things with all details I want.

Scholarship

NSP Portal 2 0

WWW Scholarship Gov In

NSP Scholarship Amount

Post Matric

TN Scholarship

E District HP

NSP

Sinkoth :-)

December 27, 2021 05:51 AM
digitalseva

This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information. S.Gupta

sala-darpan

Digital Seva

CSC Digital seva

E- District Login

Eaadhar

District Login

NFSA

PFMS

NSp Login

Service Plus

Bhoomi Online

OFFSS

Digital India Portal

PMG Disa Login

Download Aadhar Card

S.Gupta

December 28, 2021 06:31 AM
digitalseva

Nice post, Thanks for this information. I really appreciate the kind of topics you post here. Thanks for sharing with us a great information that is actually helpful. I posted some helpful links can you check them for a second?

CEO Full Form

KYC Full Form

CNG Full Form

Radar Full Form

IAS Full Form

UGC Full Form

KPO Full Form

IT Full From

PCB Full Form

PGDCA Full Form

KPMG Full Form

CSV Full Form

KGF Full Form

SSLC Full Form

ETC Full Form

AM Full Form

INR Full Form

AMC Full Form

ASCII Full Form

STD Full Form

MS Full Form

PNG Full Form

PS Full Form

S.Gupta

December 28, 2021 06:32 AM
digitalseva

Thank you for sharing. Excellent post…! It is a very great idea and unique content. Thank you so much.

AISHE Login

Jan Aadhar Card

Uidai Exam

Pmjay CSC

Pmjay CSCCLOUD In

Sinkoth :-)

March 31, 2022 05:28 AM
ElliotThomas

I enjoyed reading your blog. I appreciate the useful information you provide in your writings. I like the time and effort you put into your blog and am pleased with the way you presented your views.

707 angel number twin flame

414 angel number twin flame

April 12, 2022 02:35 AM
tyler23

Most of the people like Pokemon Go Mod APK and choices mod apk apps on android.

April 27, 2022 04:55 PM
enin18

Thanks, Article was sooooo cool and take care always. Watch Wrestling Online

May 06, 2022 05:53 PM
Kickassanime

I am Very Very Thanks Full To You For Proving That Best Information. I Like That type of thing Like Tales Of Demons And Gods Manga.

May 24, 2022 12:00 PM
Identifiedcall

Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC.

NEBSIT

Job Application

Free Computer Institute Registration in India

computer courses franchise in India

Contact us

S.Gupta

August 09, 2022 11:59 AM
Identifiedcall

Really I enjoy your site with effective and useful information. It includes a very nice post with a lot of our resources. thanks for sharing. I enjoy this post.

STS Karnataka

Labour Registration

E- District Kerala

SSA Gujrat Updated

Digital Seva

CSC Login

Meebhoomi Updated

PMAY CSC Login Update

S.Gupta

August 30, 2022 09:17 AM
Identifiedcall

I also used the same device, I find it very easy to work on as a blogger who owns several websites in the gluten free niche, I think this is a good device and also I use the PicsArt app as well with no issues. Sorry I can't help more.

NSP Portal

NSP Scholarship Renewal

National Scholarship Last Date 2022

NSP National Scholarship

NSP Scholarship List 2022

Last Date NSP Scholarship 2022

National Scholarship Portal

NSP Portal

NSP Scholarship Renewal

National Scholarship Last Date 2022

NSP National Scholarship

NSP Scholarship List 2022

Last Date NSP Scholarship 2022

National Scholarship Portal

NSP Updated

S.Gupta

August 30, 2022 09:19 AM
Identifiedcall

Very interesting article my friend Arthur. Link Building is a very important process in creating authority on blogs, so it is essential to use tools like the ones mentioned above. I'll save the page for future reading :)

Number Location Tracker

Moblile Phone Location

Track Locational

Last Location

Mobile Phone Number Search

Mobile No Tracking 2

Mobile Number Tracker

S.Gupta

August 30, 2022 09:20 AM
company2

Thanks for providing this excellent platform. Nowadays, Laptops are prefer over desktop because of portability. There are so many good laptops are available. But for gaming, only few are capable to run the heavy games. Therefore the best gaming laptop should be consider for heavy games

Srk Home Address

Mayawati Phone Number

Dda Vikas Sadan Telephone Directory

Fullonsms New User Registration

Sbi Chairman Address

What Is Virat Kohli Phone Number

Vijay Sethupathi Contact Number

Shine Com Delhi Office Address

Khesari Lal Yadav Contact Number

Mr.Abhizit…..

September 10, 2022 09:17 AM
contact9

Really I enjoy your site with effective and useful information. It includes a very nice post with a lot of our resources.thanks for sharing. I enjoy this post.

Mcu Full Form

Mnc Full Form

Cmo Full Form

Pte Full Form

Aissce Full Form

Mpeg Full Form

Dbt Full Form

Cpa Full Form

Mr.Abhizit…..

September 10, 2022 09:24 AM
typingspeed

Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.

Typing In Numeric

Speed Type Speed typing benefits

Speed Typing test online updated

Speed online test typing typing test app

type online

Speed typing online

typing master online typing test

english typing test free

Savitri Singh

September 21, 2022 11:02 AM
digitalindia01

Thank you so much for the post you do. I like your post and all you share with us is up to date and quite informative, i would like to bookmark the page so i can come here again to read you, as you have done a wonderful job.

Ration card list of

India post agent

DBT portal

CSC maha online- 2022-23

CSC login- 2022- 23

Parivahan seva

Integrated shala darpan

Savitri Singh

September 21, 2022 11:07 AM
Identifiedcall

Thanks for providing this excellent platform. Nowadays, Laptops are preferred over desktops because of portability. There are so many good laptops available. But for gaming, only a few are capable to run heavy games. Therefore the best gaming laptop should be considered for heavy games

Ration card list of

India post agent

DBT portal

CSC maha online- 2022-23

CSC login- 2022- 23

Parivahan seva

Integrated shala darpan

S.Gupta

September 23, 2022 06:38 AM
companydetail

Thanks for providing this excellent platform. Nowadays, Laptops are prefer over desktop because of portability. There are so many good laptops are available. But for gaming, only few are capable to run the heavy games. Therefore the best gaming laptop should be consider for heavy games

Jayalalita Email ID

Contact Yogi

Shopclues Office

Reliance Jio

Arvind

Holachef Contact

Ravi Kumar

Act Fibernet

Mr.Abhizit….

September 24, 2022 05:16 AM
aadhaarcard03

Really I enjoy your site with effective and useful information. It includes a very nice post with a lot of our resources.thanks for sharing. I enjoy this post.

UIDAI Mobile

UIDAI CEO

UIDAI Customer

UIDAI Troll

UIDAI Virtual ID

UIDAI Check

UIDAI Chaimen

Aadhar Card loan

Mr.Abhizit…..

September 24, 2022 05:21 AM
Identifiedcall
September 30, 2022 10:31 AM
Identifiedcall
September 30, 2022 10:33 AM
vipomod

You android devs are giving users an opportunity for the android world to explore better For namesake apk. Thanks!

October 12, 2022 12:38 PM
Identifiedcall

Really I enjoy your site with effective and useful information. It includes a very nice post with a lot of our resources. thanks for sharing. I enjoy this post.

Digital India Portal

Digital India Login

Data Entry

CSC Digital India

Digitize-India Platform

Digitize India Registration

STS Karnataka

SSA Gujrat

Digital Seva

S.Gupta

October 18, 2022 11:46 AM
Identifiedcall

I also used the same device, I find it very easy to work on as a blogger who owns several websites in the gluten-free niche, I think this is a good device and also I use the PicsArt app as well with no issues. Sorry, I can't help more.

NSP Last Date

NSP Portal

PFMS NSP

NSP Tracker

NSP Gov In

NSP Scholarship

NSP 2.0

How To Apply

NSP Login

NSP Login Update

S.Gupta

October 18, 2022 11:52 AM
Identifiedcall

Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC

SSP Scholarship

NSP 2022

National Portal

National Portal

National Scholarship

Scholarship National

National Scholarship

Scholarship Portal

NSP Portal

NSP Scholarship

S.Gupta

October 18, 2022 11:54 AM
Identifiedcall

Thank you for sharing. Excellent post…! It is a very great idea and unique content. Thank you so much.

Cell Phone

Free Tracker

Phone Number

Phone Tracker

IMEI Find Number

IMEI Checker

Phone Number

Mobile Phone

Mobile Tracker

Mobile Number

S.Gupta

October 18, 2022 11:56 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement