Ludum Dare 35
The Theme is:
Shapeshift

Posts Tagged ‘programming’

Transformagician Level Generation and Design

Posted by
Tuesday, May 3rd, 2016 12:42 am

"ANOTHER

I already touched upon the level generation in the Developer commentary video,
but that’s not enough info now is it! Here’s some more…

Tiles

One of the easiest ways to construct a virtual environment is to use tiles.
For me the decision to go with the technique was made even easier by already having an old tilemapping system laying around.
It was a bit rusty, but a few hours of mangling put it straight.

Sets

WallAndFloors

The tile graphics are as simple as possible. There’s a wall and there’s a floor.

I of course only implemented these assets as they were made by Ranquil. Pay special attention to the bump mapping!

Reading

The level is generated from an xml file. Here’s a little example:

<Ship type="TestMap">
 , , , , , , , , ,
 , . w . h . w . ,
 , . . . . . . . ,
 , . w . p . w . ,
 , . w w w w w . ,
 , . . . . . . . ,
 , . . . e . . . ,
 , . . . . . . . ,
 , , , , , , , , ,
 </Ship>

TestLevel

There are a few oddities right off the bat. The XML element is called a ship as that’s what the original project had, spaceships. The map is also flipped around as unity XYZ coordinates don’t quite match with the XY coordinates of the map file.

One nifty feature in the generator is spawning random rooms to specific positions on the map. The rooms themselves are defined in the same way as the maps.

<Room name="roomD" loot_a="0,1" enemy_a="2,6">
 w w w w . w w w w
 w . . . . . . . w
 w . w . w . w . .
 w . . . . . . . w
 . . w . o . w . .
 w . . . . . . . w
 w . w . w . w . .
 w . . . . . . . w
 w w w w . w w w w
 </Room>

And rooms areas are outlined with the characters R (room start position) and r (room limits).

 c c w c c c c c , , , , ,
 c c c w c R r r r r r r ,
 o c c c c r r r r r r r ,
 c c w c c r r r r r r r ,
 c c c w c r r r r r r r c
 c w c c c r r r r r r r c
 c c w c c r r r r r r r c
 c c c c c r r r r r r r c
 o c w c c r r r r r r r c
 c c c w c r r r r r r r c
 c c c c c c c c c c c c c
 , , , , , , c c c c c c c

(excerpt from a bigger map)

You can see the room randomization featured in the GIF.

Writing

Designing maps in black and white is kind of like programming in vanilla notepad, no syntax highlighting, no nothing. In other words clumsy and crude.

