BlockLeftTop, PRELOAD BlockLeftBottom, PRELOAD BlockLeftStretch, PRELOAD BlockTop, PRELOAD BlockBottom, PRELOAD BlockStretch, PRELOAD BlockRightTop, PRELOAD BlockRightBottom, PRELOAD BlockRightStretch, PRELOAD
DeltaEngine

Lost Squadron, Week 4, Day 2: Getting back to the game.

by Benjamin Nitschke 5. January 2005 06:36
Welcome to 2005 :) Last week I didn't get much code done and run in a couple of problems with Lua and the hardest part about it: debugging lua scripts called from c#. Over the weekend I even tested if it might be worth to switch to Python and tested out the IronPython implementation and written some Python test programs. Python has definitely much more powerful libraries than lua and you can do great stuff with it, the OOP is also much nicer than writing Lua code and having to worry about every . : ] ) and } symbol much more than in any other script language I know of. But Python and especially IronPython is not only a total overkill for a small application and trying to get something quickly to work, the language has also a lot of disadvantages when comparing to Lua. Its not only very large and complex and therefore much harder to learn, but to get something working is much more complicated on the c# side. I also think Lua is much more customable and allows modifying much lower level methods and calls.

Ok, so I skipped that idea and returned back to Lua and finished the EffectManager on the Lua side making only a couple of calls to c#. This did not only help to learn more about Lua and scripting, but I also improved the c# engine very much and spend a lot of time simplifying code of the engine. Creating textures, making unit tests, error handling, etc. all got much easier (this comes when working with Lua and then looking at c# code and thinking everything is overly complicated). Anyways, Ivo and Fabian didn't do much either on the game and so we got stuck in the development and started today again and made a new schedule to finish the game at the end of next week. We will include some left out ideas and have gotten some new improvements on the game, the editor and some units. Ivo did also start some new objects (buildings and enemy units), there might be some fresh graphics for that soon.

Over the chrismas and new years eve weekends I read some more of my Lua and Rapid development books and yesterday I started reading Code Generation in .NET by Kathleen Dollard, which is also very interessting and got me in a lot of thinking how to improve coding in general (not only using scripts and code generation techiques, but going 1 step ahead and create new ways to handle coding and reusing existing code).

Well, first of all Lost Squadron has to be finished :-)

Useful links today:


Day 16:
This screenshots shows my Lua EffectManager rendering effects with help of c# classes (this is just a small unit test testing some effects), it is very fast and calling Lua up to 20 times a frame produces still over 500 fps in debug mode and won't slow down the game at all (using Lua is goooood ^^). I wasn't posting updates since the last week because there wasn't much going on to produce fancy screenshots and I worked at other stuff (internal parts of the engine and Lua scripting). I will now try to post a screenshot at least every 2 days or so. Tomorrow I will hopefully finish the unit shooting and exploding part and post a ingame screenshot again.

Comments


1/5/2005 12:31:40 PM #

Thanks for the link to the game libraries page. I hope some people get some use out of it! It would be a shame for everybody to reinvent the wheel instead of getting down to creating games!

Good luck with the Lua; personally I intend writing my next game using Python, if I can just manage to get enough libraries working with it. I like C++ for the precise control it gives but I think that it's time we wrote code in higher-level languages where possible.

Ben Sizer | Reply



1/5/2005 5:52:49 PM #

yeah u might be right when using c++ and creating a big project python might be much more useful. most ppl have still a lot of c++ code and therefor can't switch that easily to higher level languages.

i mean, did anyone did ever take a look at some quake1-3 sources? its just plain c and IMO very ugly to read and understand unless you are a total c freak, I guess the doom3 source isn't much better. hl2 source wasn't much better, having 1mio source files for every little part isn't very easy to read or even write a mod from, but ppl are doing it anyways. but still, those guys manage to work with that and will continue to do so over the next years and thats possible too (at least they are not doing pure assembler ...)

I'm just happy lua is so fast, I just did a little performance test and every lua call takes with a couple of lua function calls only 15ns. I can call the AddEffect function (which sets around 20 parameters for a new effect and init all counters) over 66 000 times per second, thats ok I guess when considering calling from c# is the "slow" part according to the documentation ^^

abi | Reply



1/6/2005 9:19:41 AM #

It's interesting you say that you think all C# is complex after programming in Lua. I'm writing a system which is loosely based on an existing system written in Lua (actually a Debian package). The Lua codebase is 270K. The C#v2 codebase is 130K. Currently, the C# codebase is lacking some of the features of the Lua codebase, but it's certainly a lot less than 50% more features.

The Lua code looks complex to me.

RichB | Reply



1/6/2005 1:42:20 PM #

Actually it was not as complex as c# in my case, I had an EffectManager in c# for Arena Wars, which was pretty large (>5k lines). It handled a lot of complicated cases, but the Lua stuff is just so much shorter and simpler than the c# code. In c# it was very hard to initialize all EffectParameters, in Lua is is very simple (warning, tabs don't work here, does not look pretty without indentation):

