Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411430 Posts in 69363 Topics- by 58416 Members - Latest Member: JamesAGreen

April 20, 2024, 12:47:34 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsDevader - swarms of enemies - made in HTML5
Pages: 1 [2] 3 4 ... 22
Print
Author Topic: Devader - swarms of enemies - made in HTML5  (Read 52909 times)
marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #20 on: February 17, 2015, 06:05:53 PM »

feeling like I'm not getting anywhere, but I guess the easy quick steps are all gone. mostly finding and fixing bugs and trying to improve performance. this is a big issue and its a tough one.

I read yesterday that branching (if{...}else{...}) is really bad on the gpu and I use it heavily in my shaders. haven't a clue how to fix or change this.

what I have managed to do is completely get rid of a very complex perlin-noise function i was using (did not write it myself) and replace it with something home grown. the perlin-noise was used to blend two textures and make the appearance less repetitive. the replacement function now reuses the two textures by mixing them to create a new blending texture. it works well and I'm hoping the additional texture-lookups are better for performance than the previous solution. I will have to test on weaker hardware. I think it looks better, so at least its been worth changing.

I also came across a very old issue that I had believed to have rectified. I had not. The track outlines are two bezier curves and I have to mesh them to create the polygon track. the points on the curves are evenly spaced and do not mach up with each-other. so I had built a function that would try to match them up, but it failed in a small amount of cases. I've now managed to come up with a solution that I am positive will hold, fingers crossed...


the new assets: candy and cone
you can also see a little bit of noise on the track-texture, its not as obvious on the grass
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #21 on: February 18, 2015, 03:20:29 PM »

as I mentioned in my last post, I'm currently fighting with performance issues. today I tried to find a general solution for handling AI performance. my idea: I limit everything AI related to ~5ms per frame. If it takes longer, it must be handled in the next frame. it was not very hard to code and cars still worked as expected.

then I of course had an idea how to break it. I simply went from 8 cars to 100 cars. astonishingly enough it still worked well and I could play my first race against 100 opponents. after I won the race the AI started to behave weirdly, cars started going way off the track, going in circles and crashing. what had happened? after I crossed the finishing line a few things changed, the camera zooms out and the games speed increases. after deactivating the zoom and speed up it was still a mess. thats when I found the real culprit, the scoreboard. the scoreboard is in html and gets calculated in every frame -> this takes a lot of performance -> the framerate goes down a lot -> AI has less frames of control and the car does what it wants. after turning off the scoreboard it worked ok.

or so I thought, until I tried another track. the track was slippery and the cars started sliding and twisting around. what had happened? as the AI no longer had control over the cars in every frame it had a lot of trouble controlling the car on the slippery surface.

results: the idea to limit the AI is good, as long as the ai gets to control each car fairly frequently. If performance remains high and there are not too many cars its peachy, otherwise its a mess.

I will likely have to kick my complex AI that I built using neural nets and evolution. I spent a lot of time on it, but I can probably make a much simpler version with less impact on performance.

I originally had planned to make AI competitions, maybe this could be a good task? create a fast AI that requires few executions (e.g. 5 per second) to achieve stable results. the duration of the execution would also have to be taken into account for a score. A possible score could be calculated out of SUM(race-time)*SUM(ai-duration).

maybe I can have a contest for the launch Wink but I should probably create a faster working AI myself first.
Logged

dangersam
Level 2
**



View Profile WWW
« Reply #22 on: March 03, 2015, 04:40:48 PM »

Just gave this a try, good fun so far, nice work!  Takes me back to many happy hours playing Micro Machines back in the day... Smiley
Logged

tjpalmer
Level 1
*



View Profile
« Reply #23 on: March 03, 2015, 07:34:22 PM »

100 cars is a brave goal. Good eye to scalability. Simple heuristics are likely enough. However, offline learning should still allow building an efficient model. How big are your neural nets? How big/slow is your feature set, and how much lookahead do you expect to need for your manual AI?

A score could also just include performance at high load cases, too, instead of trying to design a metric.
Logged

tjpalmer
Level 1
*



View Profile
« Reply #24 on: March 05, 2015, 01:54:46 PM »

Also, you might compile your learned networks to JavaScript and let them be jitted for speed. Anyway, this game is definitely slick looking, and it's nice to be aware of all your technical effort, too.
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #25 on: March 05, 2015, 02:32:09 PM »