This issue can be resolved with conditional formatting in a spreadsheet (in this case Libre Office). Compare and contrast, the text file version:

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
 , W w w w w w w , , , , , , , , , , , , , , , , , , , , , w c c c c c , , , ,
 , w p p . . . w , , , , , , , , , , , , , , , , , , , , , w c o c o c , , , ,
 , w p p w w . . c c c c c c c c c c c c c c c c c c c c c c c c c c c , , , ,
 , w . w R r r r r c c c c c c R r r r r r r r r c R r r r c w w , , c , , , ,
 , w . w r r r r r c , w c , c r r r r r r r r r c r r r r c , , , , c , , , ,
 , w . . r r r r r c , w c , c r r r r r r r r r c r r r r c , , , w c w , , ,
 , w w . r r r r r c , w c , c r r r r r r r r r c r r r r c , , , w c w , c ,
 , , , c r r r r r c c c c c c r r r r r r r r r c r r r r c , , , w c c c c ,
 , , , c r r r r r c c , w c c r r r r r r r r r c r r r r c , , , w c w , c ,
 , , , c r r r r r c o , w o c r r r r r r r r r c r r r r c , , , w c w , , ,
 , , , c r r r r r c c , w c c r r r r r r r r r c r r r r c , , , , c , , , ,
 w c c c c c c c c c c c c c c r r r r r r r r r c r r r r c , , , , c , , , ,
 , c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c , , , ,
 w c R r r r r r r r r r c c c c c R r r r r r r w c c R r r r r r c , , , , ,
 , c r r r r r r r r r r c c c c c r r r r r r r w c c r r r r r r c , , , , ,
 w c r r r r r r r r r r c c c c c r r r r r r r c c w r r r r r r c , , , , ,
 , c r r r r r r r r r r c c c c c r r r r r r r c c w r r r r r r c , , , , ,
 w c r r r r r r r r r r c c c c c r r r r r r r c c c r r r r r r c , , , , ,
 , c r r c c c c c c c c c c c w c r r r r r r r c w c r r r r r r c , , , , ,
 w c r r c w c w c w c w c c c w c c c c c c c c c w c r r r r r r c , , , , ,
 , , r r c c c c c c c c c c c w c R r r r r r r c w c r r r r r r c , , , , ,
 , , r r c w c w c w c w c c c c c r r r r r r r c c c r r r r r r c , , , , ,
 , , r r c o c o c o c o c w c c c r r r r r r r w c c r r r r r r c w w , , ,
 , , , , c c c c c c c c c c w c c r r r r r r r c c w r r r r r r c , w , , ,
 , , w w c c c c c c c c c c c c c r r r r r r r w c c r r r r r r c , w , , ,
 , , w w c w , , , , c c c w c c c c c c c c c c c c c c c c c c c c , w , , ,
 , , w w c w w , , , c c o w o c c R r r r r r r r c , , c c , , , c , w , , ,
 , , w w c w w w , , c w w o w w c r r r r r r r r c , , c c , , , c , w , , ,
 , , , , c , w w w , c c o w o c c r r r r r r r r c w c c c c w w c w w w w w
 , , , , c , , w w c c c c w c c c r r r r r r r r c w c o c c , , c , w , , w
 , , , , c , , , c c c c c c c c c r r r r r r r r c c c w o c c c c , w , , w
 , , , , c , , , c c R r r r r c c r r r r r r r r c c c o w c c c c , w , , w
 , , , , c , , , c c r r r r r c c r r r r r r r r c w c c o c , , c , w , , w
 , , , , c c c c c c r r r r r c c r r r r r r r r c w c c c c w w o w w w w w
 , , , , c w w w w c r r r r r c c c c c c c c c c c , , c c , , , w , w , , ,
 , , , , c c c c c c r r r r r c w c , w , , , w , c , , c c , , , , , w , , ,
 , , , , , , c w c c r r r r r c o c , , w , w , , c c c c c c c c c , w , , ,
 , , , , , , c w c c r r r r r c c c , , , w , , , c R r r r r r r c , w , , ,
 , , , , , , c w c c r r r r r c w c , , w , w , , c r r r r r r r c , w , , ,
 , , , , , , c w c c r r r r r c o c , w , , , w , c r r r r r r r c , w , , ,
 , , , , , , c w c c c c c c c c c c c c c c c c c c r r r r r r r c , w , , ,
 , , , , , , c c c c c c w c c c c c , , , , , c , c r r r r r r r c , w , , ,
 , , , , , , , , , , c c c w c R r r r r r r , c w c r r r r r r r c c c c c ,
 , , , , , , , , , w o c c c c r r r r r r r , c w c r r r r r r r c w w w c ,
 , , , , , , , , , , c c w c c r r r r r r r , c , c r r r r r r r c c c c c ,
 , , , , , , , , , , c c c w c r r r r r r r c c c c c c c c c c c c c c o w ,
 , , , , , , , , , w c w c c c r r r r r r r c c c c c c c c c c c c c c c c ,
 , , , , , , , , , , c c w c c r r r r r r r c w , , w c o c c w , c w w w c ,
 , , , , , , , , , , c c c c c r r r r r r r c w , , w c c c c w , c c c c c ,
 , , , , , , , , , w o c w c c r r r r r r r c c c c c c c o c w , , w c w , ,
 , , , , , , , , , , c c c w c r r r r r r r c w , , w c c c c w , , w c w , ,
 , , , , , , , , , , c c c c c c c c c c c c c w , , w c o c c w , , , c , , ,
 , , , , , , , , , , , , , , , c c c c c c c c w , , w c c c c w , , , c , , ,
 , , , , , , , , , , , , , , , c o c o c o c , , , , , c , , c , , w w c w w ,
 , , , , , , , , , , , , , , , , w , w , w , , , , , , c , , c , , w c c c w ,
 , , , , , , , , , , , , , , , , , , , , , , , , , , , c c c c c c c c h c , ,
 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , w c c c w ,
 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , w w , w w ,

With the conditionally formatted spreadsheet:

Spreadsheet

A thing a beauty! And here’s the map rendered in engine (flipped around this time, also no lighting)

Level2Full

Yet again there are a few issues. You need to jump though some hoops to get from the ODS spreadsheet file to the XML file. First the file is converted to the comma separated values format (CSV) and then the data is manually copied to the XML. Yeah, that last bit especially is not so great.

