ID:1908982
 

video

All graphics are built from squares and circles, from my shapes library. For example, the red X is just 3 rects: one for the background, one transformed to be skinny at at a 45° angle, and another at a -45° angle.

The code uses a more developed version of the code in the "_lib" folder of my planes demo.

A few examples of the kind of code I've been writing (untested):
// Using shapes for everything
atom/icon = 'shapes.dmi'

// WASD movement
entity/player
icon_state = "oval"
color = "navy"
step_size = 4

Login()
..()
var keyboard/k = new (client)
k.Axis("x", "d", "a")
k.Axis("y", "w", "s")

Update()
Slide(vec2_scale_to(client.keyboard.Check2D(), step_size))
..()

// Shooting
entity/player
var next_shot
var shoot_lag = 2

Update()
..()
if(client.mouse.down & MOUSE_LEFT)
if(world.time >= next_shot)
next_shot = world.time + shoot_lag
new /enity/bullet (src, client.mouse.Angle())

entity/bullet
icon_state = "oval"
color = "yellow"

bounds = "1,1"
bound_x = 16
bound_y = 16

var velocity[]

New(mob/Shooter, Angle)
SetCenter(Shooter)
velocity = vec2p(16, Angle)

Update()
Translate(velocity)

Bump()
del src

// Gun aiming
entity/player

var obj/gun/gun

New()
..()
gun = new (src)

Update()
..()
gun && gun.Update()

obj/gun
icon_state = "rect"
color = "black"

var angle
var entity/shooter
var matrix/shape = matrix(3/32, 0, 0, 0, 1, 0) // thin rectangle

New(Shooter)
transform = shape
shooter = Shooter

proc/Update()
var new_angle = shooter.client.mouse.Angle()
if(angle != new_angle)
angle = new_angle
shooter.overlays -= src
var matrix/mat = new (shape)
mat.Translate(0, 32)
mat.Turn(angle)
transform = mat
shooter.overlays += src

By taking advantage of my libraries, the game in the video was made in much less than an hour.

But even with all that, I can never get myself to stay on a single project for very long. Ugh.
How feasible is this with about 50+ players shooting at same time, just wondering CPU wise?
In response to Zasif
It's kinda hard to say. With a 2.4 GHz processor, moving around and shooting constantly,
* Profiler averages never go above 0.000
* world.cpu never exceeds 1
* Task Manager shows Dream Daemon never exceeding 2%
Also, it's running at 60 frames per second locally. If it was intended for online multiplayer, it'd have to be reduced 40 or 30 FPS, which means CPU usage would improve by almost 2x.

I doubt it would support 50+ players, though. To get that many players, it'd surely have to be more than the most basic shooting gallery that it is, which would probably end up costing a lot more CPU. I'm a bit curious to see how far I could push it, though.
I've never seen an expression like this before unless used in an if statement:
gun && gun.Update()

I am guessing it returns true if gun exists, but if it evaluates to true without an assignment, wouldn't that give an error?

Edit: just read "untested" so likely a typo
In response to Mr_Goober
It's not a typo.

Short-circuit reads left to right. It checks if the left is true before checking the right. You can do the same with ||, but it evaluates until it hits a true value. The ?: operator also works.

It's the same as calling a proc that returns a value, but not setting anything to it. You're just leaving a value on that line and nothing happens. Operators can still use them and expressions are still evaluated. Don't forget that && and || are just operators like + and -, and they're no more related to if() than any other operator.

I first saw it used in Lummox JR's Runt source (the unreadable one) and it may be faster than the alternative, if(gun) gun.Update() because it doesn't create a new block.
Add more targets, redid walls, and made a few different guns:
pistol
smg (a bit exaggerated firing rate)
shotgun


I tried setting up OBS to record in 60fps, but I'm not sure if that worked.

If you're using Chrome, I suggest getting the Hover Zoom extension. You can mouse-over links to images and videos, and it'll show it in a convenient popup.
SMG? More like Rambo's minigun lol. I feel like the shotgun's spread is a bit too wide. A range that wide makes me feel like the shotgun has no barrel at all, heh.

I'm digging the way shapes are used in th8s demo. How are you handling bullet collisions? Just plain ol Crossed?
In response to Mr_Goober
Mr_Goober wrote:
SMG? More like Rambo's minigun lol. I feel like the shotgun's spread is a bit too wide. A range that wide makes me feel like the shotgun has no barrel at all, heh.
Yeah, I agree. I changed the shotgun to just shoot 4 bullets at random angles within just a 30° cone. It's easy to change, though.

I'm digging the way shapes are used in th8s demo.
The wall shadows came out surprisingly well from just two sheared rectangles.

How are you handling bullet collisions? Just plain ol Crossed?
Just Bump(), actually. Bullets are entities that move every frame.

I don't think many people know this, but if your step_size is greater than your movement distance, collisions are automatically detected accurately along the line of movement. This is referred to in the Reference as a slide. For example, the bullet could have a 1x1 bounding box and be moved 1000 pixels at any angle, and it will collide with anything along its path (although the CPU usage does increase for smaller objects moving greater distances).

Also, I added a sword. Of course, you can dual wield a sword and pistol. You can't currently slice bullets out of the air, though.

I kind of cheated and made a new arrow shape. The sword uses it, but I didn't make the arrow specifically for the sword... it's been useful as a non-symmetric shape for showing directional info. I'll be uploading the updated shapes library eventually, so look forward to it.
In response to Kaiochao
Kaiochao wrote:
Also, I added a sword. Of course, you can dual wield a sword and pistol. You can't currently slice bullets out of the air, though.

epic 2 lookin mighty fine
In response to Kaiochao
Kaiochao wrote:
It's kinda hard to say. With a 2.4 GHz processor, moving around and shooting constantly,
* Profiler averages never go above 0.000
* world.cpu never exceeds 1
* Task Manager shows Dream Daemon never exceeding 2%
Also, it's running at 60 frames per second locally. If it was intended for online multiplayer, it'd have to be reduced 40 or 30 FPS, which means CPU usage would improve by almost 2x.

I doubt it would support 50+ players, though. To get that many players, it'd surely have to be more than the most basic shooting gallery that it is, which would probably end up costing a lot more CPU. I'm a bit curious to see how far I could push it, though.

You can always take a page from Forum_Account and create a demo of this with tons of mobs running around shooting and you could really test how many would be viable online.