thanks for the comments guys, totally missed the ones a few days ago. was looking at too many other great things happening on tigs Wink .

@dangersam: glad you liked the game!

@tjpalmer: 100 cars is not really a goal, was more a stress-test. I don't think more than 8-12 cars makes much sense, as it gets hard to track your individual opponents.

my currently best AI uses complex functions in its neural net and has way too many input nodes. it also uses vectors what probably makes even less sense. I mainly built it for fun and just dove in without much thought of prior research. with the reduced load per frame it runs decently on modern but not high-end devices. when I find the time and brain, I will try to make something simpler.

I think designing a metric would be easier in the end. I could for example run a simple script 100 times on any system, to evaluate it. so that people designing an AI could get an understanding of how much the running script will likely cost them.

I'm not sure what you mean by jitting the networks. I currently build the networks and then simply adjust the input values. everything is run in javascript anyway.
Logged

tjpalmer
Level 1
*



View Profile
« Reply #26 on: March 05, 2015, 07:42:01 PM »

Stress tests are cool, too. What I meant by compiling to JS was sort of a loop unrolling thing. So, say, instead of this:

Code:
output = dot(weights, inputs);

You'd have something like this (inventing weights):

Code:
output = 0.7 * a + 0.3 * b - 0.5 * c ... and so on.

That could end up being a bunch of ugly code for your whole network but automatically generated.

I'm not sure what the difference would be. Just seemed like one potential trick to try if you want to squeeze performance. Running AI in a web worker background thread might also have value. Not sure. Anyway, just thinking random thoughts. As I said, I think your stuff's pretty cool.

And yeah, I really enjoy this community, too.
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #27 on: March 06, 2015, 02:07:36 AM »

I like the idea, but the thing is, it would require using the eval function to dynamically create the code. But I've restricted the use of the eval function for the use in AI. I could use it myself of course, but my end-goal will to have others write there own code too. I might consider adding a way to use the eval function "offline" though. thanks for the idea.
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #28 on: March 06, 2015, 07:41:30 AM »

I havent shown much of the stuff, that is not directly game related. as I have just updated quite a few things, I guess its worth a screenshot or two. it's all html5/js too.

this is the "creator" where i can code an test AI's. I just added back the possibility to add circles/lines/text to an AI, to help out with debugging. I removed this stuff about a year ago, when I switched from html to webgl rendering:


this is the "editor" where units and objects get defined. I just added the possibility to group properties, as it was getting badly out of hand and difficult to handle:
Logged

i2nQuinn
Level 0
**


View Profile WWW
« Reply #29 on: March 06, 2015, 09:57:44 AM »

I had fun speeding around! Seems to work fine on Firefox (35.0.1)

I really appreciate the visuals! Would you care to share your graphics asset pipeline?
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #30 on: March 06, 2015, 11:30:19 AM »

hi i2nQuinn, graphics asset pipeline, sure! It's nothing too special, but fairly fast. I create a 3D model, animate/rotate and save all images to a folder. in a java-app I created over 10 years ago (java 1.4), I set the folder and how the images are split up into rotation/animation. it's not pretty but it's a tool designed for me and I know how it works.

after setting what I need, this tool generates a information file and a texture atlas containing all images.
then I open the editor as seen in the earlier post and import this data, giving me a well prepared group of images. I then set the offset in the editor and the graphical part is pretty much done. I can also set the animation sequence in the editor. I can set the speed or have the animation speed depend on the movement of the unit. Or I can add custom code to handle animation (for the carts, the exhaust animation is randomized based on speed).

I you are interested in the trees/foliage, I use a xfrog plugin and randomize a lot of parameters using a script.
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #31 on: March 25, 2015, 03:10:50 PM »

too much to do lately, hardly getting anything done on my game Sad . at least I managed to get some feedback out of a friend. he thought it was too difficult, got annoyed by getting stuck on the trees and found the highlighting on the track confusing.

I've tried to tackle some of the issues: difficulties Cute and Easy have even slower opponents.
The track highlighting now only shows arrows on the checkpoints that you can/should/should have passed.