It is trivial to read the CSV file directly from Unity (something I didn’t know about way back then), so that’s what I’m going to do in the next project.

Conclusions

Tiles are a simple and powerful way to represent a level. Reading letter based map files is easy to code and fluid to create (with conditional formatting at least). Reusing systems that you’ve made before is a great boon to productivity. Take advantage of previous work as often as possible.

And, of course, you can play Transformagician right here.

Transformagician – Performance Optimization

Posted by
Saturday, April 23rd, 2016 3:16 am

The jam is over, the entry turned out great and the WebGL build (which most people are going to play) runs quite badly. What to do? Optimize!

Identifying the problem

When trying to improve performance you should always go for the elephant in the room. In most cases taming the alpha male is enough (including this one). Run the profiler on the target build and see what is up (milliseconds) and what is down (framerate!). Let’s look at the rendering performance of the following scene.

Image 1: Benchmark scene

Figure 1: Rendering performance in Unity editor

Not bad! The deferred renderer does a pretty good job at batching drawcalls.

Figure 2: Rendering performance in WebGL build

Very bad! The WebGL build seems to fall back to forward rendering before a deferred lighting pass. Maybe this is why the batching is botched, I’m not quite sure, but there most certainly is a drawcall problem.

Solving the problem

One solution immediately springs to mind: Mesh.CombineMeshes. After some modifications the script works like a dream.

The walls in the scene are combined into a single mesh and the floors into another. As long as all the meshes share the same material there will be no trouble and the combined mesh looks just like a bunch of individual objects.

The only difference being a drastic reduction in draw calls. Let’s see just how drastic we’re talking about here:

Figure 3: Rendering performance in editor (with MeshCombine)

Mere three times faster… I think we can do better.

Figure 4: Rendering performance in WebGL build (with MeshCombine)

Fifteen times faster! I rest my case.

Conclusion

Use the profiler, identify the worst offender, smite it and rejoice. There are further optimization I could do, but why bother. At this point it’s already an effort in diminishing returns.

Getting less than 60 frames per second? Time to look in the mirror and get to work!

A tip for Platformer Developers!

Posted by (twitter: @ToastedGames)
Sunday, April 3rd, 2016 3:26 pm

Platformers have been a fairly difficult genre for beginner programmers to design. Most of the problems I’ve encountered come from the physics engine that has to be built. Generally, people don’t know how to program collisions with tiles and end up with players hovering over the ground, falling through the ground, or some other equally annoying glitch. I want to show you how to issues like this, with a script I made. Well, I won’t give you the exact script, because you won’t be using the same program as me, but here’s the basics:


(make 'i' equal 'velocity', if 'i' is greater than 0, repeat this loop until it equals 0, subtracting 1 every time)

//Run the script below for every pixel the player would move.
{
if there's an object at 'x', 'y'+'i' and it's a platform,
subtract 1 from 'velocity' //Lower how far down to go.
}
'y' = 'y' + 'velocity' //Go to the new velocity.

Well, that’s all for now. Hope this helps! Bye :)

(This post was a snip from my post on the Toasted Games website. Here’s the full post.)
-Ben

Presenting DIV Games Studio for LD #35

Posted by (twitter: @TheMikeDX)
Wednesday, March 16th, 2016 4:31 pm

Back in 2000, DIV Games Studio was released in the UK as a complete all in one package for creating games (including a graphical editor) and delighted many users who went on to have successful programming careers, including MDickie who currently has literally MILLIONS of downloads on the android app stores.

DIV was put to rest in 2005 due to being DOS only, but after 10 years sleep, it is now back and ready to compete with the modern world.

A group of us at DIV ARENA are planning to enter LD #35 using DIV Games studio, and exporting our entries to all the modern systems we can (including windows, linux, android, javascript/html, open pandora, gcw and others).

you may even be surprised with what we achieve!

Looking forward to it. See you there :)

 

 

Proud

Posted by (twitter: @ZepCap)
Sunday, August 25th, 2013 6:08 am

After hours of thinking about this, while showering, running, sleeping, coding other stuff, then finally, my proudest achievement in this weekend:

P = NP

So. Simple.

(it changes the 8-way movement of a topdown character so that when he moves diagonally, he doesn’t move faster than when travelling vertically or horizontally.)

Hi everyone

****I posted new questions about compilers and editors in the comments please read them :) ****

I am an experienced programmer and know a few languages.

I want to start making games with a windows 7 computer for any operating system (linux, Mac and Windows).