local EP = EffectParameter.Create
local ET = EffectTextures
local ES = EffectSounds
EffectTypes =
{
AttackCursor = EP{
textureType = ET.AttackCursor,
color = Color.White,
startSize = 1},
ExplosionEnemySmall = EP{
textureType = ET.Explosion1,
soundType = ES.Explosion1,
soundVolume = 0.8,
lifeTime = 2000,
fadeInTime = 250,
fadeOutTime = 1500,
startSize = 1.2,
endSize = 1.4,
linkedEffect = SmokeSmall},
ExplosionEnemyMedium = EP{
textureType = ET.Explosion2,
soundType = ES.Explosion2,
soundVolume = 0.8,
lifeTime = 2000,
fadeInTime = 250,
fadeOutTime = 1500,
startSize = 1.2,
endSize = 1.4,
linkedEffect = SmokeMedium},
ExplosionEnemyBig = EP{
textureType = ET.Explosion2,
soundType = ES.Explosion2,
soundVolume = 0.8,
lifeTime = 2000,
fadeInTime = 250,
fadeOutTime = 1500,
startSize = 1.2,
endSize = 1.4,
linkedEffect = ExplosionRingWithSmoke},
etc.

anyone can change that and I don't have to recompile for any effect change. The cool part is the Create function with takes the parameters array and if any value is missing the default value will be used.
The add effect function is also not that complicated (the parameters are optional):

function EffectManager.AddEffect(setType,
startPosX, startPosY, startPosZ,
targetPosX, targetPosY, targetPosZ,
colorR, colorG, colorB, colorA)
-- Add new effect with setType
local effectType = EffectTypes[setType]
-- Can only add if effect type exists
if effectType ~= nil and
posX ~= nil and
posY ~= nil then
local startPos = Vector3.Create(startPosX, startPosY, startPosZ or 0)
-- If targetPos is not used, use startPos as targetPos (which is usually the case)
local targetPos = startPos
if targetPosX ~= nil and
targetPosZ ~= nil then
targetPos = Vector3.Create(targetPosX, targetPosY, targetPosZ or 0)
end
local color = Color.Create(colorR or 1, colorG or 1, colorB or 1, colorA or 1)
-- Add to effect list
table.insert(EffectManager.effects,
Effect.Create(effectType, startPos, targetPos, color))
-- Does effect has some sound we should play now?
if effectType.soundType ~= nil and
effectType.soundVolume ~= 0 and
EffectManager.sounds[effectType.soundType] ~= nil then
EffectManager.sounds[effectType.soundType]Tonglay(
effectType.soundVolume*100)
end -- if
-- Does effect has some linked effect?
if effectType.linkedEffect ~= nil then
EffectManager.AddEffect(effectType.linkedEffect,
startPosX, startPosY, startPosZ,
targetPosX, targetPosY, targetPosZ,
colorR, colorG, colorB, colorA)
end -- if
end -- if
end -- AddEffect

I'm not happy with a lot of Lua either, but it is in the case of my EffectManager much nicer to have on the lua side. For example I don't need any more effect parameter loading from any text or binary files, I can use the definitions in lua and whoever wants to change something just messes around in that file.

abi | Reply



1/7/2005 2:03:11 AM #

Nice graphics and code - I added yout blog and your game to my managed directx page at http://www.thezbuffer.com - let me know if I have anything wrong.

Zman | Reply



1/7/2005 2:37:37 AM #

Yeah thanks Smile
You wrote on your site "Looks like Benajmin was also involved in Arena Wars". Thats right, actually I wrote Arena Wars, so I guess I had to be involved ^^

I've also added your site on my blogroll (and some other ones I collected over the last weeks).

abi | Reply



1/9/2005 12:02:19 PM #

o_O

I don't understand a word, but np Laughing
gogo Abi, i want to play Lost Squadron :>

Cry | Reply



11/19/2009 2:45:30 PM #

I just hope to have understood this the way it was meant

payday loans | Reply



1/7/2010 2:11:56 PM #

Do you make money out of this blog? just curious

pay day loans | Reply



4/6/2010 4:29:21 PM #

Great post. I have learned a lot. I am grateful to my friend who told me to visit your blog. Thanks a lot!

notebook | Reply



4/6/2010 6:03:43 PM #

Great post. I have learned a lot. I am grateful to my friend who told me to visit your blog. Thanks a lot!

notebook | Reply



4/18/2010 5:34:35 PM #

Nice post thanks.

us | Reply



4/30/2010 11:35:50 AM #

What helps people, helps business.

no fax loans | Reply


Add comment




biuquote
  • Comment
  • Preview
Loading



Disclaimer: The opinions expressed in this blog are own personal opinions and do not represent the companies view.
© 2000-2011 exDream GmbH & MobileBits GmbH. All rights reserved. Legal/Impressum

Poll

Which platform should Soulcraft be released on next?











Show Results Poll Archive

Recent Games

Soulcraft

Fireburst

Jobs @ exDream

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910