Fixed a small issue in the track-generator, where some checkpoints could end up too close together. I've also started on reworking the GUI as I want to make it accessible for all kinds of devices: mouse, keyboard, touch-devices and multiple gamepads. the multiple-gamepad one will make this a little tricky. I will need to find a way to show the current selection of all players in some way. but maybe I'm overthinking this?
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #32 on: April 25, 2015, 04:19:44 PM »

finally did a tiny bit of work again. I played around with some new items as I find the current ones still a little boring. the orbiter follows the car, but I could not get it into gif form without the file being massive. so static car to show off the effect. as you can see you can fire this extra multiple times. when an orb clashes with an object it deals damage and gets destroyed.
« Last Edit: April 30, 2015, 02:18:10 PM by marcgfx » Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #33 on: May 01, 2015, 09:34:57 AM »

I've had a really hard time redesigning the GUI. The solution so far was way too complex and condensed too many features into a single screen. As I wanted to support all kinds of input-devices (gamepad, keyboard, mouse, touch), the design had to be much simpler. The new GUI does not yet have all of the functionality of the old one, but I hope to add features later on.

previous:
http://data.cyberlympics.com/html/start.html

new:
http://data.cyberlympics.com/html/nav.html

I've also updated the vehicles you can use (only 4 from this screenshot):

the others are still not well implemented and very hard to handle. The AI also does not know what to do with them...

« Last Edit: May 01, 2015, 10:49:18 AM by marcgfx » Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #34 on: May 04, 2015, 01:58:03 PM »

today refactored gamepad/keyboard input. the gamepad code tended to interfere with the keyboard, now I can switch between them with no issue (I hope).

I then noticed my doppler-effect was no longer working for the engine noises and went about looking for the issue. turns out I had messed up some code, by trying to find a bug introduced in the newest chrome webaudio implementation. damn Sad
while I was working on the noise, I decided to redo the engine sound, I think its better now?

I had recently read, that shaders really hate branching (if(...)else..) and tend to go through all possible paths. as I only use two shaders for the visuals, I have a ton of branching. The worst code I have is for the background/track. it contains code for noisy merging of textures, fraktal generation code (mandelbrot, julia) and other shenanigans. loads of parameters and tons of branching. so I split that shader into background and track related stuff, also forcing another draw-call. I then killed all fraktals and shenanigans. In the end I believe it payed off, as its now running acceptably on my macbook with the highest settings.

while splitting the background/track stuff, I added 3 very simple shaders to visualize the 3 layers (background, track, objects)
« Last Edit: October 22, 2015, 12:13:09 AM by marcgfx » Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #35 on: May 04, 2015, 04:41:11 PM »

should be in bed. but instead I decided to try and imitate the mario-kart extra that makes everyone small. only had to add a new parameter for scale and the basics worked. of course I then had to try various settings, make an icon and upload a new version. just 3 more minutes!
Logged

MikeVitt
Level 0
**


View Profile
« Reply #36 on: July 13, 2015, 06:34:15 PM »

Very cool project! I'm definitely going to try your demo this weekend. Keep up the great work Smiley
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #37 on: August 07, 2015, 05:54:50 AM »

thanks mike, havent had time for anything lately. well hardly. I just did some fiddling with the extras and added a zoom in/out that looks quite nice.

one thing I am struggling with is the oil-extra. on release its a little drop, when you hit it, you lose tracktion and start sliding around for a bit. the oil-drop then leaves a circular patch thats also slippery for everyone else for the entire race.

the patch looks kind of out of place as its absolutely circular. I had to do it without alpha, as overlapping regions look really bad otherwise. inspite of not being quite happy with it, I decided to add a trail to the affected vehicles. the trail left behind the vehicles is visually also not that great.

the only thing I can think of to make it look good is way too complicated. I would basically have to create tracks from the oil patch, maybe even have some kind of fluid calculations.



how bad is it?
Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #38 on: August 07, 2015, 06:39:23 AM »

For a game it looks good enough. Maybe just add minor variation of the curve around the edge of the circles and you'll be fine.
Logged

marcgfx
Level 8
***


if you don't comment, who will?


View Profile WWW
« Reply #39 on: August 07, 2015, 07:59:02 AM »

thanks ProgamGamer, I tend to overthink these little things. I guess it is good enough, at least for now Smiley
there are other more important issues at hand, that I should spend my time on.
Logged

Pages: 1 [2] 3 4 ... 22
Print
Jump to:  

Theme orange-lt created by panic