I do not know which is the best coding language to use for that that is free But has a good compiler and runs well. I also do not want to use software like gamemaker or construct. Something like c++ or java or love2D so please take that into consideration!

Also what libraries would I need for 2D games for now to make it with.

Thanks so much for your help in advance! I really want to become some kind of game devloper so this is key.

Hope you all are having fun in the ludum dare! Expect me to be ready for the next one!

Hope my questions make sense!

Please comment!

Thanks

Swipefaststudios

Today was more difficult than me and Sebastian have anticipated. He spent a long time today having trouble with drawing characters. I have also had troubles based on programming porting and the options menu. We managed to get some things done however in the 7 or so hours we worked today (all on stream on Twitch.tv/zxeonz and twitch.tv/threadNecromancer) His log will be coming sometime tomorrow.

Anyway, what I have managed to accomplish today.

07/22:

  • Set up parallax scrolling for the Y axis of the camera //This was the last thing I accomplished today, and also the easiest. I merely needed to add a few lines of code to the existing Strider Run codebase for the camera.
  • I updated the start and options menus.
  • I worked on ranged weapon implementation. It currently has a few problems with the gamepad control not working, and the controls for the mouse are inverted.
  • I added the ability to resize the window. //I just need to add an option for Full Screen.

 

Anyway, that is all we have accomplished on Day 1. Do tune into my Twitch channel if you want to see the development process. I will be streaming most of the day on Twitch.tv/zxeonz.

I will add media once the game is actually more like an RTS. In the mean time, if you really want to see the game, I did live stream it.

If you want to follow this developer blog easier, then go to www.kerinova.blogspot.com I will be posting these blogs there, in addition to here.

Hello everyone, Sebastian here.

Day 0 was a day of immense preparation for our debut in #7DRTS, as we had many things to get ready for the challenge that will be not *entirely* failing at this. I think we did well…? At least, we managed to not break anything so far.

To reiterate for the fifty-thousanth time, the game we are making will be called Defence Paradigm. Basically the concept is a MOBA/ARTS- with potential macro elements and controllable units other than the main hero.

What I did on Day 0 [7/21]-

-I tried and managed to actually succeed at making the stream work with semi-decent quality

-We (me and Xeon over at twitch.tv/zxeonz) created the GDD

– I set up all the VSTs that I’ll be using to make the music and sound

– I made my already ghetto setup more ghetto by trying to make the second monitor for streaming not be crunched into the wall

-I designed the HUD concept

HUD

 

 

Go to my stream at twitch.tv/threadnecromancer for my side of the development

New Udacity course HTML5 Game Development

Posted by (twitter: @tristan_lasty)
Tuesday, February 5th, 2013 7:32 pm

A new Udacity course has just begun, which may be of interest to (future) HTML5 game programmers.

https://www.udacity.com/course/cs255

(Or Watch the short intro video:  https://www.youtube.com/watch?feature=player_embedded&v=F3JeV756B7w )

The course has only just begun so there is not much content yet, just Unit 0 and Unit 1.

Free to sign up and participate.

There are other courses too, ranging from beginners to advanced (python mostly, and even non-computery courses like physics, statistics, algebra)

 

Progress, and likely going to be done for tonight.

Posted by (twitter: @rye761)
Friday, December 14th, 2012 9:28 pm

It isn’t really late, but 2 hours in, I have some nice progress and think I’ll take a break – for the night. My idea this go around is fairly simple on the programming side of things, which is great, as I’m not that amazing of programmer. Even though that is the thing I am “best” at when it comes to making games 😛 I am going with Pong, where you are controlling the ball. Here’s what it looks like ATM (and there is a ball that just ran off the screen too!):

Invert Pong stage 1

 

Collision detection and more work on how the ball works tomorrow. I seem to be swinging in and out of the LD mode a lot tonight. Hopefully this big break doesn’t coem to haunt me in the end :)

What i’ll be using

Posted by (twitter: @colincapurso)
Monday, December 12th, 2011 6:18 am
  • Language: Javascript / HTML5 Canvas
  • Art: Adobe Illustrator / Adobe Photoshop
  • Audio: If there is audio, i’ll be using sfxr and any modifications to that with Audacity
  • Base Code / Libraries:
    Asset Manager from the Google I/O presentation for pre-loading images.
    My base template
  • Screenshots: I’ll set up to take periodic screenshots, a word of warning though, I can’t guarantee it will be completely SFW 😛

[cache: storing page]