The document provides an overview of making games using JavaScript, HTML, and the DOM. It discusses JavaScript and HTML5 as languages well-suited for game development due to features like fast iteration, treating scripts as data, and allowing different game types. It covers key concepts like the DOM tree, rendering to a <canvas> element, using the 2D context to draw, implementing a main loop with setInterval(), drawing sprites and images, handling user input, and creating basic animations and games with concepts like sprites, matrices, vectors, bullets, and zombies.
This presentation introduces developers to the functionality of the HTML5 canvas tag. It runs from getting started (slow start) to more comprehensive examples designed to be inspirational in nature. This presentation is not designed to make you an expert with canvas, but to introduce developers to the wealth of possibilities.
This presentation introduces developers to the functionality of the HTML5 canvas tag. It runs from getting started (slow start) to more comprehensive examples designed to be inspirational in nature. This presentation is not designed to make you an expert with canvas, but to introduce developers to the wealth of possibilities.
These slides have been presented in a lecture about promises at the SphereIT conference on Octobere 19th 2019.
Author: Mateusz Bryła (https://www.linkedin.com/in/mateusz-bryła-78aa1572/)
Dreamer, programmer, consultant, trainer. Founder at Lingmates, Team Lead at Codete.
These slides have been presented in a lecture about promises at the SphereIT conference on Octobere 19th 2019.
Author: Mateusz Bryła (https://www.linkedin.com/in/mateusz-bryła-78aa1572/)
Dreamer, programmer, consultant, trainer. Founder at Lingmates, Team Lead at Codete.
Excella Consultings's Doguhan Uluca discusses delivering a responsive and modern Web client based on emerging technologies in an MVVM architecture, such as Breeze, Knockout, Require with Javascript unit testing and Automated Acceptance Testing.
In this session, Aaron Gustafson introduces attendees to the client-side scripting language known as JavaScript. After being taken on a quick tour through the language's features and syntax, attendees will be introduced through a series of examples to ways in which JavaScript can progressively enhance the user experience and really make their designs sing. This session also introduces attendees to several JavaScript libraries and demonstrate how to execute the same task in each.
JavaScript Advanced - Useful methods to power up your codeLaurence Svekis ✔
Get this Course
https://www.udemy.com/javascript-course-plus/?couponCode=SLIDESHARE
Useful methods and JavaScript code snippets power up your code and make even more happen with it.
This course is perfect for anyone who has fundamental JavaScript experience and wants to move to the next level. Use and apply more advanced code, and do more with JavaScript.
Everything you need to learn more about JavaScript
Source code is included
60+ page Downloadable PDF guide with resources and code snippets
3 Challenges to get you coding try the code
demonstrating useful JavaScript methods that can power up your code and make even more happen with it.
Course lessons will cover
JavaScript Number Methods
JavaScript String Methods
JavaScript Math - including math random
DOMContentLoaded - DOM ready when the document has loaded.
JavaScript Date - Date methods and how to get set and use date.
JavaScript parse and stringify - strings to objects back to strings
JavaScript LocalStorage - store variables in the user browser
JavaScript getBoundingClientRect() - get the dimensions of an element
JavaScript Timers setTimeout() setInterval() requestAnimationFrame() - Run code when you want too
encodeURIComponent - encoding made easy
Regex - so powerful use it to get values from your string
prototype - extend JavaScript objects with customized powers
Try and catch - perfect for error and testing
Fetch xHR requests - bring content in from servers
and more
No libraries, no shortcuts just learning JavaScript making it DYNAMIC and INTERACTIVE web application.
Step by step learning with all steps included.
need help with code I wrote. This code is a maze gui, and i need hel.pdfarcotstarsports
need help with code I wrote. This code is a maze gui, and i need help with the method
shorterstpath(); here is my code:
******mazeApp*******
package mazepackage;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.TextInputDialog;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
public class MazeApp extends Application
{
// default canvas size is DEFAULT_SIZE-by-DEFAULT_SIZE
private static final int DEFAULT_SIZE = 768;
private int width = DEFAULT_SIZE;
private int height = DEFAULT_SIZE;
// The graphics context is needed to enable drawing on the canvas
private GraphicsContext gc;
// boundary of drawing canvas, 0% border
// private static final double BORDER = 0.05;
private static final double BORDER = 0.00;
private double xmin, ymin, xmax, ymax;
public static void main(String[] args)
{
launch(args);
}
@Override
public void start(Stage primaryStage)
{
Group root = new Group();
Canvas canvas = new Canvas(width, height);
gc = canvas.getGraphicsContext2D();
gc.setLineWidth(2);
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, width, height);
root.getChildren().add(canvas);
TextInputDialog tid = new TextInputDialog();
tid.setTitle(\"Maze Size\");
tid.setHeaderText(\"Enter maze size between 10 and 50\");
tid.showAndWait();
int size = Integer.parseInt(tid.getResult());
if (size > 50)
size = 50;
if (size < 10)
size = 10;
primaryStage.setTitle(\"Maze Application\");
primaryStage.setScene(new Scene(root));
primaryStage.setResizable(false);
// Make sure that the application goes away when then window is closed
primaryStage.setOnCloseRequest(e -> System.exit(0));
primaryStage.show();
Maze maze = new Maze(this, size);
// Must solve the maze in a separate thread or else
// the GUI wont update until the end.....
Thread solver = new Thread(
new Runnable () {
public void run()
{
while(true)
{
maze.buildAndDrawMaze();
maze.findShortestPath();
try
{
Thread.sleep(5000);
}
catch(Exception e) { }
gc.setFill(Color.WHITE);
gc.fillRect(0, 0, width, height);
}
}
});
solver.start();
}
/**
* Sets the pen color to the specified color.
*
* @param color the color to make the pen
*/
public void setPenColor(Color color) {
gc.setStroke(color);
}
/**
* Sets the pen color to the specified color.
*
* @param color the color to make the pen
*/
public void setFillColor(Color color) {
gc.setFill(color);
}
/**
* Sets the x-scale to the specified range.
*
* @param min the minimum value of the x-scale
* @param max the maximum value of the x-scale
* @throws IllegalArgumentException if {@code (max == min)}
*/
public void setXscale(double min, double max) {
double size = max - min;
if (size == 0.0) {
throw new IllegalArgumentException(\"the min and max are the same\");
}
xmin = min - BORDER * size;
xmax = max + BORDER * size;
}
/**
* Sets the y-scale to the specified range.
*
* @param min the minimum valu.
Useful Tools for Making Video Games - XNA (2008)Korhan Bircan
A presentations I gave back in 2008 when I was the teaching assistant for Innovating Game Development course in Brown University.
This is an introductory tutorial of Microsoft XNA Game Studio. I talk about displaying 3D models, handling keyboard and mouse input, 3rd person shooter camera, and creating spline animations.
2014 yılının sonunda sonlandırılması beklenen HTML standardının 5. sürümü çoktandır tarayıcılar tarafından destekleniyor. HTML5 ile gelen Canvas, Websockets ve diğer özelliklerle nasıl daha canlı, daha Flash uygulamalarına benzer, web uygulamaları geliştirebileceğimizi inceledik.
This is Java,I am currently stumped on how to add a scoreboard for.pdfanjandavid
This is Java,
I am currently stumped on how to add a scoreboard for my game that I am making. I have
inclued my code and classes so far. Any help with a working scoreboard would be greatly
apperiacted.
Game.java
import javax.swing.JFrame;
public class Game {
public static void main(String[] args)
{
// create the frame
JFrame myFrame = new JFrame(\"Platformer\");
// set up the close operation
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// create panel
Mainpanel myPanel = new Mainpanel();
// add panel
myFrame.getContentPane().add(myPanel);
// pack
myFrame.pack();
// set visibility to true
myFrame.setVisible(true);
}
}
Mainpanel.java
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.ArrayList;
import java.util.Random;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.Timer;
public class Mainpanel extends JPanel implements KeyListener, ActionListener{
private final int boardWidth =1000;
private final int boardHeight =1000;
int x = 0;
int y = 0;
int i= 0;
int goldCount=11;
int score = 0;
ImageIcon myIcon = new ImageIcon(\"./src/TreasureChest.png\");
Timer mainTimer;
player player1;
player player2;
static ArrayList treasure = new ArrayList();
Random rand = new Random();
public String ScoreCount = \"Score: \" + score;
public Mainpanel()
{
setPreferredSize(new Dimension(boardWidth,boardHeight));
addKeyListener(this);
setFocusable(true);
player1= new player (100,100);
player2= new player (200,200);
addKeyListener(new move(player1));
addKeyListener(new move(player2));
mainTimer = new Timer(10,this);
mainTimer.start();
startGame();
}
JLabel scoreLabel = new JLabel(\"Score: 0\");
public void paintComponent(Graphics page)
{
super.paintComponent(page);
Graphics2D g2d =(Graphics2D) page;
player1.draw(g2d);
player2.draw(g2d);
g2d.
g2d.setColor(new Color(128, 128, 128));
g2d.fillRect(0, 0, 50, 1000);
g2d.setColor(new Color(128, 128, 128));
g2d.fillRect(950, 0, 50, 1000);
g2d.setColor(new Color(128, 128, 128));
g2d.fillRect(50, 0, 900, 50);
g2d.setColor(new Color(128, 128, 128));;
g2d.fillRect(50, 950, 900, 50);
for (int i=0 ; i < treasure.size(); i++){
Gold tempGold = treasure.get(i);
tempGold.draw(g2d);
}
}
public void actionPerformed (ActionEvent arg0){
player1.update();
repaint();
}
@Override
public void keyPressed(KeyEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(KeyEvent arg0) {
// TODO Auto-generated method stub
}
@Override
public void keyTyped(KeyEvent arg0) {
// TODO Auto-generated method stub
}
public void addGold(Gold g){
treasure.add(g);
}
public static void removeGold (Gold g) {
treasure.remove(g);
}
public static ArrayList getGoldList() {
return treasure;
}
public void startGame() {
for (int i=0; i < goldCount; i++){
addGold(new Gold(rand.
ObjectiveCreate a graphical game of minesweeper IN JAVA. The boar.pdfrajkumarm401
Objective:
Create a graphical game of minesweeper IN JAVA. The board should consist of 10x10 buttons.
Of the 100 spaces there should be at least 20 randomly placed mines. If the button is clicked and
it is not a mine then it clears itself. If a space has been cleared then it should indicate how many
of its eight neighbors are mines. If a space is clicked and it is a mine then the game is over and
the player is asked if they want to play again. Finally, if all the non-mine spaces have been
clicked then the player is prompted that they won.
Solution
2 files need to be made.
First Game.Java which will have the gaming logic and User Interface and Main.Java which will
have have the main method and object of Game.java Number of rows and cols is customizable so
user can change that as and when needed.
import java.awt.*;
import java.awt.Dimension;
import javax.swing.*;
import java.awt.event.*;
import java.util.*;
public class Game extends JFrame implements ActionListener, ContainerListener {
int fw, fh, blockr, blockc, var1, var2, num_of_mine, detectedmine = 0, savedlevel = 1,
savedblockr, savedblockc, savednum_of_mine = 10;
int[] r = {-1, -1, -1, 0, 1, 1, 1, 0};
int[] c = {-1, 0, 1, 1, 1, 0, -1, -1};
JButton[][] blocks;
int[][] countmine;
int[][] colour;
ImageIcon[] ic = new ImageIcon[14];
JPanel panelb = new JPanel();
JPanel panelmt = new JPanel();
JTextField tf_mine, tf_time;
JButton reset = new JButton(\"\");
Random ranr = new Random();
Random ranc = new Random();
boolean check = true, starttime = false;
Point framelocation;
Stopwatch sw;
MouseHendeler mh;
Point p;
Game() {
super(\"Game\");
setLocation(400, 300);
setic();
setpanel(1, 0, 0, 0);
setmanue();
sw = new Stopwatch();
reset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
sw.stop();
setpanel(savedlevel, savedblockr, savedblockc, savednum_of_mine);
} catch (Exception ex) {
setpanel(savedlevel, savedblockr, savedblockc, savednum_of_mine);
}
reset();
}
});
setDefaultCloseOperation(EXIT_ON_CLOSE);
show();
}
public void reset() {
check = true;
starttime = false;
for (int i = 0; i < blockr; i++) {
for (int j = 0; j < blockc; j++) {
colour[i][j] = \'w\';
}
}
}
public void setpanel(int level, int setr, int setc, int setm) {
if (level == 1) {
fw = 200;
fh = 300;
blockr = 10;
blockc = 10;
num_of_mine = 10;
} else if (level == 2) {
fw = 320;
fh = 416;
blockr = 16;
blockc = 16;
num_of_mine = 70;
} else if (level == 3) {
fw = 400;
fh = 520;
blockr = 20;
blockc = 20;
num_of_mine = 150;
} else if (level == 4) {
fw = (20 * setc);
fh = (24 * setr);
blockr = setr;
blockc = setc;
num_of_mine = setm;
}
savedblockr = blockr;
savedblockc = blockc;
savednum_of_mine = num_of_mine;
setSize(fw, fh);
setResizable(false);
detectedmine = num_of_mine;
p = this.getLocation();
blocks = new JButton[blockr][blockc];
countmine = new int[blockr][blockc];
colour = new int[blockr][blockc];
mh = new MouseHendeler();
getContentPane().removeAll();
panelb.removeAll();
tf_mine = new JTe.
Writing a Space Shooter with HTML5 CanvasSteve Purkis
This talk reviews a Space Shooter game that I wrote to learn about HTML5 canvas. It covers:
* Basics of canvas 2D
* Overview of how the game is put together
* Some performance tips
First presented @ Ottawa JavaScript in September 2012.
Need an detailed analysis of what this code-model is doing- Thanks #St.pdfactexerode
Need an detailed analysis of what this code/model is doing. Thanks
#Step 1: Import the required Python libraries:
import numpy as np
import matplotlib.pyplot as plt
import keras
from keras.layers import Input, Dense, Reshape, Flatten, Dropout
from keras.layers import BatchNormalization, Activation, ZeroPadding2D
from keras.layers import LeakyReLU
from keras.layers.convolutional import UpSampling2D, Conv2D
from keras.models import Sequential, Model
from keras.optimizers import Adam,SGD
from keras.datasets import cifar10
#Step 2: Load the data.
#Loading the CIFAR10 data
(X, y), (_, _) = keras.datasets.cifar10.load_data()
#Selecting a single class of images
#The number was randomly chosen and any number
#between 1 and 10 can be chosen
X = X[y.flatten() == 8]
#Step 3: Define parameters to be used in later processes.
#Defining the Input shape
image_shape = (32, 32, 3)
latent_dimensions = 100
#Step 4: Define a utility function to build the generator.
def build_generator():
model = Sequential()
#Building the input layer
model.add(Dense(128 * 8 * 8, activation="relu",
input_dim=latent_dimensions))
model.add(Reshape((8, 8, 128)))
model.add(UpSampling2D())
model.add(Conv2D(128, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(UpSampling2D())
model.add(Conv2D(64, kernel_size=3, padding="same"))
model.add(BatchNormalization(momentum=0.78))
model.add(Activation("relu"))
model.add(Conv2D(3, kernel_size=3, padding="same"))
model.add(Activation("tanh"))
#Generating the output image
noise = Input(shape=(latent_dimensions,))
image = model(noise)
return Model(noise, image)
#Step 5: Define a utility function to build the discriminator.
def build_discriminator():
#Building the convolutional layers
#to classify whether an image is real or fake
model = Sequential()
model.add(Conv2D(32, kernel_size=3, strides=2,
input_shape=image_shape, padding="same"))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(64, kernel_size=3, strides=2, padding="same"))
model.add(ZeroPadding2D(padding=((0,1),(0,1))))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
model.add(Conv2D(128, kernel_size=3, strides=2, padding="same"))
model.add(BatchNormalization(momentum=0.82))
model.add(LeakyReLU(alpha=0.2))
model.add(Dropout(0.25))
model.add(Conv2D(256, kernel_size=3, strides=1, padding="same"))
model.add(BatchNormalization(momentum=0.8))
model.add(LeakyReLU(alpha=0.25))
model.add(Dropout(0.25))
#Building the output layer
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
image = Input(shape=image_shape)
validity = model(image)
return Model(image, validity)
#Step 6: Define a utility function to display the generated images.
def display_images():
# Generate a batch of random noise
noise = np.random.normal(0, 1, (16, latent_dimensions))
# Generate images from the noise
generated_images = generator.predict(noise)
# Rescale the images to 0.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
A tale of scale & speed: How the US Navy is enabling software delivery from l...sonjaschweigert1
Rapid and secure feature delivery is a goal across every application team and every branch of the DoD. The Navy’s DevSecOps platform, Party Barge, has achieved:
- Reduction in onboarding time from 5 weeks to 1 day
- Improved developer experience and productivity through actionable findings and reduction of false positives
- Maintenance of superior security standards and inherent policy enforcement with Authorization to Operate (ATO)
Development teams can ship efficiently and ensure applications are cyber ready for Navy Authorizing Officials (AOs). In this webinar, Sigma Defense and Anchore will give attendees a look behind the scenes and demo secure pipeline automation and security artifacts that speed up application ATO and time to production.
We will cover:
- How to remove silos in DevSecOps
- How to build efficient development pipeline roles and component templates
- How to deliver security artifacts that matter for ATO’s (SBOMs, vulnerability reports, and policy evidence)
- How to streamline operations with automated policy checks on container images
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
In his public lecture, Christian Timmerer provides insights into the fascinating history of video streaming, starting from its humble beginnings before YouTube to the groundbreaking technologies that now dominate platforms like Netflix and ORF ON. Timmerer also presents provocative contributions of his own that have significantly influenced the industry. He concludes by looking at future challenges and invites the audience to join in a discussion.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfPaige Cruz
Monitoring and observability aren’t traditionally found in software curriculums and many of us cobble this knowledge together from whatever vendor or ecosystem we were first introduced to and whatever is a part of your current company’s observability stack.
While the dev and ops silo continues to crumble….many organizations still relegate monitoring & observability as the purview of ops, infra and SRE teams. This is a mistake - achieving a highly observable system requires collaboration up and down the stack.
I, a former op, would like to extend an invitation to all application developers to join the observability party will share these foundational concepts to build on:
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...Neo4j
Leonard Jayamohan, Partner & Generative AI Lead, Deloitte
This keynote will reveal how Deloitte leverages Neo4j’s graph power for groundbreaking digital twin solutions, achieving a staggering 100x performance boost. Discover the essential role knowledge graphs play in successful generative AI implementations. Plus, get an exclusive look at an innovative Neo4j + Generative AI solution Deloitte is developing in-house.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024Neo4j
Neha Bajwa, Vice President of Product Marketing, Neo4j
Join us as we explore breakthrough innovations enabled by interconnected data and AI. Discover firsthand how organizations use relationships in data to uncover contextual insights and solve our most pressing challenges – from optimizing supply chains, detecting fraud, and improving customer experiences to accelerating drug discoveries.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
UiPath Test Automation using UiPath Test Suite series, part 5DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 5. In this session, we will cover CI/CD with devops.
Topics covered:
CI/CD with in UiPath
End-to-end overview of CI/CD pipeline with Azure devops
Speaker:
Lyndsey Byblow, Test Suite Sales Engineer @ UiPath, Inc.
18. 2D Context
var canvas = document.getElementById("gameCanvas");
var context = canvas.getContext("2d");
var width = canvas.width;
var height = canvas.height;
Final source code for the game is on the last slide
Aimed at those thinking about becoming programmersNo programming experienced assumed, do not need to know or have had any exposure to programming, butI’m going to talk about technology and it is going to be a technical talk. I will be covering a bit of programming
Rather than talk extensively about coding, or getting tied down in the specific syntax of the JavaScript language, I will present a high level overview of how to set up a game in JavaScript. I'll show you how you can get images drawing to the screen. How to interact with the user, and how to structure your game loop. I've also made a very basic game you can take home and look over, and start hacking to make your own game. Some of these topics I’ll just touch on, and others I delve a bit more deeply into and show you how to perform those tasks in code. But I hope all the advice I give you today is practical and something you can take away and begin to get your hands dirty with Talk for 30 minutesTake questions at the end
Scripting language – lets you integrate animation, interactivity, and dynamic visual effects into HTML pagesScripting languages not compiled into stand-alone programsAllows for fun, dynamic, and interactive interfaces in web pages. Immediacy - Let’s you respond instantly to clicking, moving the mouse, filling out a formRuns in the browserAdvantage over server-side scripts, no delays when communicating between server and clientExamples – Google MapsJS programs can be really simple (pop up new browser / forms), or full blown web applications or games JavaScript is a programming language – or more specifically, a scripting language – that lets you integrate animation, interactivity, and dynamic visual effects into your HTML pages. Scripting languages differ from traditional programming languages in that they are not compiled and turned into a standalone program. Instead, scripts are read by other programs (in this case the web browser), and the commands contained in them are interpreted and executed by the program. JavaScript allows you create fun, dynamic, and interactive interfaces to integrate into your web pages. In fact, one of JavaScript’s main selling points is its immediacy. It lets your web pages respond instantly to actions like clicking a link, filling out a form, or moving the mouse around the screen. JavaScript runs in the browser. This offers a significant advantage over server-side scripting languages like PHP, which suffer from frustrating delays when communicating between the web browser and the web server. Because JavaScript doesn’t rely on constantly reloading web pages in order for the browser to communicate with the web server, it lets you create web pages that feel and act more like desktop programs than web pages. If you’ve ever visited Google Maps, you’ve seen JavaScript in action. The programs you create with JavaScript range from the really simple (like popping up a new browser window with a web page in it), to full-blown web applications like Google Docs, or games like the one we’ll be building in this workshop.
Want as many people to see your game as possible, with minimum development timeCapitalize on a large audience, across a number of devicesWeb based games allow us to do thisAvoid writing native code, get a cross-platform code baseA few more reasons to consider… Making games is hardAs an independent game developer, you want as many people to be able to play your games with as little time spent on porting between different platforms as possible.The less time you have to spend get your game to work on different hardware, then the more time you can spend on developing the actual game. We can deliver games over the web in order to capitalize on the largest possible audience with a minimal amount of work need on our side in order to deliver that game to all the various hardware and software configurations available on the user’s end. So if we’re targeting the largest possible audience for our game, we want a web based or browser based game that will work on all platforms, including tablets and iOS – which takes flash out of the equation. So HTML 5 is really the technology that is going to afford you that flexibility That will let you avoid writing native code. You’ll get a cross-platform code-base that will run across devices, and it will also let you avoid app stores But before I get into showing you some code, I want to give you a few more reasons why you should consider game development in HTML5. And the chief among those is fast iteration.
Fast iteration key to making good gamesCompiling / recompiling can take a long timeBuilding takes time, getting it onto the hardware can take longerThen run and hit your breakpointsCode-compile-run cycle – longer cycle means less time developingJavascript isn’t compiledGame programmers love scripting languagesIn the browser, just reload A fast iteration is the key to making good games. Compiling a game can take a long time. At Gameloft, especially as we were nearing the end of the development cycle and we were testing and polishing the game, if the testers came back to me and told me I had a bug, I would have to fix the code then recompile the program, execute the game, set a breakpoint and then stat debugging or playing the game to see if my fix worked. The process of recompiling could take up to 5 minutes, depending on whether or not I needed a clean build, and what platform I was targeting. It is not uncommon for this process to take up to 15 minutes for some game companies, depending on the game, the development environment, and their deployment target. Then, if I wanted to test it on an actual device, I would have to wait for our submissions team to validate it and upload it to the carrier’s server, and then I would be able to test it on the device. And if we were releasing a lot of games that day, I might be waiting up to half a day for an upload. iPhone programming is a little better, but you can still be waiting a while for the compilation to complete. Then we need to play the game and wait for our breakpoint to be hit and then start debugging This comes down to what is known as the code-compile-run cycle. And the longer it takes you to do that, the less time you have in a day to actually play and test your game and identify any problems, code it, and make it better. If it is taking you 15 minutes from code fix to play, then that’s 4 times an hour you can play your game. 16 times before lunch, 16 times after. You can play your game 32 times a day. You just can’t get any work done in that kind of environment. JavaScript is a scripting language, meaning that the code we write isn’t compiled until its read and executed by the browser. In fact, game developers use scripting languages a lot for game development for this very reason. If we embed a scripting engine in our game, then we just have to push a button to reload our scripts while our game is still executing to see if our code worked. When you are making games in a web browser, all we need to do is reload the web page and we get reloads instantly, so we’ve got that fast iteration cycle.
Updating can be done in two ways – content released as DLC, or title updateMaking your DLC as a script can bypass the release cycle processiPhone apps are not allowed to use scriptsHTML5 games can bypass this – hosted on your server, viewed directly by client, cuts out middlemanNo one lagging behind, everyone has latest version In console industry 2 types of updates when releasing content for your game after it has shipped:content pack released as DLCtitle update, where your actually modifying the source code of the game. This requires going through a full QA cycle, getting your program revalidated (eg, iPhone store). It can cost lots of money (eg PS) and take a lot of time. If you can make your DLC as a script instead of actual source code, you can bypass that whole process. A couple years ago there was a lot of press about the App Store rejecting programs that implemented scripts, and there was a lot of debate about exactly what that means, what you could do with scripts and what you couldn't. When you make a game in HTML5, you bypass all of this. The game is hosted on your server, and it’s viewed directly in the browser running on the players device. There's no one in the middle. You are in complete control of what content your delivering, and how your delivering it. Also because you are delivering your content directly to the player, you can be guaranteed that there is no-one lagging behind. There is no need to release updates because everyone is always running the same version. You eliminate the need for anyone to explicitly go and download the latest update.
Here's a screenshot of the sample JavaScript game I've made for this presentation. It’s a 2D top down game. This is actually a port of one of the assignments for this year's first year programming class. It's a very simple Crimson Land clone, and I've just implemented some very basic commands as a jumping off point for you to start experimenting with JavaScript. It’s a JavaScript game running of the canvas object, so it will work in really anything with a modern web browser.
Dictated by the browserTop down or isometric will work better – smaller sprites2D will work better In choosing your game make sure it will work in the HTML5 environmentTouch interactions, keyboard / mouse
Annotate text to tell the browser how to render itTo run scripts, we use the scripts tagThe HTML rendering engine runs as far as the script, then starts the JS VM, compiles and executes the code applying any side effects, then continues processing HTML is a language where you annotate text with little annotations that tell it how to render in the browser. HTML is a text language To make text bold we annotate the text with ‘b’ tags<b>Bold<b/> Likewise, to make text italics we use the ‘I’ tag.<i>italics</i> And to run javascripts within our page we use the ‘script’ tag.<script> When you embed scripts within your HTML page, the html rendering engine will download as far as the script tag, it’ll stop, then it’ll start a JS virtual machine, it will compile the code, it will execute the code, it will apply any side effects to the web page itself, and then it will continue processing the rest of the page.
C++ has a main function, the program is linear and starts at mainThere is no main function in JavaScriptCode comparison c++ / JavaScript C++ function on the leftint main(){printf(“hello world”);}The HTML file and script are on the right (HTML on top, script file on bottom)<script src=”main.js” type=”text/javascript”></script> alert(“Hello World”);
Defines a standard way for accessing and manipulating HTML documentsThe DOM presents an HTML document as a tree-structure
The document has children, the head and the bodyThe DOM is the link between the JS code and the HTML page itself. This is how the web page is exposed to JavaScript. So from the JavaScript code we’re going to be editing the DOM. The DOM is the link between the JS code and the HTML page itself.
Web browsers were designed to render textGame programming requires some sneaky subversionCreate a canvas in the page, grab the DOM elementGet the 2D contextCall the interval function (setTimeout or setInterval) The web browser was designed to render text, and when we use it to run a game we’re subverting what the browser was designed to do. So there are a few hurdles we need to overcome in order to render a game.
The easiest way to render to the screen is by using the canvas element This was invented by apple in around 2004 for the widges on the dash in OSX It’s a resolution independent bitmap that gives you a 2d context, and exposes a 2d drawing API Its intended use is for graphs and for games
In the script, grab the canvas from the DOM element. From the canvas element you can get the 2d context, which is what we use to draw to the screen.From the context we can grab the width/height to use when drawing a frame (clearing the screen, for example).
What window.setInterval does is it calls our function at a set interval of about once every .033 seconds.
Here we have a very simple program that will draw a bouncing ball. I have a few variables to control things like gravity, and then I’m calling the function that controls updating and drawing at a set interval using the window.setInterval function This will call my function repeatedly, updating my ball and drawing it at the new position on the screen. And it does this at intervals of around 33 milliseconds.
The sample program here is pretty impressive when you consider the amount of code you need to write to get something working in JavaScript as opposed to C++, or a similar language But we’re jumping ahead with a lot of things here.
Let’s get into it and start making our game. I’ll be making a top down shooter, and I have a small texture that I want to use as the grass that covers the ground of my game. So how do I render that to the screen? Start off by grabbing the 2D context like in the previous example var canvas = document.getElementById("gameCanvas");var context = canvas.getContext("2d"); Now to load the grass image I create a new DOM image element, and specify the filename of the image I want to load in the source parameter. I use the image onloadcallback function to get the framework to call my drawFrame function once the image has finished loading var image = document.createElement("img");image.src = "grass.png"; image.onload = function(){drawFrame(context);}; Code to actually draw an image function drawFrame(c){ // clear the background with blackc.fillStyle = "#000"; c.fillRect(0, 0, canvas.width, canvas.height);c.drawImage(image, 100, 100);}
Screen shot of the code above. Note that the frame is only drawn once the image has been loaded.
We’re using a 2D array to store a grid of tiles. Imagine an array as a bucket. A simple one dimensional array would hold a collection of objects – in this case tile images. You can think of a 2D array as a bucket of buckets, with each bucket holding a collection of objects.Create the array to store the background tiles var background = new Array(15); for(var y=0;y<15;y++){ background[y] = new Array(20); for(var x=0; x<20; x++) background[y][x] = image;} Modify the drawFrame function to draw the tiles in the array function drawFrame(c){ // clear the background with blackc.fillStyle = "#000"; c.fillRect(0, 0, canvas.width, canvas.height); for(var y=0; y<15; y++) { for(var x=0; x<20; x++) {c.drawImage(background[y][x], x<<5, y<<5); } } setTimeout("drawFrame(context)", 0);}
setInterval, call a function repeatedlysetTimeout, call a function after a delayadd some code to track the frame ratecalculate the delta time We can call the setTimeout function to call the drawFrame function repeatedly after a delay. In this case we want to run the game as fast as the browser will let us, so I’m passing in a value of 0 milliseconds. This means that the browser will try to call the drawFrame function again as soon as it possibly can. Alternatively you can use the setInterval function to call the same function repeatedly after a set delay. Either method is fine. Because we’re continually updating the context and redrawing the frame, there’s no need to wait until the grass image loads before we start drawing. We can just go ahead and draw straight away, and when that image is ready it will be drawn.
Since we are no longer making that initial call to the drawFrame function when the image loads, we need to call drawFrame at the very end of the script.I’ve also added some variables to track the frame rate – the number of frames we are drawing per second. To do this I first calculate what is known as the delta time. Delta time is the time in milliseconds that it took the last frame to draw. We use it in games to control the speed of movement and animations so that our games appear to run at the same speed no matter how fast the computer runs. Here I calculate the delta time and use it to track the number of frames per second. I have a variable that tracks the accumulated time by added the delta time each frame. When this value reaches 1000 I record how many frames were drawn during that second. I can then draw this value as text to the context so I can see how fast the game is running.
vector and matrix classsprite classbuild the sprite frames – hCount, vCount, w, h, xOff, yOff, xPad, yPad, frameDurationmatrix transformationssprite updating using delta time There is a lot of code changes needed to get animation working. I won’t go deeply into setting up the sprite class that controls the updating and drawing of the animation, but the code shown here demonstrates how to add a new sprite to the game and get it drawing. The first thing we need to do is add the new script files to the html file. I’ve added 3 new scripts: matrix3x3, vector2, and sprite <script src="vector2.js"></script><script src="matrix3x3.js"></script><script src="sprite.js"></script><script src="main.js"></script> The matrix and vector scripts contain some mathematical operations and object definitions needed to get images drawn at the correct location on the screen. These are complex topics that can’t be covered in this presentation. But a deep understanding of the underlying maths isn’t going to be absolutely essential for us to get things working.
Create the sprite using the following initialisation code: game.sprites.player = new Sprite("player.png");game.sprites.player.buildFrames(8, 1, 32, 32, 0, 0, 0, 0, 0.05);game.sprites.player.setOffset(16, 16); The parameters for the build frame function are the horizontal and vertical frame count that we take from the image. Our image for the player sprite is arranged as 1 row of 8 frames. Then comes the width and height of each frame. This is a simple sprite class so each frame has to be the same width and height. I’ve also included an x and y offset, in case your frames don’t start in the top-left hand corner, and x and y padding variables to specify the number of padding pixels around each frame. Finally there is the frame duration, which is the number of seconds to display the frame for. This will be multiplied by the delta time so that the speed of the animation appears consistent. A value of 1 for the frame duration means that 1 frame will be drawn every second. Here I’m saying draw a new frame every 50 milliseconds, which should give us a frame rate of 20 frames per second – which will look natural when we come to moving the player around the screen. When we come to drawing the sprite we have to set up what is known as a transformation matrix. This matrix will specify where on the screen the sprite will be drawn. A transformation matrix can also be used to control the scale, rotation, and skew of the sprite. The math behind it is not complex, but requires more time to go into than I have time today. After we draw the sprite I reset the transformation matrix by passing in the identity matrix to the context. The identity matrix is the matrix equivalent to 0.
To handle interactions like key press events, mouse movements, or touch screen press events, we use what are called callback function. How these work is that whenever one of these events happens, the window object on the DOM will intercept the event and call any of the functions that we’ve told the window to call.
To add a callback function for key down events, we use this code. I’ve make a keyboard object and told the window to call that object’s onKeyDown function whenever a key is pressed. All this is handled by the keyboard script, so all we have to do in our game is check to see whether or not a key has been pressed, and then handle that appropriately.
To add this keyboard handling to the game I’ve added three new scripts:keyboardplayerbullet The player script will wrap up all the functionality for the player inside one object. This script will handle what happens when the user presses the ‘w’ key – the player sprite will move forward. When we press the space, the player will fire a bullet.
new zombie classmath functions for lookAt and randomsplit drawFrame into Update and Drawadded collision detection I’m skipping a lot of details with the implementation, but next I’ve add a zombie object and a few extra math functions to randomize their location. I create an array of zombies and for each frame I just run through that array and update and draw each zombie. You may have noticed that our drawFrame function was getting a little crowded. What we usually do in games is split out processing into updating and drawing. For each frame we first want to update everything that’s on the screen, and then go through and actually draw it. So I’ve split the drawFrame function in the main script into the update and draw functions. I’ve also added some collision detection, so we can detect when a bullet hits a zombie and, if it does, we kill the zombie and put some blood on the ground.
At the moment the zombies don’t actually move. The last thing to do to finish off our game is to get the zombies moving towards the player.
The zombies have some very simple AI – probably the simplest AI you can give an entity in your game. All they do is look at there the player currently is and start walking towards him. This is the code to get that working. If you add this code inside the Update function in the Zombie script, then all the zombies will start walking towards the player.
If you have any questions, you can email me at samc@aie.edu.au